bugfixes less log messages
- fixed sudden acceleration of asteroids (wrong order of collision handling and resolving)main
parent
57ea0596b8
commit
ce66a791af
|
@ -35,20 +35,19 @@ bool Controller::OnReceiveEvent (const Engine::EventBasePtr &event) {
|
|||
void Controller::ResetPlayerEntity () {
|
||||
Engine::HaltSoundLoop(Engine::GetResourceFullPath("/data/sounds/thrust.wav"));
|
||||
|
||||
// We definitely have to reset the player entity id
|
||||
GetModel()->SetPlayerEntityId(Engine::NullEntityId);
|
||||
|
||||
// Reset the angular velocity of the player entity if one exists
|
||||
if (GetModel()->GetPlayerEntityId() != Engine::NullEntityId) {
|
||||
Engine::EntityBase *player_entity = GetModel()->GetEntity(GetModel()->GetPlayerEntityId());
|
||||
|
||||
// if we were unable to get the player then there is no need to invalidate
|
||||
// the state
|
||||
if (!player_entity)
|
||||
return;
|
||||
player_entity->mPhysicState->mAngleVelocity = 0.;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < EntityControllerMaxKeyStates; i++)
|
||||
player_entity->UnsetControllerKeyState(i);
|
||||
|
||||
}
|
||||
|
||||
// We definitely have to reset the player entity id
|
||||
GetModel()->SetPlayerEntityId(Engine::NullEntityId);
|
||||
}
|
||||
|
||||
void Controller::ResetLevel() {
|
||||
|
|
|
@ -263,6 +263,8 @@ int Model::DoLoadLevel (const char* filename) {
|
|||
std::string entity_type_str;
|
||||
|
||||
int entity_count = 0;
|
||||
SetLevelTitle ("");
|
||||
SetLevelAuthor ("");
|
||||
|
||||
while (level_file >> entity_type_str) {
|
||||
if (entity_type_str[0] == '#') {
|
||||
|
|
|
@ -37,19 +37,19 @@ class Model : public Engine::ModelBase {
|
|||
|
||||
std::string GetLevelName() { return mLevelName; };
|
||||
void SetLevelName(const std::string &name) {
|
||||
Engine::LogMessage("new level name: %s", name.c_str());
|
||||
Engine::LogDebug("new level name: %s", name.c_str());
|
||||
mLevelName = name;
|
||||
}
|
||||
|
||||
std::string GetLevelAuthor() { return mLevelAuthor; };
|
||||
void SetLevelAuthor(const std::string &author) {
|
||||
Engine::LogMessage("new level author: %s", author.c_str());
|
||||
Engine::LogDebug("new level author: %s", author.c_str());
|
||||
mLevelAuthor = author;
|
||||
}
|
||||
|
||||
std::string GetLevelTitle() { return mLevelTitle; };
|
||||
void SetLevelTitle(const std::string &title) {
|
||||
Engine::LogMessage("new level title: %s", title.c_str());
|
||||
Engine::LogDebug("new level title: %s", title.c_str());
|
||||
mLevelTitle = title;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ void ShipEntity::Attack () {
|
|||
|
||||
RocketEntity *rocket_entity = (RocketEntity*) Engine::CreateEntity (GameEntityTypeRocket);
|
||||
|
||||
rocket_entity->mSecToLive = 1.75;
|
||||
rocket_entity->mSecToLive = 1.5;
|
||||
|
||||
RocketEntityPhysicState *rocket_physics = (RocketEntityPhysicState*) rocket_entity->mPhysicState;
|
||||
rocket_physics->mPosition = attack_dir;
|
||||
|
|
|
@ -999,7 +999,7 @@ void View::DrawUiEditor() {
|
|||
GetModel()->SetLevelTitle(level_title);
|
||||
|
||||
if (Engine::GUI::Button (55, "Save", 145, 380, button_width, button_height)) {
|
||||
GetModel()->DoSaveLevel((level_name + std::string(".txt")).c_str());
|
||||
GetModel()->DoSaveLevel((level_name + std::string(".map")).c_str());
|
||||
Engine::LogMessage ("Save");
|
||||
mEditorState = EditorStateUnknown;
|
||||
}
|
||||
|
@ -1021,9 +1021,9 @@ void View::DrawUiEditor() {
|
|||
if (Engine::GUI::LineEdit(52, 145, 210, level_name, 32))
|
||||
GetModel()->SetLevelName(level_name);
|
||||
|
||||
if (Engine::FileExists (level_name + std::string(".txt"))) {
|
||||
if (Engine::FileExists (level_name + std::string(".map"))) {
|
||||
if (Engine::GUI::Button (54, "Load", 145, 300, button_width, button_height)) {
|
||||
GetModel()->DoLoadLevel((level_name + std::string(".txt")).c_str());
|
||||
GetModel()->DoLoadLevel((level_name + std::string(".map")).c_str());
|
||||
Engine::LogMessage ("Load");
|
||||
mEditorState = EditorStateUnknown;
|
||||
}
|
||||
|
|
|
@ -105,6 +105,9 @@ int main (int argc, char* argv[]) {
|
|||
ShowWindow( hWnd, SW_HIDE );
|
||||
#endif
|
||||
|
||||
create_dir ("./root");
|
||||
create_dir ("./root/blaa");
|
||||
|
||||
Engine::Engine engine;
|
||||
|
||||
engine.SetEntityFactory (new asteroids::EntityFactory);
|
||||
|
|
|
@ -107,12 +107,12 @@ int PhysicsBase::Simulate (float msec, ModelBase* model) {
|
|||
// collision_remaining_step -= 1.0e-4;
|
||||
} else {
|
||||
Move (info.time * (1 - alpha));
|
||||
LogDebug ("Resolving Step between %u and %u t = %f alpha = %f", entity_a_id, entity_b_id, info.time, alpha);
|
||||
ResolveCollision (info.time * (1 - alpha), entity_a_id, entity_b_id, info);
|
||||
// Send the collision event to the Model (if we have one)
|
||||
if (model) {
|
||||
model->SendEntityCollisionEvent (entity_a_id, entity_b_id, info.time, info.point, info.normal);
|
||||
}
|
||||
LogDebug ("Resolving Step between %u and %u t = %f alpha = %f", entity_a_id, entity_b_id, info.time, alpha);
|
||||
ResolveCollision (info.time * (1 - alpha), entity_a_id, entity_b_id, info);
|
||||
collision_remaining_step -= info.time * (1 - alpha);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue