Skip to content

Commit 581edbb

Browse files
committed
Can move between rooms and stuff
1 parent 84d3019 commit 581edbb

File tree

6 files changed

+33
-8
lines changed

6 files changed

+33
-8
lines changed

Game/Entities/combatant.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ Combatant::Combatant(Controller* Controls)
1717
CurrentState = CombatantState::STANDING;
1818
CurrentStateTime = 0;
1919

20-
world_z = 0;
20+
CurrentRoomID = 0;
21+
22+
CollectedMagic = 0;
23+
CollectedMagicRemaining = 0;
2124

2225
weapon_change_on_stand = false;
2326
weapon_current_index = 0;
@@ -35,6 +38,7 @@ Combatant::Combatant(Controller* Controls)
3538

3639
CurrentPower = COMBATANT_POWER;
3740
world_zone = nullptr;
41+
world_z = 0;
3842

3943
ZoneClipping = false;
4044
UnlimitedPower = false;
@@ -507,7 +511,7 @@ void Combatant::ProposeMove( int ScreenX, int ScreenY )
507511
this->ScreenY = z->TransportScreenY;
508512
if( z->TransportFacing != GameDirection::UNCHANGED )
509513
{
510-
CurrentDirection == z->TransportFacing;
514+
CurrentDirection = z->TransportFacing;
511515
}
512516
if( z->TransportClearInput )
513517
{

Game/Entities/world.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ World::~World()
5858
void World::Save()
5959
{
6060
int roomid;
61+
std::string query;
6162

6263
gamedb->ExecuteStatement("DELETE FROM `World` WHERE GameID = " + Strings::FromNumber( gameid ) + ";");
63-
gamedb->ExecuteStatement("INSERT INTO `World` ( GameID, GameName, OnUpdate ) SELECT " + Strings::FromNumber( gameid ) + ", 'JANE v4', '" + Strings::Replace( Script_OnUpdate, "'", "''" ) + "';");
64+
65+
query = "INSERT INTO `World` ( GameID, GameName, OnUpdate, Start_RoomID, Start_ScreenX, Start_ScreenY, Start_Facing ) ";
66+
query += "SELECT " + Strings::FromNumber( gameid ) + ", 'JANE v4', '" + Strings::Replace( Script_OnUpdate, "'", "''" ) + "', ";
67+
query += Strings::FromNumber( Start_RoomID ) + ", " + Strings::FromNumber( Start_ScreenX ) + ", " + Strings::FromNumber( Start_ScreenY ) + ", " + Strings::FromNumber( Start_Facing ) + ";";
68+
gamedb->ExecuteStatement( query );
6469

6570
roomid = 0;
6671
for( std::vector<Room*>::const_iterator roomptr = Rooms.begin(); roomptr != Rooms.end(); roomptr++ )

Game/debugstage.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ void DebugStage::Begin()
1818
curroom = 0;
1919
GameResources::GameWorld->Rooms.at( curroom )->OnEnter();
2020

21+
textfont = al_load_ttf_font( "resources/silkscreen.ttf", 8, ALLEGRO_TTF_MONOCHROME );
22+
2123
AUDIO->PlayMusic( "resources/Paul Hannay (Feekzoid) - Last_Ninja_4_loader [1].ogg", true );
2224
}
2325

@@ -33,7 +35,7 @@ void DebugStage::Finish()
3335
{
3436
delete ninja->Controls;
3537
delete ninja;
36-
FRAMEWORK->SetSlowMode( false );
38+
al_destroy_font( textfont );
3739
}
3840

3941
void DebugStage::EventOccurred(Event *e)
@@ -76,6 +78,9 @@ void DebugStage::Render()
7678
GameResources::GameWorld->Rooms.at( curroom )->Render( ninja->ScreenY, 200 );
7779

7880
GameResources::GameOverlay->Draw( 0, 0, 0 );
81+
82+
al_draw_textf( textfont, Palette::ColourPalette[7], 6, 150, ALLEGRO_ALIGN_LEFT, "Ninja: %d, %d", ninja->ScreenX, ninja->ScreenY );
83+
7984
}
8085

8186
bool DebugStage::IsTransition()

Game/debugstage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class DebugStage : public Stage
1111
private:
1212
Combatant* ninja;
1313
int curroom;
14+
ALLEGRO_FONT* textfont;
1415

1516
public:
1617
// Stage control

Game/gamestage.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ void GameStage::EventOccurred(Event *e)
5555
void GameStage::Update()
5656
{
5757
GameResources::GameWorld->Rooms.at( curroom )->Update();
58-
ninja->OnUpdate();
58+
59+
if( GameResources::GameWorld->Rooms.at( curroom )->FullyRendered )
60+
{
61+
ninja->OnUpdate();
62+
}
5963

6064
if( ninja->CurrentRoomID != curroom )
6165
{
@@ -69,9 +73,15 @@ void GameStage::Update()
6973
void GameStage::Render()
7074
{
7175
al_clear_to_color( Palette::ColourPalette[ GameResources::GameWorld->Rooms.at( curroom )->BackgroundColour ] );
72-
GameResources::GameWorld->Rooms.at( curroom )->Render( 0, ninja->ScreenY );
73-
ninja->OnRender();
74-
GameResources::GameWorld->Rooms.at( curroom )->Render( ninja->ScreenY, 200 );
76+
77+
if( GameResources::GameWorld->Rooms.at( curroom )->FullyRendered )
78+
{
79+
GameResources::GameWorld->Rooms.at( curroom )->Render( 0, ninja->ScreenY );
80+
ninja->OnRender();
81+
GameResources::GameWorld->Rooms.at( curroom )->Render( ninja->ScreenY, 200 );
82+
} else {
83+
GameResources::GameWorld->Rooms.at( curroom )->Render( 0, 200 );
84+
}
7585

7686
GameResources::GameOverlay->Draw( 0, 0, 0 );
7787

resources/jane4.db

2 KB
Binary file not shown.

0 commit comments

Comments
 (0)