void input_toggle_pause(void) { All * a = global_a; if (a->editor_enabled) { menu_toggle(); } #line 41 else { #line 43 if (a->show_map) { a->show_map = 0; } #line 44 else { #line 46 a->show_map = 1; } } }
void menu_more() { while (1) { char *options[] = {"Toggleable options", "Select emuNAND"}; int result = draw_menu("More options", 1, sizeof(options) / sizeof(char *), options); switch (result) { case 0: menu_toggle(); break; case 1: menu_emunand(); break; case -1: return; } } }
int cheat_panic ( void ) { traceLastFunc( "cheat_panic()" ); static int pstate_map = 0, // m0d's map pstate_d3dtext_hud = 0, // hud bar pstate_actor_hp_nSP = 0, // "Extra actor invincibility" patch (invulnerable single player enemies) pstate_actor_hp_SP = 0, // "Extra actor invincibility2" patch (no problems in SP) pstate_vehicle_hp = 0, // vehicle hp patch pstate_generic_menu = 0, // m0d's menu pstate_infnos = 0, // infinite NOS pstate_ini[INI_PATCHES_MAX], pstate_dummy_aligner; // this should all be a structure, static = DOING IT WRONG int i; // sa-mp related static int pstate_chat = 0, // chat pstate_deathlist = 0, // deathlist pstate_extragm = 0; // extra godmode if ( KEYCOMBO_PRESSED(set.key_panic) ) { // toggle panic cheat_state->_generic.cheat_panic_enabled ^= 1; if ( cheat_state->_generic.cheat_panic_enabled ) { struct actor_info *actor_info = actor_info_get( ACTOR_SELF, ACTOR_ALIVE ); if ( actor_info ) { if (cheat_state->_generic.hp_cheat) actor_info->flags &= ~ACTOR_FLAGS_INVULNERABLE; actor_info->weapon_slot = 0; } // remove infinite NOS pstate_infnos = cheat_state->vehicle.infNOS_toggle_on; cheat_state->vehicle.infNOS_toggle_on = false; patcher_remove( &patch_vehicle_inf_NOS ); if ( pPedSelf->GetVehicle() ) { CVehicle *pVehicleSelf = pPedSelf->GetVehicle(); CVehicle *pVehicleTemp = NULL; for ( pVehicleTemp = pVehicleSelf; pVehicleTemp != NULL; pVehicleTemp = pVehicleTemp->GetTowedVehicle() ) { pVehicleTemp->SetGravity( &CVector(0.0, 0.0, -1.0) ); pVehicleTemp->SetCanBeDamaged( true ); if ( !set.trailer_support ) break; } // remove inf NOS if ( pstate_infnos ) { pVehicleSelf->RemoveVehicleUpgrade( 1010 ); //pVehicleSelf->AddVehicleUpgrade( 1010 ); } // reset overrideLights, pstate not needed, will be reactivated on demand if ( set.enable_car_lights_at_day_time ) pVehicleSelf->SetOverrideLights( 0 ); } // hud bar, this should probably become a cheat_state pstate_d3dtext_hud = set.d3dtext_hud; set.d3dtext_hud = 0; // m0d's map pstate_map = cheat_state->_generic.map; cheat_state->_generic.map = 0; // m0d's menu pstate_generic_menu = cheat_state->_generic.menu; menu_toggle(false); // remove "Extra actor invincibility" patch pstate_actor_hp_nSP = patch_actor_hp_extraInv.installed; patcher_remove( &patch_actor_hp_extraInv ); pstate_actor_hp_SP = patch_actor_hp.installed; patcher_remove( &patch_actor_hp ); // remove vehicle hp patch pstate_vehicle_hp = patch_vehicle_hp.installed; patcher_remove( &patch_vehicle_hp ); // just call with null vehicle info to disable cheat_handle_vehicle_fly( NULL, 0.0f ); for ( i = 0; i < INI_PATCHES_MAX; i++ ) { // added to not remove volatile patches if ( !set.patch[i].has_volatile ) { pstate_ini[i] = set.patch[i].installed; patcher_remove( &set.patch[i] ); } } // turn off kill & chat if ( g_DeathList != NULL ) { pstate_deathlist = g_DeathList->iEnabled; g_DeathList->iEnabled = 1; } if ( g_Chat != NULL ) { pstate_chat = g_Chat->iChatWindowMode; g_Chat->iChatWindowMode = 2; } pstate_extragm = set.enable_extra_godmode; set.enable_extra_godmode = 0; } else { // restore infinite NOS if ( pstate_infnos ) { cheat_state->vehicle.infNOS_toggle_on = true; patcher_install( &patch_vehicle_inf_NOS ); } // vehicle stuff CPed *pPedSelf = pPools->GetPedFromRef( CPOOLS_PED_SELF_REF ); if ( pPedSelf->GetVehicle() ) { CVehicle *pVehicleSelf = pPedSelf->GetVehicle(); // restore inf NOS if ( pstate_infnos ) { pVehicleSelf->AddVehicleUpgrade( 1010 ); } } // restore "Extra actor invincibility" patch if ( pstate_actor_hp_nSP ) patcher_install( &patch_actor_hp_extraInv ); if ( pstate_actor_hp_SP ) patcher_install( &patch_actor_hp ); // restore vehicle hp patch if ( pstate_vehicle_hp ) patcher_install( &patch_vehicle_hp ); // restore some cheat_states set.d3dtext_hud = pstate_d3dtext_hud; cheat_state->_generic.map = pstate_map; menu_toggle(pstate_generic_menu != 0); // restore patches for ( i = 0; i < INI_PATCHES_MAX; i++ ) { if ( pstate_ini[i] ) patcher_install( &set.patch[i] ); } // restore kill & chat if ( g_DeathList != NULL ) { g_DeathList->iEnabled = pstate_deathlist; } if ( g_Chat != NULL ) { g_Chat->iChatWindowMode = pstate_chat; } // restore extra invincibility mode state set.enable_extra_godmode = pstate_extragm; // clear cheat state text cheat_state_text( NULL ); } } return cheat_state->_generic.cheat_panic_enabled; }