From 22db5f85608606b3d5a37fa7ed152e1de2544866 Mon Sep 17 00:00:00 2001 From: AdamPlenty <58278560+AdamPlenty@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:57:31 +0100 Subject: [PATCH 1/4] Reverse scrolling --- src/front_input.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/front_input.c b/src/front_input.c index 506c7d3e11..9372350340 100644 --- a/src/front_input.c +++ b/src/front_input.c @@ -3062,6 +3062,54 @@ void process_cheat_mode_selection_inputs() } clear_key_pressed(KC_LSHIFT); } + else if (is_key_pressed(KC_LCONTROL, KMod_DONTCARE)) + { + if (player->work_state == PSt_MkGoodCreatr) + { + new_value = player->cheatselection.chosen_hero_kind; + do + { + if (new_value == 0) + { + new_value = game.conf.crtr_conf.model_count - 1; + } + else + { + new_value--; + if (new_value == 0) + { + break; + } + } + crconf = &game.conf.crtr_conf.model[new_value]; + } + while ( ((crconf->model_flags & CMF_IsEvil) != 0) || ((crconf->model_flags & CMF_IsSpectator) != 0) ); + set_players_packet_action(player, PckA_CheatSwitchHero, new_value, 0, 0, 0); + } + else if (player->work_state == PSt_MkBadCreatr) + { + new_value = player->cheatselection.chosen_creature_kind; + do + { + if (new_value == 0) + { + new_value = game.conf.crtr_conf.model_count - 1; + } + else + { + new_value--; + if (new_value == 0) + { + break; + } + } + crconf = &game.conf.crtr_conf.model[new_value]; + } + while ( ((crconf->model_flags & CMF_IsEvil) == 0) || ((crconf->model_flags & CMF_IsSpectator) != 0) ); + set_players_packet_action(player, PckA_CheatSwitchCreature, new_value, 0, 0, 0); + } + clear_key_pressed(KC_LCONTROL); + } break; } case PSt_PlaceTerrain: @@ -3149,6 +3197,19 @@ void process_cheat_mode_selection_inputs() set_players_packet_action(player, PckA_CheatSwitchTerrain, new_value, 0, 0, 0); clear_key_pressed(KC_LSHIFT); } + else if (is_key_pressed(KC_LCONTROL, KMod_DONTCARE)) + { + if (new_value == SlbT_ROCK) + { + new_value = game.conf.slab_conf.slab_types_count - 1; + } + else + { + new_value--; + } + set_players_packet_action(player, PckA_CheatSwitchTerrain, new_value, 0, 0, 0); + clear_key_pressed(KC_LCONTROL); + } if ( (player->cheatselection.chosen_terrain_kind >= SlbT_WALLDRAPE) && (player->cheatselection.chosen_terrain_kind <= SlbT_WALLPAIRSHR) ) { if (is_key_pressed(KC_LALT, KMod_DONTCARE)) From df77804168c9b8a437a09df653abedcebce432bb Mon Sep 17 00:00:00 2001 From: AdamPlenty <58278560+AdamPlenty@users.noreply.github.com> Date: Fri, 27 Sep 2024 19:27:26 +0100 Subject: [PATCH 2/4] Added cheat to give doors and traps --- src/gui_boxmenu.c | 10 ++++++++++ src/packets.h | 1 + src/packets_cheats.c | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/src/gui_boxmenu.c b/src/gui_boxmenu.c index c5d1db53b8..be387aa023 100644 --- a/src/gui_boxmenu.c +++ b/src/gui_boxmenu.c @@ -68,6 +68,7 @@ long gf_decide_victory(struct GuiBox *gbox, struct GuiBoxOption *goptn, unsigned long gfa_single_player_mode(struct GuiBox* gbox, struct GuiBoxOption* goptn, long* tag); long gf_all_doors(struct GuiBox *gbox, struct GuiBoxOption *goptn, unsigned char btn, long *tag); long gf_all_traps(struct GuiBox *gbox, struct GuiBoxOption *goptn, unsigned char btn, long *tag); +long gf_give_door_trap(struct GuiBox *gbox, struct GuiBoxOption *goptn, unsigned char btn, long *tag); struct GuiBoxOption gui_main_cheat_list[] = { //gui_main_option_list in beta {"Null mode", 1, NULL, gf_change_player_state, 0, 0, 0, PSt_None, 0, 0, 0, true}, @@ -110,6 +111,7 @@ struct GuiBoxOption gui_creature_cheat_option_list[] = { {"Research all rooms", 1, NULL, gf_research_rooms, 0, 0, 0, 0, 0, 0, 0, 0}, {"All doors manufacturable", 1, NULL, gf_all_doors, 0, 0, 0, 0, 0, 0, 0, 0}, {"All traps manufacturable", 1, NULL, gf_all_traps, 0, 0, 0, 0, 0, 0, 0, 0}, + {"Increment doors and traps count", 1, NULL, gf_give_door_trap, 0, 0, 0, 0, 0, 0, 0, 0}, {"Win the level instantly", 1, NULL, gf_decide_victory, 0, 0, 0, 1, 0, 0, 0, 0}, {"Lose the level instantly", 1, NULL, gf_decide_victory, 0, 0, 0, 0, 0, 0, 0, 0}, {"!", 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0}, @@ -289,6 +291,14 @@ long gf_all_traps(struct GuiBox *gbox, struct GuiBoxOption *goptn, unsigned char return 1; } +long gf_give_door_trap(struct GuiBox *gbox, struct GuiBoxOption *goptn, unsigned char btn, long *tag) +{ + struct PlayerInfo* player = get_my_player(); + // if (player->cheat_mode == 0) return false; -- there's no cheat_mode flag yet + set_players_packet_action(player, PckA_CheatGiveDoorTrap, 0, 0, 0, 0); + return 1; +} + void gui_draw_all_boxes(void) { SYNCDBG(5,"Starting"); diff --git a/src/packets.h b/src/packets.h index 054f6cf2af..a036859723 100644 --- a/src/packets.h +++ b/src/packets.h @@ -181,6 +181,7 @@ enum TbPacketAction { PckA_SetNearestTeleport, PckA_SetRoomspaceDragPaint, PckA_PlyrQueryCreature, + PckA_CheatGiveDoorTrap, }; /** Packet flags for non-action player operation. */ diff --git a/src/packets_cheats.c b/src/packets_cheats.c index 526f0aa9bc..720f7f4377 100644 --- a/src/packets_cheats.c +++ b/src/packets_cheats.c @@ -45,6 +45,7 @@ #include "bflib_math.h" #include "gui_topmsg.h" #include "gui_msgs.h" +#include "frontmenu_ingame_tabs.h" #include "post_inc.h" extern void clear_input(struct Packet* packet); @@ -847,6 +848,26 @@ TbBool process_players_global_cheats_packet_action(PlayerNumber plyr_idx, struct make_available_all_traps(plyr_idx); return false; } + case PckA_CheatGiveDoorTrap: + { + long model; + for (model = 1; model < game.conf.trapdoor_conf.door_types_count - 1; model++) + { + if (is_door_buildable(plyr_idx, model)) + { + set_door_buildable_and_add_to_amount(plyr_idx, model, 1, 1); + } + } + for (model = 1; model < game.conf.trapdoor_conf.trap_types_count - 1; model++) + { + if (is_trap_buildable(plyr_idx, model)) + { + set_trap_buildable_and_add_to_amount(plyr_idx, model, 1, 1); + } + } + update_trap_tab_to_config(); + return false; + } default: return false; } From 4874cd0f96126f570db880241bd484319405d22d Mon Sep 17 00:00:00 2001 From: AdamPlenty <58278560+AdamPlenty@users.noreply.github.com> Date: Fri, 27 Sep 2024 21:41:04 +0100 Subject: [PATCH 3/4] Correct Midas Door string ID --- config/fxdata/terrain.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/fxdata/terrain.cfg b/config/fxdata/terrain.cfg index 212724c016..42f4bdcf6f 100644 --- a/config/fxdata/terrain.cfg +++ b/config/fxdata/terrain.cfg @@ -1036,7 +1036,7 @@ WlbType = 0 [slab58] Name = DOOR_MIDAS -TooltipTextID = 201 +TooltipTextID = 1076 BlockFlagsHeight = 4 BlockHealthIndex = 6 BlockFlags = BLOCKING IS_DOOR @@ -1054,7 +1054,7 @@ WlbType = 0 [slab59] Name = DOOR_MIDAS2 -TooltipTextID = 201 +TooltipTextID = 1076 BlockFlagsHeight = 4 BlockHealthIndex = 6 BlockFlags = BLOCKING IS_DOOR From be8af9a1f16316cf7ba6ba0b4d6768feb4b433c4 Mon Sep 17 00:00:00 2001 From: AdamPlenty <58278560+AdamPlenty@users.noreply.github.com> Date: Sat, 28 Sep 2024 02:37:51 +0100 Subject: [PATCH 4/4] Fixed last door and last trap not being given --- src/packets_cheats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/packets_cheats.c b/src/packets_cheats.c index 720f7f4377..2c5650ebf6 100644 --- a/src/packets_cheats.c +++ b/src/packets_cheats.c @@ -851,14 +851,14 @@ TbBool process_players_global_cheats_packet_action(PlayerNumber plyr_idx, struct case PckA_CheatGiveDoorTrap: { long model; - for (model = 1; model < game.conf.trapdoor_conf.door_types_count - 1; model++) + for (model = 1; model < game.conf.trapdoor_conf.door_types_count; model++) { if (is_door_buildable(plyr_idx, model)) { set_door_buildable_and_add_to_amount(plyr_idx, model, 1, 1); } } - for (model = 1; model < game.conf.trapdoor_conf.trap_types_count - 1; model++) + for (model = 1; model < game.conf.trapdoor_conf.trap_types_count; model++) { if (is_trap_buildable(plyr_idx, model)) {