Skip to content

Commit

Permalink
Revert "Midpoints are enabled for 4 level worlds"
Browse files Browse the repository at this point in the history
This reverts commit 8fd1ab5.
  • Loading branch information
Coolcord committed Aug 10, 2019
1 parent 7da8bc0 commit 1ca8c2d
Show file tree
Hide file tree
Showing 25 changed files with 73 additions and 386 deletions.
3 changes: 1 addition & 2 deletions SMB1/SMB1_Compliance_Generator/Bridge_Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ bool Bridge_Generator::Generate_Level() {
//Create the level
while (!this->end->Is_End_Written()) {
x = this->object->Get_Last_Object_Length();
this->midpointHandler->Handle_Midpoint(x);
x = this->Get_Safe_Jump_Distance(x);

//TODO: Clean up probabilities
Expand Down Expand Up @@ -62,7 +61,7 @@ bool Bridge_Generator::Generate_Level() {

//Write the header last
return this->header->Write_Header(Level_Type::BRIDGE, Level_Attribute::OVERWORLD, Brick::SURFACE, this->firstPageHandler->Get_Header_Background(), this->args->headerScenery, this->args->levelCompliment, 400,
this->midpointHandler->Get_Midpoint(), this->args->difficulty, this->object->Get_Level_Length(),
0, this->args->difficulty, this->object->Get_Level_Length(),
this->object->Get_Num_Items(), this->enemy->Get_Num_Items(), 0);
}

Expand Down
3 changes: 1 addition & 2 deletions SMB1/SMB1_Compliance_Generator/Castle_Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ bool Castle_Generator::Generate_Level() {
this->requiredEnemySpawns->Set_Num_End_Bytes(this->requiredEnemySpawns->Get_Num_End_Bytes()+8);
int x = 0;
assert(this->Spawn_Intro(x));
this->midpointHandler->Handle_Midpoint(x);
this->brick = Brick::SURFACE_4_AND_CEILING_3;

//Create the level
Expand Down Expand Up @@ -59,7 +58,7 @@ bool Castle_Generator::Generate_Level() {

//Write the header last
return this->header->Write_Header(Level_Type::CASTLE, Level_Attribute::CASTLE, Brick::SURFACE_4_AND_CEILING_3, Background::OVER_WATER, Scenery::NO_SCENERY, this->args->levelCompliment, 400,
this->midpointHandler->Get_Midpoint(), this->args->difficulty, this->object->Get_Level_Length(),
0, this->args->difficulty, this->object->Get_Level_Length(),
this->object->Get_Num_Items(), this->enemy->Get_Num_Items(), 0);
}

Expand Down
36 changes: 2 additions & 34 deletions SMB1/SMB1_Compliance_Generator/Continuous_Enemies_Spawner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,15 @@ Continuous_Enemies_Spawner::Continuous_Enemies_Spawner(SMB1_Compliance_Generator
this->args = args;
this->object = object;
this->requiredEnemySpawns = requiredEnemySpawns;
this->lastSpawn = Enemy_Item::NOTHING;
}

Enemy_Item::Enemy_Item Continuous_Enemies_Spawner::Create_Continuous_Enemies_Spawner(int x) {
this->lastSpawn = this->Determine_Continuous_Enemies_Spawner(x);
return this->lastSpawn;
}

Enemy_Item::Enemy_Item Continuous_Enemies_Spawner::Create_Midpoint_Continuous_Enemies_Spawner(int x) {
switch (this->lastSpawn) {
default: assert(false); break;
case Enemy_Item::NOTHING: break;
case Enemy_Item::BULLET_BILL_SPAWNER:
if (this->args->levelType == Level_Type::UNDERWATER) {
if (this->object->Get_Absolute_X(x) == 0xF) assert(this->object->Swimming_Cheep_Cheep_Spawner(x+1));
else assert(this->object->Swimming_Cheep_Cheep_Spawner(x));
} else {
if (this->object->Get_Absolute_X(x) == 0xF) assert(this->object->Bullet_Bill_Spawner(x+1));
else assert(this->object->Bullet_Bill_Spawner(x));
}
break;
case Enemy_Item::CHEEP_CHEEP_SPAWNER:
if (this->object->Get_Absolute_X(x) == 0xF) assert(this->object->Flying_Cheep_Cheep_Spawner(x+1));
else assert(this->object->Flying_Cheep_Cheep_Spawner(x));
break;
case Enemy_Item::LAKITU:
Extra_Enemy_Args extraEnemyArgs = this->requiredEnemySpawns->Get_Initialized_Extra_Enemy_Args();
extraEnemyArgs.allowSpawnAfterCancelSpawner = false;
assert(this->requiredEnemySpawns->Add_Required_Enemy_Spawn(Enemy_Item::LAKITU, extraEnemyArgs, x+0x15, 0x0));
break;
}
return this->lastSpawn;
}

Enemy_Item::Enemy_Item Continuous_Enemies_Spawner::Determine_Continuous_Enemies_Spawner(int x) {
//Pull these Values Based on the Level Type
int flyingCheepCheeps = 0;
int lakitus = 0;
int offscreenBulletBills = 0;
switch (this->args->levelType) {
default: assert(false); return Enemy_Item::NOTHING;
default: assert(false);
case Level_Type::STANDARD_OVERWORLD:
flyingCheepCheeps = this->args->difficultyStandardOverworldFlyingCheepCheeps;
lakitus = this->args->difficultyStandardOverworldLakitus;
Expand Down Expand Up @@ -103,7 +71,7 @@ Enemy_Item::Enemy_Item Continuous_Enemies_Spawner::Determine_Continuous_Enemies_
//Handle the Spawner After the Order Has Been Defined
for (unsigned int i = 0; i < order.size(); ++i) {
switch (order.at(i)) {
default: assert(false); return Enemy_Item::NOTHING;
default: assert(false);
case 0:
if (this->Try_To_Create_Continuous_Lakitus(x, lakitus) != Enemy_Item::NOTHING) return Enemy_Item::LAKITU;
break;
Expand Down
3 changes: 0 additions & 3 deletions SMB1/SMB1_Compliance_Generator/Continuous_Enemies_Spawner.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ class Continuous_Enemies_Spawner {
Continuous_Enemies_Spawner(SMB1_Compliance_Generator_Arguments *args, Object_Writer *object, Required_Enemy_Spawns *requiredEnemySpawns);
~Continuous_Enemies_Spawner() {}
Enemy_Item::Enemy_Item Create_Continuous_Enemies_Spawner(int x);
Enemy_Item::Enemy_Item Create_Midpoint_Continuous_Enemies_Spawner(int x);

private:
Enemy_Item::Enemy_Item Determine_Continuous_Enemies_Spawner(int x);
Enemy_Item::Enemy_Item Try_To_Create_Continuous_Flying_Cheep_Cheeps(int x, int expectedDifficulty);
Enemy_Item::Enemy_Item Try_To_Create_Continuous_Lakitus(int x, int expectedDifficulty);
Enemy_Item::Enemy_Item Try_To_Create_Continuous_Offscreen_Bullet_Bills(int x, int expectedDifficulty);

SMB1_Compliance_Generator_Arguments *args;
Object_Writer *object;
Required_Enemy_Spawns *requiredEnemySpawns;
Enemy_Item::Enemy_Item lastSpawn;
};

#endif // CONTINUOUS_ENEMIES_SPAWNER_H
1 change: 0 additions & 1 deletion SMB1/SMB1_Compliance_Generator/Extra_Enemy_Args.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ struct Extra_Enemy_Args {
int room;
int page;
int num;
bool allowSpawnAfterCancelSpawner;
};

#endif // EXTRA_ENEMY_ARGS_H
3 changes: 1 addition & 2 deletions SMB1/SMB1_Compliance_Generator/Island_Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ bool Island_Generator::Generate_Level() {
//Create the level
while (!this->end->Is_End_Written()) {
x = this->object->Get_Last_Object_Length();
this->midpointHandler->Handle_Midpoint(x);
x = this->Get_Safe_Jump_Distance(x);

//TODO: Add support for spawning coins and item boxes above islands
Expand All @@ -38,7 +37,7 @@ bool Island_Generator::Generate_Level() {

//Write the header last
return this->header->Write_Header(Level_Type::ISLAND, Level_Attribute::OVERWORLD, Brick::SURFACE, this->firstPageHandler->Get_Header_Background(), this->args->headerScenery, this->args->levelCompliment, 400,
this->midpointHandler->Get_Midpoint(), this->args->difficulty, this->object->Get_Level_Length(),
0, this->args->difficulty, this->object->Get_Level_Length(),
this->object->Get_Num_Items(), this->enemy->Get_Num_Items(), 0);
}

Expand Down
2 changes: 0 additions & 2 deletions SMB1/SMB1_Compliance_Generator/Level_Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Level_Generator::Level_Generator(QFile *file, SMB1_Compliance_Generator_Argument
this->enemySpawner = new Enemy_Spawner(file, this->stream, this->object, this->enemy, this->requiredEnemySpawns, this->args);
this->continuousEnemiesSpawner = new Continuous_Enemies_Spawner(this->args, this->object, this->requiredEnemySpawns);
this->end = new End_Spawner(this->object, this->enemy, this->args, this->requiredEnemySpawns, this->args->useAutoScroll);
this->midpointHandler = new Midpoint_Handler(this->object, this->continuousEnemiesSpawner, this->args, this->args->levelType);
this->firstPageHandler = new First_Page_Handler(this->object, this->args->headerBackground, this->args->startCastle, this->args->useAutoScroll);
}

Expand All @@ -30,7 +29,6 @@ Level_Generator::~Level_Generator() {
delete this->enemySpawner;
delete this->requiredEnemySpawns;
delete this->end;
delete this->midpointHandler;
delete this->firstPageHandler;
}

Expand Down
2 changes: 0 additions & 2 deletions SMB1/SMB1_Compliance_Generator/Level_Generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "Required_Enemy_Spawns.h"
#include "Enemy_Spawner.h"
#include "End_Spawner.h"
#include "Midpoint_Handler.h"
#include "First_Page_Handler.h"
#include <QFile>
#include <QTextStream>
Expand Down Expand Up @@ -41,7 +40,6 @@ class Level_Generator
Required_Enemy_Spawns *requiredEnemySpawns;
Enemy_Spawner *enemySpawner;
End_Spawner *end;
Midpoint_Handler *midpointHandler;
First_Page_Handler *firstPageHandler;
SMB1_Compliance_Generator_Arguments *args;
};
Expand Down
153 changes: 0 additions & 153 deletions SMB1/SMB1_Compliance_Generator/Midpoint_Handler.cpp

This file was deleted.

28 changes: 0 additions & 28 deletions SMB1/SMB1_Compliance_Generator/Midpoint_Handler.h

This file was deleted.

12 changes: 1 addition & 11 deletions SMB1/SMB1_Compliance_Generator/Object_Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Object_Writer::Object_Writer(QTextStream *stream, int numBytesLeft, SMB1_Complia
this->autoScrollActive = false;
this->wereFlyingCheepCheepsSpawned = false;
this->wasAutoScrollUsed = false;
this->cancelSpawnerX = -1;
}

int Object_Writer::Get_Last_Object_Length() {
Expand Down Expand Up @@ -58,10 +57,6 @@ bool Object_Writer::Was_Auto_Scroll_Used() {
return this->wasAutoScrollUsed;
}

int Object_Writer::Get_Cancel_Spawner_X() {
return this->cancelSpawnerX;
}

bool Object_Writer::Is_Midpoint_Ready() {
return ((this->Get_Num_Objects_Left()-Physics::MIN_END_OBJECTS) < (this->totalBytes/4)
|| this->currentPage > 0xA);
Expand Down Expand Up @@ -490,12 +485,7 @@ bool Object_Writer::Bullet_Bill_Spawner(int x) {

bool Object_Writer::Cancel_Spawner(int x) {
if (this->Get_Absolute_X(x) == 0xF) return false;
if (this->Write_Object(x, Object_Item::STRING_CANCEL_SPAWNER, false)) {
this->cancelSpawnerX = this->levelLength;
return true;
} else {
return false;
}
return this->Write_Object(x, Object_Item::STRING_CANCEL_SPAWNER, false);
}

bool Object_Writer::Loop_Command(int x) {
Expand Down
2 changes: 0 additions & 2 deletions SMB1/SMB1_Compliance_Generator/Object_Writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Object_Writer : public Item_Writer {
bool Were_Flying_Cheep_Cheeps_Spawned();
bool Is_Auto_Scroll_Active();
bool Was_Auto_Scroll_Used();
int Get_Cancel_Spawner_X();
bool Is_Midpoint_Ready();
bool Get_First_Page_Safety();
void Set_First_Page_Safety(bool firstPageSafety);
Expand Down Expand Up @@ -105,7 +104,6 @@ class Object_Writer : public Item_Writer {
bool autoScrollActive;
bool wereFlyingCheepCheepsSpawned;
bool wasAutoScrollUsed;
int cancelSpawnerX;

friend class Pipe_Pointer_Writer;
};
Expand Down
Loading

0 comments on commit 1ca8c2d

Please sign in to comment.