void Game_Frame() { if(iLoadingScreen == 1) { // Force it to draw the loading screen trap->DrawImageAspectCorrection(ptLoadScreenImage, 37.5, 37.5, 25, 25); iLoadingScreen++; } else if(iLoadingScreen == 2) { // Now do the actual loading Game_Load(); iLoadingScreen = 0; } else { // In a multiplayer game, we would be looping through all 4 acts and running GetWorld()->Run, // but since we're only concerned about singleplayer, we're going to focus on the one that // our client is on // Preframe. We need to keep client/server synchronized ptClient->Preframe(); // Server frame ptServer->ptDungeonManager->GetWorld(ptServer->GetClient()->ptPlayer->iAct)->Run(); // Client frame ptClient->Frame(); } }
void Controls_Key(int32_t button, int state) { // Fill script-driven debug keyboard input. Script_AddKey(engine_lua, button, state); // Compare ALL mapped buttons. for(int i = 0; i < ACT_LASTINDEX; i++) { if((button == control_mapper.action_map[i].primary) || (button == control_mapper.action_map[i].secondary)) // If button = mapped action... { switch(i) // ...Choose corresponding action. { case ACT_UP: control_states.move_forward = state; break; case ACT_DOWN: control_states.move_backward = state; break; case ACT_LEFT: control_states.move_left = state; break; case ACT_RIGHT: control_states.move_right = state; break; case ACT_DRAWWEAPON: control_states.do_draw_weapon = state; break; case ACT_ACTION: control_states.state_action = state; break; case ACT_JUMP: control_states.move_up = state; control_states.do_jump = state; break; case ACT_ROLL: control_states.do_roll = state; break; case ACT_WALK: control_states.state_walk = state; break; case ACT_SPRINT: control_states.state_sprint = state; break; case ACT_CROUCH: control_states.move_down = state; control_states.state_crouch = state; break; case ACT_LOOKUP: control_states.look_up = state; break; case ACT_LOOKDOWN: control_states.look_down = state; break; case ACT_LOOKLEFT: control_states.look_left = state; break; case ACT_LOOKRIGHT: control_states.look_right = state; break; case ACT_BIGMEDI: if(!control_mapper.action_map[i].already_pressed) { control_states.use_big_medi = state; } break; case ACT_SMALLMEDI: if(!control_mapper.action_map[i].already_pressed) { control_states.use_small_medi = state; } break; case ACT_CONSOLE: if(!state) { Con_SetShown(!Con_IsShown()); if(Con_IsShown()) { //Audio_Send(lua_GetGlobalSound(engine_lua, TR_AUDIO_SOUND_GLOBALID_MENUOPEN)); SDL_ShowCursor(1); SDL_SetRelativeMouseMode(SDL_FALSE); SDL_StartTextInput(); } else { //Audio_Send(lua_GetGlobalSound(engine_lua, TR_AUDIO_SOUND_GLOBALID_MENUCLOSE)); SDL_ShowCursor(0); SDL_SetRelativeMouseMode(SDL_TRUE); SDL_StopTextInput(); } } break; case ACT_SCREENSHOT: if(!state) { Engine_TakeScreenShot(); } break; case ACT_INVENTORY: control_states.gui_inventory = state; break; case ACT_SAVEGAME: if(!state) { Game_Save("qsave.lua"); } break; case ACT_LOADGAME: if(!state) { Game_Load("qsave.lua"); } break; default: // control_states.move_forward = state; return; } control_mapper.action_map[i].state = state; } } }