summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-02-02 11:55:43 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-02-02 11:55:43 (GMT)
commit6641f1d54196a2193b258d3e76e2cca6ad3258b1 (patch)
tree9d7c812af9c5f3def4d5e73dc49d6e85add27fd9 /src
parentf5dd32b284fd311dd58070b6f431ec535fa93387 (diff)
downloadpowder-6641f1d54196a2193b258d3e76e2cca6ad3258b1.zip
powder-6641f1d54196a2193b258d3e76e2cca6ad3258b1.tar.gz
Frame stepping
Diffstat (limited to 'src')
-rw-r--r--src/game/GameController.cpp6
-rw-r--r--src/game/GameController.h1
-rw-r--r--src/game/GameModel.cpp5
-rw-r--r--src/game/GameModel.h1
-rw-r--r--src/game/GameView.cpp3
-rw-r--r--src/simulation/Simulation.cpp14
6 files changed, 25 insertions, 5 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index a4e0ccc..5c8ed6f 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -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)
diff --git a/src/game/GameController.h b/src/game/GameController.h
index 84af343..0e70371 100644
--- a/src/game/GameController.h
+++ b/src/game/GameController.h
@@ -60,6 +60,7 @@ public:
void Vote(int direction);
void ChangeBrush();
void ShowConsole();
+ void FrameStep();
ui::Point PointTranslate(ui::Point point);
};
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index c026da8..6fc9dea 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -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();
diff --git a/src/game/GameModel.h b/src/game/GameModel.h
index 0d7fc3f..170d1ed 100644
--- a/src/game/GameModel.h
+++ b/src/game/GameModel.h
@@ -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);
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index e93b9b7..9e4a6dd 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -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;
}
}
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 11414ea..9e58f22 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -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,7 +3078,8 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
pthread_t *InterThreads;
#endif
- air->update_air();
+ if(!sys_pause||framerender)
+ air->update_air();
memset(pmap, 0, sizeof(pmap));
memset(photons, 0, sizeof(photons));
@@ -3130,8 +3131,11 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
}
}
- update_particles_i(0, 1);
+ 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++)