Frame stepping

This commit is contained in:
Simon Robertshaw 2012-02-02 11:55:43 +00:00
parent f5dd32b284
commit 6641f1d541
6 changed files with 25 additions and 5 deletions

View File

@ -343,6 +343,12 @@ void GameController::OpenSaveWindow()
}
}
void GameController::FrameStep()
{
gameModel->FrameStep(1);
gameModel->SetPaused(true);
}
void GameController::Vote(int direction)
{
if(gameModel->GetSave() && gameModel->GetUser().ID && gameModel->GetSave()->GetID() && gameModel->GetSave()->GetVote()==0)

View File

@ -60,6 +60,7 @@ public:
void Vote(int direction);
void ChangeBrush();
void ShowConsole();
void FrameStep();
ui::Point PointTranslate(ui::Point point);
};

View File

@ -277,6 +277,11 @@ bool GameModel::GetPaused()
return sim->sys_pause?true:false;
}
void GameModel::FrameStep(int frames)
{
sim->framerender += frames;
}
void GameModel::ClearSimulation()
{
sim->clear_sim();

View File

@ -70,6 +70,7 @@ public:
vector<Tool*> GetToolList();
void SetActiveMenu(Menu * menu);
Menu * GetActiveMenu();
void FrameStep(int frames);
User GetUser();
void SetUser(User user);
void SetBrush(int i);

View File

@ -513,6 +513,9 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
case '`':
c->ShowConsole();
break;
case 'f':
c->FrameStep();
break;
}
}

View File

@ -2076,7 +2076,7 @@ void Simulation::update_particles_i(int start, int inc)
int lighting_ok=1;
float pGravX, pGravY, pGravD;
if (sys_pause&&lighting_recreate>0)
if (lighting_recreate>0)
{
for (i=0; i<=parts_lastActiveIndex; i++)
{
@ -2097,8 +2097,8 @@ void Simulation::update_particles_i(int start, int inc)
if (lighting_recreate>21)
lighting_recreate=21;
if (sys_pause&&!framerender)//do nothing if paused
return;
//if (sys_pause&&!framerender)//do nothing if paused
// return;
//wire!
if(elementCount[PT_WIRE] > 0)
@ -3078,6 +3078,7 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
pthread_t *InterThreads;
#endif
if(!sys_pause||framerender)
air->update_air();
memset(pmap, 0, sizeof(pmap));
@ -3130,8 +3131,11 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
}
}
if(!sys_pause||framerender)
update_particles_i(0, 1);
if(framerender)
framerender--;
// this should probably be elsewhere
/*for (y=0; y<YRES/CELL; y++)
for (x=0; x<XRES/CELL; x++)