From c1e4e9c3d7a4c0b5b126f5b9a62645f3c4cce56c Mon Sep 17 00:00:00 2001 From: zicodxx Date: Mon, 14 Feb 2011 22:27:02 +0100 Subject: [PATCH] Moved all these unsorted global cheat variables to a handy structure; Simplified reading of the cheats without trying to make it complicated so no one finds them (everyone can get the source); Removed one or two cheats which carry more garbage than they are worth; Added replacement for the bittersweet cheat; Made FPS Counter an option of Graphics menu --- CHANGELOG.txt | 4 + d1x.ini | 3 +- include/args.h | 1 - main/ai.c | 211 +------------------- main/ai.h | 1 - main/automap.c | 13 +- main/cntrlcen.c | 4 +- main/collide.c | 7 - main/config.c | 5 + main/config.h | 1 + main/fvi.c | 4 +- main/game.c | 38 +--- main/game.h | 28 ++- main/gamecntl.c | 517 ++++++++++++++++++------------------------------ main/gamerend.c | 2 +- main/gameseq.c | 29 +-- main/gameseq.h | 3 - main/gauges.c | 8 +- main/inferno.c | 1 - main/kconfig.c | 2 +- main/laser.c | 6 +- main/menu.c | 12 +- main/multi.c | 2 - main/net_ipx.c | 1 - main/net_udp.c | 3 - main/physics.c | 3 +- main/player.h | 2 +- main/render.c | 19 +- main/state.c | 59 +++--- main/titles.c | 28 +-- main/titles.h | 1 - misc/args.c | 1 - 32 files changed, 313 insertions(+), 706 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 29a0ce528..fd80ec4a2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20110214 +-------- +d1x.ini, include/args.h, main/ai.c, main/ai.h, main/automap.c, main/cntrlcen.c, main/collide.c, main/config.c, main/config.h, main/fvi.c, main/game.c, main/game.h, main/gamecntl.c, main/gamerend.c, main/gameseq.c, main/gameseq.h, main/gauges.c, main/inferno.c, main/kconfig.c, main/laser.c, main/menu.c, main/multi.c, main/net_ipx.c, main/net_udp.c, main/physics.c, main/player.h, main/render.c, main/state.c, main/titles.c, main/titles.h, misc/args.c: Moved all these unsorted global cheat variables to a handy structure; Simplified reading of the cheats without trying to make it complicated so no one finds them (everyone can get the source); Removed one or two cheats which carry more garbage than they are worth; Added replacement for the bittersweet cheat; Made FPS Counter an option of Graphics menu + 20110212 -------- arch/inlcude/window.h, arch/sdl/event.c, arch/sdl/window.c, main/game.c: New approach to handle a bunch of closing windows - removed window_do_close() again, reworked game_leave_menus by checking window_get_front() and closing this window until it's Game_wind, while event_process checking if window still exists after drawing and if not, take next window from previous which should be updated by then diff --git a/d1x.ini b/d1x.ini index fb2c14d21..1a6f3befd 100644 --- a/d1x.ini +++ b/d1x.ini @@ -1,6 +1,5 @@ System Options: -;-fps Enable FPS indicator by default ;-nonicefps Don't free CPU-cycles ;-maxfps Set maximum framerate (1-200) ;-hogdir set shared data directory to @@ -11,7 +10,7 @@ ;-autodemo Start in demo mode ;-notitles Skip title screens ;-window Run the game in a window -;-noborders Do not show borders in window mode +;-noborders Do not show borders in window mode Controls: diff --git a/include/args.h b/include/args.h index ffd7b3d24..9112f923a 100644 --- a/include/args.h +++ b/include/args.h @@ -41,7 +41,6 @@ extern void args_exit(); typedef struct Arg { int SysShowCmdHelp; - int SysFPSIndicator; int SysUseNiceFPS; int SysMaxFPS; char *SysHogDir; diff --git a/main/ai.c b/main/ai.c index 5d336700f..24562fe39 100644 --- a/main/ai.c +++ b/main/ai.c @@ -73,29 +73,16 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. void init_boss_segments(short segptr[], int *num_segs, int size_check); void ai_multi_send_robot_position(int objnum, int force); -#define JOHN_CHEATS_SIZE_1 6 -#define JOHN_CHEATS_SIZE_2 6 -#define JOHN_CHEATS_SIZE_3 6 - -ubyte john_cheats_1[JOHN_CHEATS_SIZE_1] = { KEY_P ^ 0x00 ^ 0x34, - KEY_O ^ 0x10 ^ 0x34, - KEY_B ^ 0x20 ^ 0x34, - KEY_O ^ 0x30 ^ 0x34, - KEY_Y ^ 0x40 ^ 0x34, - KEY_S ^ 0x50 ^ 0x34 }; - #define PARALLAX 0 // If !0, then special debugging info for Parallax eyes only enabled. #define MIN_D 0x100 int Flinch_scale = 4; -int john_cheats_index_1; // POBOYS detonate reactor int Attack_scale = 24; #define ANIM_RATE (F1_0/16) #define DELTA_ANG_SCALE 16 sbyte Mike_to_matt_xlate[] = {AS_REST, AS_REST, AS_ALERT, AS_ALERT, AS_FLINCH, AS_FIRE, AS_RECOIL, AS_REST}; -int john_cheats_index_2; // PORGYS high speed weapon firing // int No_ai_flag=0; @@ -118,8 +105,6 @@ int Num_boss_gate_segs; short Boss_gate_segs[MAX_BOSS_TELEPORT_SEGS]; #endif -int john_cheats_index_3; // LUNACY lunacy (insane behavior, rookie firing) - // ---------- John: These variables must be saved as part of gamesave. ---------- int Ai_initialized = 0; int Overall_agitation; @@ -141,8 +126,6 @@ int Boss_been_hit=0; // ---------- John: End of variables which must be saved as part of gamesave. ---------- - -int john_cheats_index_4; // PLETCHnnn paint robots int ai_evaded=0; #ifndef SHAREWARE @@ -177,19 +160,6 @@ sbyte Super_boss_gate_list[] = {0, 1, 8, 9, 10, 11, 12, 15, 16, 18, 19, 20, 22, #endif int Ai_info_enabled=0; -int Robot_firing_enabled = 1; - -extern int Ugly_robot_cheat, Ugly_robot_texture, Laser_rapid_fire; -extern sbyte Enable_john_cheat_1, Enable_john_cheat_2, Enable_john_cheat_3, Enable_john_cheat_4; - -ubyte john_cheats_3[2*JOHN_CHEATS_SIZE_3+1] = { KEY_Y ^ 0x67, - KEY_E ^ 0x66, - KEY_C ^ 0x65, - KEY_A ^ 0x64, - KEY_N ^ 0x63, - KEY_U ^ 0x62, - KEY_L ^ 0x61 }; - #define MAX_AWARENESS_EVENTS 64 typedef struct awareness_event { @@ -308,29 +278,6 @@ sbyte Ai_transition_table[AI_MAX_EVENT][AI_MAX_STATE][AI_MAX_STATE] = { } }; -ubyte john_cheats_2[2*JOHN_CHEATS_SIZE_2] = { KEY_P ^ 0x00 ^ 0x43, 0x66, - KEY_O ^ 0x10 ^ 0x43, 0x11, - KEY_R ^ 0x20 ^ 0x43, 0x8, - KEY_G ^ 0x30 ^ 0x43, 0x2, - KEY_Y ^ 0x40 ^ 0x43, 0x0, - KEY_S ^ 0x50 ^ 0x43 }; - -void john_cheat_func_1(int key) -{ - if (!Cheats_enabled) - return; - - if (key == (john_cheats_1[john_cheats_index_1] ^ (john_cheats_index_1 << 4) ^ 0x34)) { - john_cheats_index_1++; - if (john_cheats_index_1 == JOHN_CHEATS_SIZE_1) { - do_controlcen_destroyed_stuff(NULL); - john_cheats_index_1 = 0; - digi_play_sample( SOUND_CHEATER, F1_0); - } - } else - john_cheats_index_1 = 0; -} - // --------------------------------------------------------------------------------------------------------------------- // Given a behavior, set initial mode. int ai_behavior_to_mode(int behavior) @@ -420,23 +367,6 @@ void init_ai_object(int objnum, int behavior, int hide_segment) aip->REMOTE_OWNER = -1; } -void john_cheat_func_2(int key) -{ - if (!Cheats_enabled) - return; - - if (key == (john_cheats_2[2*john_cheats_index_2] ^ (john_cheats_index_2 << 4) ^ 0x43)) { - john_cheats_index_2++; - if (john_cheats_index_2 == JOHN_CHEATS_SIZE_2) { - Laser_rapid_fire = 0xBADA55; - do_megawow_powerup(200); - john_cheats_index_2 = 0; - digi_play_sample( SOUND_CHEATER, F1_0); - } - } else - john_cheats_index_2 = 0; -} - // --------------------------------------------------------------------------------------------------------------------- void init_ai_objects(void) { @@ -467,69 +397,6 @@ void init_ai_objects(void) Ai_initialized = 1; } -int Lunacy = 0; -int Diff_save = 1; - -fix Firing_wait_copy[MAX_ROBOT_TYPES]; -sbyte Rapidfire_count_copy[MAX_ROBOT_TYPES]; - -void do_lunacy_on(void) -{ - int i; - - if ( !Lunacy ) { - Lunacy = 1; - Diff_save = Difficulty_level; - Difficulty_level = NDL-1; - - for (i=0; i= KEY_1) && (key <= KEY_0)) { - john_cheats_index_4++; - Ugly_robot_texture *= 10; - if (key != KEY_0) - Ugly_robot_texture += key - 1; - if (john_cheats_index_4 == 9) { - if (Ugly_robot_texture == 999) { - Ugly_robot_cheat = 0; - HUD_init_message(HM_DEFAULT, TXT_ROBOT_PAINTING_OFF ); - } else { - HUD_init_message(HM_DEFAULT, TXT_ROBOT_PAINTING_ON, Ugly_robot_texture ); - Ugly_robot_cheat = 0xBADA55; - } - john_cheats_index_4 = 0; - } - } else - john_cheats_index_4 = 0; - - break; - default: - john_cheats_index_4 = 0; - } -} // -------------------------------------------------------------------------------------------------------------------- // Returns: @@ -963,7 +756,7 @@ void do_ai_robot_hit_attack(object *robot, object *player, vms_vector *collision robot_info *robptr = &Robot_info[robot->id]; //#ifndef NDEBUG - if (!Robot_firing_enabled) + if (cheats.robotfiringsuspended) return; //#endif @@ -998,7 +791,7 @@ void ai_fire_laser_at_player(object *obj, vms_vector *fire_point) vms_vector fire_vec; vms_vector bpp_diff; - if (!Robot_firing_enabled) + if (cheats.robotfiringsuspended) return; #ifndef NDEBUG diff --git a/main/ai.h b/main/ai.h index 93a64b01f..acaf9c5dd 100644 --- a/main/ai.h +++ b/main/ai.h @@ -70,7 +70,6 @@ extern void create_n_segment_path_to_door(object *objp, int path_length, int avo extern void make_random_vector(vms_vector *vec); extern void init_robots_for_level(void); extern int ai_behavior_to_mode(int behavior); -extern int Robot_firing_enabled; // max_length is maximum depth of path to create. // If -1, use default: MAX_DEPTH_TO_SEARCH_FOR_PLAYER diff --git a/main/automap.c b/main/automap.c index 7a8a4a131..61cca2d4e 100644 --- a/main/automap.c +++ b/main/automap.c @@ -434,13 +434,10 @@ int automap_key_command(window *wind, d_event *event, automap *am) return 1; case KEY_ALTED+KEY_F: // Alt+F shows full map, if cheats enabled - if (Cheats_enabled) + if (cheats.enabled) { - uint t; - t = Players[Player_num].flags; - Players[Player_num].flags |= PLAYER_FLAGS_MAP_ALL_CHEAT; + cheats.fullautomap = !cheats.fullautomap; automap_build_edge_list(am); - Players[Player_num].flags=t; } return 1; #ifndef NDEBUG @@ -1052,10 +1049,6 @@ void automap_build_edge_list(automap *am) { int i,e1,e2,s; Edge_info * e; - int automap_cheat = 0; - - if ( Players[Player_num].flags & PLAYER_FLAGS_MAP_ALL_CHEAT ) - automap_cheat = 1; // Damn cheaters... // clear edge list for (i=0; imax_edges; i++) { @@ -1065,7 +1058,7 @@ void automap_build_edge_list(automap *am) am->num_edges = 0; am->highest_edge_index = -1; - if (automap_cheat || (Players[Player_num].flags & PLAYER_FLAGS_MAP_ALL) ) { + if (cheats.fullautomap || (Players[Player_num].flags & PLAYER_FLAGS_MAP_ALL) ) { // Cheating, add all edges as visited for (s=0; s<=Highest_segment_index; s++) #ifdef EDITOR diff --git a/main/cntrlcen.c b/main/cntrlcen.c index a65866a09..019fa9da9 100644 --- a/main/cntrlcen.c +++ b/main/cntrlcen.c @@ -239,10 +239,10 @@ void do_controlcen_frame(object *obj) return; #ifndef NDEBUG - if (!Robot_firing_enabled || (Game_suspended & SUSP_ROBOTS)) + if (cheats.robotfiringsuspended || (Game_suspended & SUSP_ROBOTS)) return; #else - if (!Robot_firing_enabled) + if (cheats.robotfiringsuspended) return; #endif diff --git a/main/collide.c b/main/collide.c index f7b09537c..413658849 100644 --- a/main/collide.c +++ b/main/collide.c @@ -77,9 +77,6 @@ static char rcsid[] = "$Id: collide.c,v 1.1.1.1 2006/03/17 19:41:32 zicodxx Exp #include "script.h" #endif -int Ugly_robot_cheat = 0; -int Ugly_robot_texture = 0; - #define STANDARD_EXPL_DELAY (f1_0/4) int check_collision_delayfunc_exec() @@ -913,10 +910,6 @@ void collide_robot_and_weapon( object * robot, object * weapon, vms_vector *coll if (Robot_info[robot->id].boss_flag) Boss_hit_this_frame = 1; - if ( Ugly_robot_cheat == 0xBADa55 ) { - robot->rtype.pobj_info.tmap_override = Ugly_robot_texture % NumTextures; - } - #if 1 /* * Check if persistent weapon already hit this object. If yes, abort. diff --git a/main/config.c b/main/config.c index 225e728e2..ed14562af 100644 --- a/main/config.c +++ b/main/config.c @@ -62,6 +62,7 @@ static char *WindowModeStr="WindowMode"; static char *TexFiltStr="TexFilt"; static char *VSyncStr="VSync"; static char *MultisampleStr="Multisample"; +static char *FPSIndicatorStr="FPSIndicator"; static char *GrabinputStr="GrabInput"; int ReadConfigFile() @@ -109,6 +110,7 @@ int ReadConfigFile() GameCfg.TexFilt = 0; GameCfg.VSync = 0; GameCfg.Multisample = 0; + GameCfg.FPSIndicator = 0; GameCfg.Grabinput = 1; infile = PHYSFSX_openReadBuffered("descent.cfg"); @@ -213,6 +215,8 @@ int ReadConfigFile() GameCfg.VSync = strtol(value, NULL, 10); else if (!strcmp(token, MultisampleStr)) GameCfg.Multisample = strtol(value, NULL, 10); + else if (!strcmp(token, FPSIndicatorStr)) + GameCfg.FPSIndicator = strtol(value, NULL, 10); else if (!strcmp(token, GrabinputStr)) GameCfg.Grabinput = strtol(value, NULL, 10); } @@ -266,6 +270,7 @@ int WriteConfigFile() PHYSFSX_printf(infile, "%s=%i\n", TexFiltStr, GameCfg.TexFilt); PHYSFSX_printf(infile, "%s=%i\n", VSyncStr, GameCfg.VSync); PHYSFSX_printf(infile, "%s=%i\n", MultisampleStr, GameCfg.Multisample); + PHYSFSX_printf(infile, "%s=%i\n", FPSIndicatorStr, GameCfg.FPSIndicator); PHYSFSX_printf(infile, "%s=%i\n", GrabinputStr, GameCfg.Grabinput); PHYSFS_close(infile); diff --git a/main/config.h b/main/config.h index 56417472b..31ad35369 100644 --- a/main/config.h +++ b/main/config.h @@ -46,6 +46,7 @@ typedef struct Cfg int TexFilt; int VSync; int Multisample; + int FPSIndicator; int Grabinput; } __pack__ Cfg; diff --git a/main/fvi.c b/main/fvi.c index 6e7c8ec60..4e19012c6 100644 --- a/main/fvi.c +++ b/main/fvi.c @@ -33,8 +33,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "player.h" #include "fix.h" -extern int Physics_cheat_flag; - #define face_type_num(nfaces,face_num,tri_edge) ((nfaces==1)?0:(tri_edge*2 + face_num)) // keep the original ASM code here in case we need it again one day... @@ -944,7 +942,7 @@ int fvi_sub(vms_vector *intp,int *ints,vms_vector *p0,int startseg,vms_vector *p //if what we have hit is a door, check the adjoining seg - if ( (thisobjnum == Players[Player_num].objnum) && (Physics_cheat_flag==0xBADA55) ) { + if ( (thisobjnum == Players[Player_num].objnum) && (cheats.ghostphysics) ) { wid_flag = WALL_IS_DOORWAY(seg, side); if (seg->children[side] >= 0 ) wid_flag |= WID_FLY_FLAG; diff --git a/main/game.c b/main/game.c index 9d978125f..c045e3870 100644 --- a/main/game.c +++ b/main/game.c @@ -140,7 +140,6 @@ char faded_in; int Game_suspended=0; //if non-zero, nothing moves but player fix64 Auto_fire_fusion_cannon_time = 0; fix Fusion_charge = 0; -int Game_turbo_mode = 0; int Game_mode = GM_GAME_OVER; int Global_laser_firing_count = 0; int Global_missile_firing_count = 0; @@ -157,6 +156,10 @@ void game_init_render_sub_buffers(int x, int y, int w, int h); extern void multi_check_for_killgoal_winner(); extern int ReadControls(d_event *event); // located in gamecntl.c + +// Cheats +game_cheats cheats; + // ============================================================================================== //this is called once per game @@ -454,7 +457,7 @@ void calc_frame_time() FrameTime = timer_value - last_timer_value; } - if ( Game_turbo_mode ) + if ( cheats.turbo ) FrameTime *= 2; last_timer_value = timer_value; @@ -911,33 +914,9 @@ void reset_rear_view(void) int Config_menu_flag; -extern int Laser_rapid_fire, Ugly_robot_cheat; -extern void do_lunacy_on(), do_lunacy_off(); -extern int Physics_cheat_flag; - -extern int cheat_enable_index; -extern int cheat_wowie_index; -extern int cheat_allkeys_index; -extern int cheat_invuln_index; -extern int cheat_cloak_index; -extern int cheat_shield_index; -extern int cheat_warp_index; -extern int cheat_astral_index; -extern int cheat_poboys_index; -extern int cheat_turbomode_index; -extern int cheat_wowie2_index; -extern int cheat_newlife_index; -extern int cheat_exitpath_index; -extern int cheat_robotpause_index; - void game_disable_cheats() { - Game_turbo_mode = 0; - Cheats_enabled=0; - do_lunacy_off(); - Laser_rapid_fire = 0; - Ugly_robot_cheat = 0; - Physics_cheat_flag = 0; + memset(&cheats, 0, sizeof(cheats)); } // game_setup() @@ -952,14 +931,9 @@ window *game_setup(void) #ifdef EDITOR keyd_editor_mode = 0; #endif - do_lunacy_on(); // Copy values for insane into copy buffer in ai.c - do_lunacy_off(); // Restore true insane mode. PlayerCfg.CockpitMode[1] = PlayerCfg.CockpitMode[0]; last_drawn_cockpit = -1; // Force cockpit to redraw next time a frame renders. Endlevel_sequence = 0; - cheat_enable_index = 0; - - cheat_wowie_index = cheat_allkeys_index = cheat_invuln_index = cheat_cloak_index = cheat_shield_index = cheat_warp_index = cheat_astral_index = cheat_poboys_index = cheat_turbomode_index = cheat_wowie2_index = 0; game_wind = window_create(&grd_curscreen->sc_canvas, 0, 0, SWIDTH, SHEIGHT, game_handler, NULL); if (!game_wind) diff --git a/main/game.h b/main/game.h index 8f32f2fec..0f3d31890 100644 --- a/main/game.h +++ b/main/game.h @@ -44,7 +44,6 @@ extern fix64 Last_laser_fired_time; extern fix64 Next_missile_fire_time; // Time at which player can next fire his selected missile. extern fix64 Next_flare_fire_time; extern fix Laser_delay_time; // Delay between laser fires. -extern int Cheats_enabled; // bits for FixedStep #define EPS4 1 @@ -186,8 +185,6 @@ void show_boxed_message(char *msg, int RenderFlag); // turns off rear view & rear view cockpit void reset_rear_view(void); -extern int Game_turbo_mode; - #define VR_NONE 0 //viewing the game screen #define VR_AREA_DET 1 //viewing with the stereo area determined method #define VR_INTERLACED 2 //viewing with the stereo interlaced method @@ -206,5 +203,30 @@ void game_init_render_buffers (int render_max_w, int render_max_h, int render_me void game_render_frame_mono(int flip); void game_leave_menus(void); +// Cheats +typedef struct game_cheats +{ + int enabled; + int wowie; + int wowie2; + int allkeys; + int invul; + int cloak; + int shields; + int extralife; + int killreactor; + int exitpath; + int levelwarp; + int fullautomap; + int ghostphysics; + int rapidfire; + int turbo; + int robotfiringsuspended; + int baldguy; + int acid; +} __pack__ game_cheats; +extern game_cheats cheats; +void game_disable_cheats(); + #endif diff --git a/main/gamecntl.c b/main/gamecntl.c index 5d9940d36..290c99e6e 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -113,8 +113,6 @@ extern int Global_missile_firing_count; extern int *Toggle_var; -extern int Physics_cheat_flag; - extern fix Show_view_text_timer; // Function prototypes -------------------------------------------------------- @@ -131,7 +129,7 @@ extern void newdemo_strip_frames(char *, int); extern void toggle_cockpit(void); extern void dump_used_textures_all(); -void FinalCheats(int key); +int FinalCheats(int key); #ifndef RELEASE void do_cheat_menu(void); @@ -819,7 +817,7 @@ int HandleTestKey(int key) case KEY_DEBUGGED+KEY_R: - Robot_firing_enabled = !Robot_firing_enabled; + cheats.robotfiringsuspended = !cheats.robotfiringsuspended; break; #ifdef EDITOR //editor-specific functions @@ -884,10 +882,6 @@ int HandleTestKey(int key) do_megawow_powerup(200); break; } - case KEY_DEBUGGED+KEY_F: - KEY_MAC(case KEY_COMMAND+KEY_F:) - GameArg.SysFPSIndicator = !GameArg.SysFPSIndicator; - break; case KEY_DEBUGGED+KEY_SPACEBAR: //KEY_F7: // Toggle physics flying slew_stop(); @@ -951,323 +945,207 @@ int HandleTestKey(int key) #endif //#ifndef RELEASE // Cheat functions ------------------------------------------------------------ -sbyte Enable_john_cheat_1, Enable_john_cheat_2, Enable_john_cheat_3, Enable_john_cheat_4; -int cheat_enable_index; -#define CHEAT_ENABLE_LENGTH (sizeof(cheat_enable_keys) / sizeof(*cheat_enable_keys)) -ubyte cheat_enable_keys[] = {KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_H,KEY_E,KEY_Y}; -ubyte cheat_wowie[] = {KEY_S,KEY_C,KEY_O,KEY_U,KEY_R,KEY_G,KEY_E}; -ubyte cheat_allkeys[] = {KEY_M,KEY_I,KEY_T,KEY_Z,KEY_I}; -ubyte cheat_invuln[] = {KEY_R,KEY_A,KEY_C,KEY_E,KEY_R,KEY_X}; -ubyte cheat_cloak[] = {KEY_G,KEY_U,KEY_I,KEY_L,KEY_E}; -ubyte cheat_shield[] = {KEY_T,KEY_W,KEY_I,KEY_L,KEY_I,KEY_G,KEY_H,KEY_T}; -ubyte cheat_warp[] = {KEY_F,KEY_A,KEY_R,KEY_M,KEY_E,KEY_R,KEY_J,KEY_O,KEY_E}; -ubyte cheat_astral[] = {KEY_A,KEY_S,KEY_T,KEY_R,KEY_A,KEY_L}; -ubyte cheat_poboys[] = {KEY_P,KEY_O,KEY_B,KEY_O,KEY_Y,KEY_S}; +#define CHEAT_MAX_LEN 15 +#define NUM_CHEATS 16 -#define NUM_NEW_CHEATS 5 -ubyte new_cheats[]= { KEY_B^0xaa, KEY_B^0xaa, KEY_B^0xaa, KEY_F^0xaa, KEY_A^0xaa, - KEY_U^0xaa, KEY_I^0xaa, KEY_R^0xaa, KEY_L^0xaa, KEY_H^0xaa, - KEY_G^0xaa, KEY_G^0xaa, KEY_U^0xaa, KEY_A^0xaa, KEY_I^0xaa, - KEY_G^0xaa, KEY_R^0xaa, KEY_I^0xaa, KEY_S^0xaa, KEY_M^0xaa, - KEY_I^0xaa, KEY_E^0xaa, KEY_N^0xaa, KEY_H^0xaa, KEY_S^0xaa, -KEY_N^0xaa, KEY_D^0xaa, KEY_X^0xaa, KEY_X^0xaa, KEY_A^0xaa }; - -#define CHEAT_WOWIE_LENGTH (sizeof(cheat_wowie) / sizeof(*cheat_wowie)) -#define CHEAT_ALLKEYS_LENGTH (sizeof(cheat_allkeys) / sizeof(*cheat_allkeys)) -#define CHEAT_INVULN_LENGTH (sizeof(cheat_invuln) / sizeof(*cheat_invuln)) -#define CHEAT_CLOAK_LENGTH (sizeof(cheat_cloak) / sizeof(*cheat_cloak)) -#define CHEAT_SHIELD_LENGTH (sizeof(cheat_shield) / sizeof(*cheat_shield)) -#define CHEAT_WARP_LENGTH (sizeof(cheat_warp) / sizeof(*cheat_warp)) -#define CHEAT_ASTRAL_LENGTH (sizeof(cheat_astral) / sizeof(*cheat_astral)) -#define CHEAT_POBOYS_LENGTH (sizeof(cheat_poboys) / sizeof(*cheat_poboys)) - -#define CHEAT_TURBOMODE_OFS 0 -#define CHEAT_WOWIE2_OFS 1 -#define CHEAT_NEWLIFE_OFS 2 -#define CHEAT_EXITPATH_OFS 3 -#define CHEAT_ROBOTPAUSE_OFS 4 -#define CHEAT_TURBOMODE_LENGTH 6 -#define CHEAT_WOWIE2_LENGTH 6 -#define CHEAT_NEWLIFE_LENGTH 5 -#define CHEAT_EXITPATH_LENGTH 5 -#define CHEAT_ROBOTPAUSE_LENGTH 6 - -int cheat_wowie_index; -int cheat_allkeys_index; -int cheat_invuln_index; -int cheat_cloak_index; -int cheat_shield_index; -int cheat_warp_index; -int cheat_astral_index; -int cheat_poboys_index; -int cheat_turbomode_index; -int cheat_wowie2_index; -int cheat_newlife_index; -int cheat_exitpath_index; -int cheat_robotpause_index; - -// Frametime "cheat" code stuff - -#define IMPLEMENT_CHEAT(name, action) if (key == cheat_ ## name [cheat_ ## name ## _index]) {\ -if (++cheat_ ## name ## _index == (sizeof(cheat_ ## name)/sizeof(*cheat_ ## name))) {\ -action;\ -cheat_ ## name ## _index = 0;\ -}\ -} else cheat_ ## name ## _index = 0;\ - -//DEFINE_CHEAT needs to be done this weird way since stupid c macros can't (portably) handle multiple args, nor can they realize that within {}'s should all be the same arg. blah. -#define DEFINE_CHEAT(name) int cheat_ ## name ## _index;\ -ubyte cheat_ ## name [] - -int Cheats_enabled=0; - -extern int Laser_rapid_fire, Ugly_robot_cheat; -extern void do_lunacy_on(), do_lunacy_off(); -extern int Physics_cheat_flag; - -extern void john_cheat_func_1(int); -extern void john_cheat_func_2(int); -extern void john_cheat_func_3(int); -extern void john_cheat_func_4(int); - -void FinalCheats(int key) +typedef struct cheat_code { - if (key == 0) return; + char *string; + int *stateptr; +} __pack__ cheat_code; - if (!(Game_mode&GM_MULTI) && key == cheat_enable_keys[cheat_enable_index]) { - if (++cheat_enable_index == CHEAT_ENABLE_LENGTH) { - HUD_init_message(HM_DEFAULT, TXT_CHEATS_ENABLED); - digi_play_sample( SOUND_CHEATER, F1_0); - Cheats_enabled = 1; - Players[Player_num].score = 0; - } - } - else - cheat_enable_index = 0; +cheat_code cheat_codes[NUM_CHEATS] = { + { "gabbagabbahey", &cheats.enabled }, + { "scourge", &cheats.wowie }, + { "bigred", &cheats.wowie2 }, + { "mitzi", &cheats.allkeys }, + { "racerx", &cheats.invul }, + { "guile", &cheats.cloak }, + { "twilight", &cheats.shields }, + { "poboys", &cheats.killreactor }, + { "flash", &cheats.exitpath }, + { "farmerjoe", &cheats.levelwarp }, + { "bruin", &cheats.extralife }, + { "astral", &cheats.ghostphysics }, + { "porgys", &cheats.rapidfire }, + { "buggin", &cheats.turbo }, + { "ahimsa", &cheats.robotfiringsuspended }, + { "bittersweet", &cheats.acid }, +}; - if (Cheats_enabled) +int FinalCheats(int key) +{ + static char cheat_buffer[CHEAT_MAX_LEN] = "AAAAAAAAAAAAAAA"; + int i = 0, gotcha = 0; + + if (Game_mode & GM_MULTI) + return 0; + + for (i = 1; i < CHEAT_MAX_LEN; i++) + cheat_buffer[i-1] = cheat_buffer[i]; + cheat_buffer[CHEAT_MAX_LEN-1] = key_ascii(); + for (i = 0; i < NUM_CHEATS; i++) { - john_cheat_func_2(key); - - if (!(Game_mode&GM_MULTI) && key == cheat_wowie[cheat_wowie_index]) { - if (++cheat_wowie_index == CHEAT_WOWIE_LENGTH) { - int i; - - HUD_init_message(HM_DEFAULT, TXT_WOWIE_ZOWIE); - digi_play_sample( SOUND_CHEATER, F1_0); - - Players[Player_num].primary_weapon_flags |= 0xff ^ (HAS_PLASMA_FLAG | HAS_FUSION_FLAG); - Players[Player_num].secondary_weapon_flags |= 0xff ^ (HAS_SMART_FLAG | HAS_MEGA_FLAG); - - for (i=0; i<3; i++) - Players[Player_num].primary_ammo[i] = Primary_ammo_max[i]; - - for (i=0; i<3; i++) - Players[Player_num].secondary_ammo[i] = Secondary_ammo_max[i]; - - if (Newdemo_state == ND_STATE_RECORDING) - newdemo_record_laser_level(Players[Player_num].laser_level, MAX_LASER_LEVEL); - - Players[Player_num].energy = MAX_ENERGY; - Players[Player_num].laser_level = MAX_LASER_LEVEL; - Players[Player_num].flags |= PLAYER_FLAGS_QUAD_LASERS; - update_laser_weapon_info(); - - cheat_wowie_index = 0; - } + int cheatlen = strlen(cheat_codes[i].string); + Assert(cheatlen <= CHEAT_MAX_LEN); + if (strnicmp(cheat_codes[i].string, cheat_buffer+CHEAT_MAX_LEN-cheatlen, cheatlen)==0) + { + if (!cheats.enabled && *cheat_codes[i].stateptr != cheats.enabled) + break; + if (!cheats.enabled) + HUD_init_message(HM_DEFAULT, TXT_CHEATS_ENABLED); + *cheat_codes[i].stateptr = !*cheat_codes[i].stateptr; + cheats.enabled = 1; + digi_play_sample( SOUND_CHEATER, F1_0); + Players[Player_num].score = 0; + gotcha = i; + break; } - else - cheat_wowie_index = 0; - - if (!(Game_mode&GM_MULTI) && key == (0xaa^new_cheats[cheat_wowie2_index*NUM_NEW_CHEATS+CHEAT_WOWIE2_OFS])) { - if (++cheat_wowie2_index == CHEAT_WOWIE2_LENGTH) { - int i; - - HUD_init_message(HM_DEFAULT, "SUPER %s",TXT_WOWIE_ZOWIE); - digi_play_sample( SOUND_CHEATER, F1_0); - - Players[Player_num].primary_weapon_flags = 0xff; - Players[Player_num].secondary_weapon_flags = 0xff; - - for (i=0; i=0 && new_level_num<=Last_level) - { - window_set_visible(Game_wind, 0); - StartNewLevel(new_level_num); - window_set_visible(Game_wind, 1); - } - } - - cheat_warp_index = 0; - } - } - else - cheat_warp_index = 0; - - if (!(Game_mode&GM_MULTI) && key == cheat_astral[cheat_astral_index]) { - if (++cheat_astral_index == CHEAT_ASTRAL_LENGTH) { - digi_play_sample( SOUND_CHEATER, F1_0); - if ( Physics_cheat_flag==0xBADA55 ) { - Physics_cheat_flag = 0; - } else { - Physics_cheat_flag = 0xBADA55; - } - HUD_init_message(HM_DEFAULT, "%s %s!", "Ghosty mode", Physics_cheat_flag==0xBADA55?TXT_ON:TXT_OFF); - cheat_astral_index = 0; - } - } - else - cheat_astral_index = 0; - - if (!(Game_mode&GM_MULTI) && key == cheat_poboys[cheat_poboys_index]) { - if (++cheat_poboys_index == CHEAT_POBOYS_LENGTH) { - digi_play_sample( SOUND_CHEATER, F1_0); - kill_and_so_forth(); - cheat_poboys_index = 0; - } - } - else - cheat_poboys_index = 0; - - if (!(Game_mode&GM_MULTI) && key == (0xaa^new_cheats[cheat_turbomode_index*NUM_NEW_CHEATS+CHEAT_TURBOMODE_OFS])) { - if (++cheat_turbomode_index == CHEAT_TURBOMODE_LENGTH) { - Game_turbo_mode ^= 1; - HUD_init_message(HM_DEFAULT, "%s %s!", "Turbo mode", Game_turbo_mode?TXT_ON:TXT_OFF); - digi_play_sample( SOUND_CHEATER, F1_0); - } - } - else - cheat_turbomode_index = 0; - - if (!(Game_mode&GM_MULTI) && key == (0xaa^new_cheats[cheat_newlife_index*NUM_NEW_CHEATS+CHEAT_NEWLIFE_OFS])) { - if (++cheat_newlife_index == CHEAT_NEWLIFE_LENGTH) { - if (Players[Player_num].lives<50) { - Players[Player_num].lives++; - HUD_init_message(HM_DEFAULT, "Extra life!"); - digi_play_sample( SOUND_CHEATER, F1_0); - } - - cheat_newlife_index = 0; - } - } - else - cheat_newlife_index = 0; - - if (!(Game_mode&GM_MULTI) && key == (0xaa^new_cheats[cheat_exitpath_index*NUM_NEW_CHEATS+CHEAT_EXITPATH_OFS])) { - if (++cheat_exitpath_index == CHEAT_EXITPATH_LENGTH) { -#ifdef SHOW_EXIT_PATH - if (create_special_path()) { - HUD_init_message(HM_DEFAULT, "Exit path illuminated!"); - digi_play_sample( SOUND_CHEATER, F1_0); - } -#endif - cheat_exitpath_index = 0; - } - } - else - cheat_exitpath_index = 0; - - if (!(Game_mode&GM_MULTI) && key == (0xaa^new_cheats[cheat_robotpause_index*NUM_NEW_CHEATS+CHEAT_ROBOTPAUSE_OFS])) { - if (++cheat_robotpause_index == CHEAT_ROBOTPAUSE_LENGTH) { - Robot_firing_enabled = !Robot_firing_enabled; - HUD_init_message(HM_DEFAULT, "%s %s!", "Robot firing", Robot_firing_enabled?TXT_ON:TXT_OFF); - digi_play_sample( SOUND_CHEATER, F1_0); - - cheat_robotpause_index = 0; - } - - } - else - cheat_robotpause_index = 0; - - john_cheat_func_3(key); - john_cheat_func_4(key); - bald_guy_cheat(key); } + + if (!gotcha) + return 0; + + if (cheat_codes[gotcha].stateptr == &cheats.wowie) + { + HUD_init_message(HM_DEFAULT, TXT_WOWIE_ZOWIE); + + Players[Player_num].primary_weapon_flags |= 0xff ^ (HAS_PLASMA_FLAG | HAS_FUSION_FLAG); + Players[Player_num].secondary_weapon_flags |= 0xff ^ (HAS_SMART_FLAG | HAS_MEGA_FLAG); + + for (i=0; i<3; i++) + Players[Player_num].primary_ammo[i] = Primary_ammo_max[i]; + for (i=0; i<3; i++) + Players[Player_num].secondary_ammo[i] = Secondary_ammo_max[i]; + + if (Newdemo_state == ND_STATE_RECORDING) + newdemo_record_laser_level(Players[Player_num].laser_level, MAX_LASER_LEVEL); + + Players[Player_num].energy = MAX_ENERGY; + Players[Player_num].laser_level = MAX_LASER_LEVEL; + Players[Player_num].flags |= PLAYER_FLAGS_QUAD_LASERS; + update_laser_weapon_info(); + } + + if (cheat_codes[gotcha].stateptr == &cheats.wowie2) + { + HUD_init_message(HM_DEFAULT, "SUPER %s",TXT_WOWIE_ZOWIE); + + Players[Player_num].primary_weapon_flags = 0xff; + Players[Player_num].secondary_weapon_flags = 0xff; + + for (i=0; i=0 && new_level_num<=Last_level) + { + window_set_visible(Game_wind, 0); + StartNewLevel(new_level_num); + window_set_visible(Game_wind, 1); + } + } + } + + if (cheat_codes[gotcha].stateptr == &cheats.ghostphysics) + { + HUD_init_message(HM_DEFAULT, "%s %s!", "Ghosty mode", cheats.ghostphysics?TXT_ON:TXT_OFF); + } + + if (cheat_codes[gotcha].stateptr == &cheats.rapidfire) + { + do_megawow_powerup(200); + } + + if (cheat_codes[gotcha].stateptr == &cheats.turbo) + { + HUD_init_message(HM_DEFAULT, "%s %s!", "Turbo mode", cheats.turbo?TXT_ON:TXT_OFF); + } + + if (cheat_codes[gotcha].stateptr == &cheats.robotfiringsuspended) + { + HUD_init_message(HM_DEFAULT, "Robot firing %s!", cheats.robotfiringsuspended?TXT_OFF:TXT_ON); + } + + if (cheat_codes[gotcha].stateptr == &cheats.acid) + { + HUD_init_message(HM_DEFAULT, cheats.acid?"Going up!":"Coming down!"); + } + + return 1; } // Internal Cheat Menu @@ -1413,8 +1291,7 @@ int ReadControls(d_event *event) } else { - FinalCheats(key); - + if (FinalCheats(key)) return 1; if (HandleSystemKey(key)) return 1; if (HandleGameKey(key)) return 1; } diff --git a/main/gamerend.c b/main/gamerend.c index b992ba765..37942d869 100644 --- a/main/gamerend.c +++ b/main/gamerend.c @@ -338,7 +338,7 @@ void game_draw_hud_stuff() } } - if (GameArg.SysFPSIndicator && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) + if (GameCfg.FPSIndicator && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) show_framerate(); if (Newdemo_state == ND_STATE_PLAYBACK) diff --git a/main/gameseq.c b/main/gameseq.c index fbce9b3e1..a22ada160 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -736,8 +736,6 @@ void InitPlayerObject() ConsoleObject->movement_type = MT_PHYSICS; } -extern void game_disable_cheats(); - //starts a new game on the given level void StartNewGame(int start_level) { @@ -768,23 +766,6 @@ void StartNewGame(int start_level) game_disable_cheats(); } -//starts a resumed game loaded from disk -void ResumeSavedGame(int start_level) -{ - Game_mode = GM_NORMAL; - - N_players = 1; - #ifdef NETWORK - Network_new_game = 0; - #endif - - InitPlayerObject(); //make sure player's object set up - - StartNewLevel(start_level); - - game_disable_cheats(); -} - // ----------------------------------------------------------------------------- // Does the bonus scoring. // Call with dead_flag = 1 if player died, but deserves some portion of bonus (only skill points), anyway. @@ -806,7 +787,7 @@ void DoEndLevelScoreGlitz(int network) level_points = Players[Player_num].score-Players[Player_num].last_score; - if (!Cheats_enabled) { + if (!cheats.enabled) { if (Difficulty_level > 1) { skill_points = level_points*(Difficulty_level-1)/2; skill_points -= skill_points % 100; @@ -826,13 +807,13 @@ void DoEndLevelScoreGlitz(int network) all_hostage_text[0] = 0; endgame_text[0] = 0; - if (!Cheats_enabled && (Players[Player_num].hostages_on_board == Players[Player_num].hostages_level)) { + if (!cheats.enabled && (Players[Player_num].hostages_on_board == Players[Player_num].hostages_level)) { all_hostage_points = Players[Player_num].hostages_on_board * 1000 * (Difficulty_level+1); sprintf(all_hostage_text, "%s%i\n", TXT_FULL_RESCUE_BONUS, all_hostage_points); } else all_hostage_points = 0; - if (!Cheats_enabled && !(Game_mode & GM_MULTI) && (Players[Player_num].lives) && (Current_level_num == Last_level)) { //player has finished the game! + if (!cheats.enabled && !(Game_mode & GM_MULTI) && (Players[Player_num].lives) && (Current_level_num == Last_level)) { //player has finished the game! endgame_points = Players[Player_num].lives * 10000; sprintf(endgame_text, "%s%i\n", TXT_SHIP_BONUS, endgame_points); is_last_level=1; @@ -1258,7 +1239,7 @@ void StartNewLevelSub(int level_num, int page_in_textures) init_all_matcens(); reset_palette_add(); - if (!(Game_mode & GM_MULTI) && !Cheats_enabled) + if (!(Game_mode & GM_MULTI) && !cheats.enabled) set_highest_level(Current_level_num); reset_special_effects(); @@ -1446,8 +1427,6 @@ void StartLevel(int random) reset_rear_view(); Auto_fire_fusion_cannon_time = 0; Fusion_charge = 0; - - Robot_firing_enabled = 1; } diff --git a/main/gameseq.h b/main/gameseq.h index d3950cc04..dde903b49 100644 --- a/main/gameseq.h +++ b/main/gameseq.h @@ -69,9 +69,6 @@ void StartNewLevelSub(int level_num, int page_in_textures); void InitPlayerObject(); //make sure player's object set up void init_player_stats_game(); //clear all stats -// starts a resumed game loaded from disk -void ResumeSavedGame(int start_level); - // called when the player has finished a level // if secret flag is true, advance to secret level, else next normal level void PlayerFinishedLevel(int secret_flag); diff --git a/main/gauges.c b/main/gauges.c index 2baca7ecc..4480e01ad 100644 --- a/main/gauges.c +++ b/main/gauges.c @@ -781,7 +781,7 @@ void hud_show_score_added() color = color - (color % 4); - if (Cheats_enabled) + if (cheats.enabled) sprintf(score_str, "%s", TXT_CHEATER); else sprintf(score_str, "%5d", score_display); @@ -857,7 +857,7 @@ void sb_show_score_added() if (color < 10) color = 10; if (color > 31) color = 31; - if (Cheats_enabled) + if (cheats.enabled) sprintf(score_str, "%s", TXT_CHEATER); else sprintf(score_str, "%5d", score_display); @@ -1327,7 +1327,7 @@ void add_points_to_score(int points) score_display += points; if (score_time > f1_0*4) score_time = f1_0*4; - if (points == 0 || Cheats_enabled) + if (points == 0 || cheats.enabled) return; if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) @@ -1365,7 +1365,7 @@ void add_bonus_points_to_score(int points) { int prev_score; - if (points == 0 || Cheats_enabled) + if (points == 0 || cheats.enabled) return; prev_score=Players[Player_num].score; diff --git a/main/inferno.c b/main/inferno.c index f4a72e9a7..cdc48d43e 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -103,7 +103,6 @@ extern void arch_init(void); void print_commandline_help() { printf( "\n System Options:\n\n"); - printf( " -fps %s\n", "Enable FPS indicator by default"); printf( " -nonicefps %s\n", "Don't free CPU-cycles"); printf( " -maxfps %s\n", "Set maximum framerate (1-200)"); printf( " -hogdir %s\n", "set shared data directory to "); diff --git a/main/kconfig.c b/main/kconfig.c index d14be7592..9dab53ee6 100644 --- a/main/kconfig.c +++ b/main/kconfig.c @@ -1127,7 +1127,7 @@ void kconfig(int n, char * title) void kconfig_read_controls(d_event *event, int automap_flag) { - int i = 0, j = 0, speed_factor = Game_turbo_mode?2:1; + int i = 0, j = 0, speed_factor = cheats.turbo?2:1; static fix64 mouse_delta_time = 0; #ifndef NDEBUG diff --git a/main/laser.c b/main/laser.c index b326810bd..fbafd38a5 100644 --- a/main/laser.c +++ b/main/laser.c @@ -49,8 +49,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define NEWHOMER -int Laser_rapid_fire = 0; - int find_homing_object_complete(vms_vector *curpos, object *tracker, int track_obj_type1, int track_obj_type2); //--------------------------------------------------------------------------------- @@ -1172,7 +1170,7 @@ int do_laser_firing_player(void) Last_laser_fired_time = GameTime64; //end move - Victor Rachels - if (Laser_rapid_fire!=0xBADA55) + if (!cheats.rapidfire) Next_laser_fire_time += Weapon_info[weapon_index].fire_wait; else Next_laser_fire_time += F1_0/25; @@ -1474,7 +1472,7 @@ void do_missile_firing(int drop_bomb) Players[Player_num].secondary_ammo[weapon]--; weapon_index = Secondary_weapon_to_weapon_info[weapon]; - if (Laser_rapid_fire!=0xBADA55) + if (!cheats.rapidfire) Next_missile_fire_time = GameTime64 + Weapon_info[weapon_index].fire_wait; else Next_missile_fire_time = GameTime64 + F1_0/25; diff --git a/main/menu.c b/main/menu.c index 9965b3d37..5ea327166 100644 --- a/main/menu.c +++ b/main/menu.c @@ -1211,7 +1211,7 @@ void reticle_config() PlayerCfg.ReticleSize = m[opt_ret_size].value; } -int opt_gr_texfilt, opt_gr_brightness, opt_gr_reticlemenu, opt_gr_alphafx, opt_gr_vsync, opt_gr_multisample; +int opt_gr_texfilt, opt_gr_brightness, opt_gr_reticlemenu, opt_gr_alphafx, opt_gr_vsync, opt_gr_multisample, opt_gr_fpsindi; int graphics_config_menuset(newmenu *menu, d_event *event, void *userdata) { newmenu_item *items = newmenu_get_items(menu); @@ -1252,10 +1252,10 @@ int graphics_config_menuset(newmenu *menu, d_event *event, void *userdata) void graphics_config() { #ifdef OGL - newmenu_item m[11]; + newmenu_item m[12]; int i = 0; #else - newmenu_item m[2]; + newmenu_item m[3]; #endif int nitems = 0; @@ -1279,7 +1279,10 @@ void graphics_config() m[nitems].type = NM_TYPE_CHECK; m[nitems].text="VSync"; m[nitems].value = GameCfg.VSync; nitems++; opt_gr_multisample = nitems; m[nitems].type = NM_TYPE_CHECK; m[nitems].text="4x multisampling"; m[nitems].value = GameCfg.Multisample; nitems++; - +#endif + opt_gr_fpsindi = nitems; + m[nitems].type = NM_TYPE_CHECK; m[nitems].text="FPS Counter"; m[nitems].value = GameCfg.FPSIndicator; nitems++; +#ifdef OGL m[opt_gr_texfilt+GameCfg.TexFilt].value=1; #endif @@ -1297,6 +1300,7 @@ void graphics_config() GameCfg.Multisample = m[opt_gr_multisample].value; #endif GameCfg.GammaLevel = m[opt_gr_brightness].value; + GameCfg.FPSIndicator = m[opt_gr_fpsindi].value; #ifdef OGL gr_set_attributes(); gr_set_mode(Game_screen_mode); diff --git a/main/multi.c b/main/multi.c index cc07d2b89..d8098547e 100644 --- a/main/multi.c +++ b/main/multi.c @@ -412,8 +412,6 @@ get_team(int pnum) return 0; } -extern void game_disable_cheats(); - void multi_new_game(void) { diff --git a/main/net_ipx.c b/main/net_ipx.c index 37b5fd75f..eba60c873 100644 --- a/main/net_ipx.c +++ b/main/net_ipx.c @@ -90,7 +90,6 @@ int IPX_Socket=0; int IPX_allow_socket_changes = 1; IPX_sequence_packet IPX_Seq; extern obj_position Player_init[MAX_PLAYERS]; -extern void game_disable_cheats(); int net_ipx_wait_for_snyc(); extern char MaxPowerupsAllowed[MAX_POWERUP_TYPES]; extern char PowerupsInMine[MAX_POWERUP_TYPES]; diff --git a/main/net_udp.c b/main/net_udp.c index 839d8649e..33cbcc661 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -85,7 +85,6 @@ void net_udp_noloss_init_mdata_queue(void); void net_udp_noloss_clear_mdata_got(ubyte player_num); void net_udp_noloss_process_queue(fix64 time); void net_udp_send_extras (); -extern void game_disable_cheats(); extern void multi_send_kill_goal_counts(); // Variables @@ -826,8 +825,6 @@ void net_udp_init() if( UDP_Socket[1] != -1 ) udp_close_socket(1); - game_disable_cheats(); - for (t=0;ttype==OBJ_PLAYER && obj->segnum!=orig_segnum && (Physics_cheat_flag!=0xBADA55) ) { + if (obj->type==OBJ_PLAYER && obj->segnum!=orig_segnum && (!cheats.ghostphysics) ) { int sidenum; sidenum = find_connect_side(&Segments[obj->segnum],&Segments[orig_segnum]); diff --git a/main/player.h b/main/player.h index 05952d6cd..809f511b3 100644 --- a/main/player.h +++ b/main/player.h @@ -45,7 +45,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define PLAYER_FLAGS_MAP_ALL 64 // Player can see unvisited areas on map #define PLAYER_FLAGS_RADAR_ENEMIES 128 // Player can see enemies on radar #define PLAYER_FLAGS_RADAR_POWERUPS 256 // Player can see powerups -#define PLAYER_FLAGS_MAP_ALL_CHEAT 512 // Player can see unvisited areas on map normally +// #define PLAYER_FLAGS_MAP_ALL_CHEAT 512 // Player can see unvisited areas on map normally -- OBSOLETE BY CHEAT STRUCT #define PLAYER_FLAGS_QUAD_LASERS 1024 // Player shoots 4 at once #define PLAYER_FLAGS_CLOAKED 2048 // Player is cloaked for awhile #define PLAYER_FLAGS_AFTERBURNER 4096 // Player's afterburner is engaged diff --git a/main/render.c b/main/render.c index 46493c7ec..d06bb4381 100644 --- a/main/render.c +++ b/main/render.c @@ -20,7 +20,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include #include #include - +#include #include "inferno.h" #include "segment.h" #include "error.h" @@ -48,6 +48,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "newmenu.h" #include "u_mem.h" #include "piggy.h" +#include "timer.h" #ifdef OGL #include "ogl_init.h" @@ -603,9 +604,19 @@ g3s_codes rotate_list(int nv,short *pointnumlist) pnt = &Segment_points[pnum]; - if (Rotated_last[pnum] != RL_framecount) { - - g3_rotate_point(pnt,&Vertices[pnum]); + if (Rotated_last[pnum] != RL_framecount) + { + if (cheats.acid) + { + float f = (float) timer_query() / F1_0; + vms_vector tmpv = Vertices[pnum]; + tmpv.x += fl2f(sinf(f * 2.0f + f2fl(tmpv.x))); + tmpv.y += fl2f(sinf(f * 3.0f + f2fl(tmpv.y))); + tmpv.z += fl2f(sinf(f * 5.0f + f2fl(tmpv.z))); + g3_rotate_point(pnt,&tmpv); + } + else + g3_rotate_point(pnt,&Vertices[pnum]); Rotated_last[pnum] = RL_framecount; } diff --git a/main/state.c b/main/state.c index 49fa25660..a0e414890 100644 --- a/main/state.c +++ b/main/state.c @@ -71,7 +71,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define STATE_COMPATIBLE_VERSION 6 // 0 - Put DGSS (Descent Game State Save) id at tof. // 1 - Added Difficulty level save -// 2 - Added Cheats_enabled flag +// 2 - Added cheats.enabled flag // 3 - Added between levels save. // 4 - Added mission support // 5 - Mike changed ai and object structure. @@ -85,12 +85,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. extern int Do_appearance_effect; -extern int Laser_rapid_fire, Ugly_robot_cheat, Ugly_robot_texture; -extern int Physics_cheat_flag; -extern int Lunacy; -extern void do_lunacy_on(void); -extern void do_lunacy_off(void); - int state_save_all_sub(char *filename, char *desc); int state_restore_all_sub(char *filename); @@ -765,18 +759,16 @@ int state_save_old_game(int slotnum, char * sg_name, player_rw * sg_player, temp_int = sg_difficulty_level; PHYSFS_write(fp, &temp_int, sizeof(int), 1); -// Save the Cheats_enabled +// Save the cheats.enabled temp_int = 0; - PHYSFS_write(fp, &temp_int, sizeof(int), 1); - temp_int = 0; // turbo mode - PHYSFS_write(fp, &temp_int, sizeof(int), 1); - + PHYSFS_write(fp, &cheats.enabled, sizeof(int), 1); + PHYSFS_write( fp, &cheats.turbo, sizeof(int), 1); PHYSFS_write( fp, &state_game_id, sizeof(uint), 1 ); - PHYSFS_write( fp, &Laser_rapid_fire, sizeof(int), 1 ); - PHYSFS_write( fp, &Ugly_robot_cheat, sizeof(int), 1 ); - PHYSFS_write( fp, &Ugly_robot_texture, sizeof(int), 1 ); - PHYSFS_write( fp, &Physics_cheat_flag, sizeof(int), 1 ); - PHYSFS_write( fp, &Lunacy, sizeof(int), 1 ); + PHYSFS_write( fp, &cheats.rapidfire, sizeof(int), 1 ); + PHYSFS_write( fp, &temp_int, sizeof(int), 1 ); // was Ugly_robot_cheat + PHYSFS_write( fp, &temp_int, sizeof(int), 1 ); // Ugly_robot_texture + PHYSFS_write( fp, &cheats.ghostphysics, sizeof(int), 1 ); + PHYSFS_write( fp, &temp_int, sizeof(int), 1 ); // was Lunacy PHYSFS_close(fp); @@ -937,8 +929,8 @@ int state_save_all_sub(char *filename, char *desc) PHYSFS_write(fp, &Difficulty_level, sizeof(int), 1); // Save cheats enabled - PHYSFS_write(fp, &Cheats_enabled, sizeof(int), 1); - PHYSFS_write(fp, &Game_turbo_mode, sizeof(int), 1); + PHYSFS_write(fp, &cheats.enabled, sizeof(int), 1); + PHYSFS_write(fp, &cheats.turbo, sizeof(int), 1); //Finish all morph objects for (i=0; i<=Highest_object_index; i++ ) { @@ -1029,11 +1021,12 @@ int state_save_all_sub(char *filename, char *desc) PHYSFS_write(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS); PHYSFS_write(fp, &state_game_id, sizeof(uint), 1); - PHYSFS_write(fp, &Laser_rapid_fire, sizeof(int), 1); - PHYSFS_write(fp, &Ugly_robot_cheat, sizeof(int), 1); - PHYSFS_write(fp, &Ugly_robot_texture, sizeof(int), 1); - PHYSFS_write(fp, &Physics_cheat_flag, sizeof(int), 1); - PHYSFS_write(fp, &Lunacy, sizeof(int), 1); + i = 0; + PHYSFS_write(fp, &cheats.rapidfire, sizeof(int), 1); + PHYSFS_write(fp, &i, sizeof(int), 1); // was Ugly_robot_cheat + PHYSFS_write(fp, &i, sizeof(int), 1); // was Ugly_robot_texture + PHYSFS_write(fp, &cheats.ghostphysics, sizeof(int), 1); + PHYSFS_write(fp, &i, sizeof(int), 1); // was Lunacy // Save Coop Info if (Game_mode & GM_MULTI_COOP) @@ -1237,8 +1230,8 @@ int state_restore_all_sub(char *filename) // Restore the cheats enabled flag - Cheats_enabled = PHYSFSX_readSXE32(fp, swap); - Game_turbo_mode = PHYSFSX_readSXE32(fp, swap); + cheats.enabled = PHYSFSX_readSXE32(fp, swap); + cheats.turbo = PHYSFSX_readSXE32(fp, swap); Do_appearance_effect = 0; // Don't do this for middle o' game stuff. @@ -1374,15 +1367,13 @@ RetryObjectLoading: state_game_id = 0; if ( version >= 7 ) { - int tmp_Lunacy; + int stub; state_game_id = PHYSFSX_readSXE32(fp, swap); - Laser_rapid_fire = PHYSFSX_readSXE32(fp, swap); - Ugly_robot_cheat = PHYSFSX_readSXE32(fp, swap); - Ugly_robot_texture = PHYSFSX_readSXE32(fp, swap); - Physics_cheat_flag = PHYSFSX_readSXE32(fp, swap); - tmp_Lunacy = PHYSFSX_readSXE32(fp, swap); - if ( tmp_Lunacy ) - do_lunacy_on(); + cheats.rapidfire = PHYSFSX_readSXE32(fp, swap); + stub = PHYSFSX_readSXE32(fp, swap); // was Ugly_robot_cheat + stub = PHYSFSX_readSXE32(fp, swap); // Ugly_robot_texture + cheats.ghostphysics = PHYSFSX_readSXE32(fp, swap); + stub = PHYSFSX_readSXE32(fp, swap); // was Lunacy } // Read Coop Info diff --git a/main/titles.c b/main/titles.c index 5e1e406a8..09fff3382 100644 --- a/main/titles.c +++ b/main/titles.c @@ -850,34 +850,11 @@ void init_new_page(briefing *br) } // ----------------------------------------------------------------------------- -ubyte baldguy_cheat = 0; -static ubyte bald_guy_cheat_index = 0; char new_baldguy_pcx[] = "btexture.xxx"; -#define BALD_GUY_CHEAT_SIZE 7 #define NEW_END_GUY1 1 #define NEW_END_GUY2 3 -ubyte bald_guy_cheat_1[BALD_GUY_CHEAT_SIZE] = { KEY_B ^ 0xF0 ^ 0xab, - KEY_A ^ 0xE0 ^ 0xab, - KEY_L ^ 0xD0 ^ 0xab, - KEY_D ^ 0xC0 ^ 0xab, - KEY_G ^ 0xB0 ^ 0xab, - KEY_U ^ 0xA0 ^ 0xab, - KEY_Y ^ 0x90 ^ 0xab }; - -void bald_guy_cheat(int key) -{ - if (key == (bald_guy_cheat_1[bald_guy_cheat_index] ^ (0xf0 - (bald_guy_cheat_index << 4)) ^ 0xab)) { - bald_guy_cheat_index++; - if (bald_guy_cheat_index == BALD_GUY_CHEAT_SIZE) { - baldguy_cheat = 1; - bald_guy_cheat_index = 0; - } - } else - bald_guy_cheat_index = 0; -} - void free_briefing_screen(briefing *br); extern void swap_0_255(grs_bitmap *bmp); @@ -912,7 +889,7 @@ int load_briefing_screen(briefing *br, char *fname) if (stricmp(br->background_name, fname2)) strncpy (br->background_name,fname2, sizeof(br->background_name)); - if ((!stricmp(fname2, "brief02.pcx") || !stricmp(fname2, "brief02h.pcx")) && baldguy_cheat) + if ((!stricmp(fname2, "brief02.pcx") || !stricmp(fname2, "brief02h.pcx")) && cheats.baldguy) if ( bald_guy_load(new_baldguy_pcx, &br->background, BM_LINEAR, gr_palette) == 0) { d_free(fname2); @@ -1051,6 +1028,9 @@ int briefing_handler(window *wind, d_event *event, briefing *br) switch (key) { + case KEY_ALTED + KEY_B: // B - ALTED... BALT... BALD... get it? + cheats.baldguy = !cheats.baldguy; + break; case KEY_ESC: window_close(wind); return 1; diff --git a/main/titles.h b/main/titles.h index b40a6f228..b206774a7 100644 --- a/main/titles.h +++ b/main/titles.h @@ -25,6 +25,5 @@ extern void do_briefing_screens(char *filename, int level_num); extern void do_end_briefing_screens(char *filename); extern char * get_briefing_screen( int level_num ); extern void show_order_form(void); -extern void bald_guy_cheat(int key); #endif diff --git a/misc/args.c b/misc/args.c index b876fdaa1..41985d0c5 100644 --- a/misc/args.c +++ b/misc/args.c @@ -123,7 +123,6 @@ void ReadCmdArgs(void) // System Options GameArg.SysShowCmdHelp = (FindArg( "-help" ) || FindArg( "-h" ) || FindArg( "-?" ) || FindArg( "?" )); - GameArg.SysFPSIndicator = FindArg("-fps"); GameArg.SysUseNiceFPS = !FindArg("-nonicefps"); GameArg.SysMaxFPS = get_int_arg("-maxfps", MAXIMUM_FPS);