From b4e1caa669c0f715acfedcd681f51e0dddeecc7e Mon Sep 17 00:00:00 2001 From: dashodanger Date: Mon, 7 Oct 2024 23:53:06 -0600 Subject: [PATCH] Fix "Take All" cheat; other tweaks --- edge_base/blasphemer/scripts/language.ldf | 4 ++ edge_base/heretic/scripts/language.ldf | 2 + source_files/ddf/ddf_image.cc | 54 ----------------------- source_files/ddf/ddf_image.h | 13 +----- source_files/edge/m_cheat.cc | 11 +++-- source_files/edge/p_setup.cc | 2 +- source_files/edge/p_weapon.cc | 4 ++ 7 files changed, 19 insertions(+), 71 deletions(-) diff --git a/edge_base/blasphemer/scripts/language.ldf b/edge_base/blasphemer/scripts/language.ldf index d491e0082..0f065a9d6 100644 --- a/edge_base/blasphemer/scripts/language.ldf +++ b/edge_base/blasphemer/scripts/language.ldf @@ -140,10 +140,14 @@ idclip="kitty"; idclev="engage"; idkillall="massacre"; idsuicide="iddqd"; +idtakeall="idkfa"; GodModeON="God Mode On"; GodModeOFF="God Mode Off"; +SuicideCheat="Trying to cheat, eh? Now you die!"; +StuffRemoval="Cheater - You don't deserve weapons"; + ENDOOMOnQuit="Show ENDTEXT on Quit"; diff --git a/edge_base/heretic/scripts/language.ldf b/edge_base/heretic/scripts/language.ldf index 6f7513b71..7e61ca934 100644 --- a/edge_base/heretic/scripts/language.ldf +++ b/edge_base/heretic/scripts/language.ldf @@ -236,8 +236,10 @@ idclip="kitty"; idclev="engage"; idkillall="massacre"; idsuicide="iddqd"; +idtakeall="idkfa"; SuicideCheat="Trying to cheat, eh? Now you die!"; +StuffRemoval="Cheater - You don't deserve weapons"; ENDOOMOnQuit="Show ENDTEXT on Quit"; diff --git a/source_files/ddf/ddf_image.cc b/source_files/ddf/ddf_image.cc index 407fd84d3..3d9f3ecff 100644 --- a/source_files/ddf/ddf_image.cc +++ b/source_files/ddf/ddf_image.cc @@ -32,7 +32,6 @@ static ImageDefinition *dynamic_image; static void DDFImageGetType(const char *info, void *storage); static void DDFImageGetSpecial(const char *info, void *storage); static void DDFImageGetFixTrans(const char *info, void *storage); -static void DDFImageGetPatches(const char *info, void *storage); // -ACB- 1998/08/10 Use DDFMainGetLumpName for getting the..lump name. // -KM- 1998/09/27 Use DDFMainGetTime for getting tics @@ -41,7 +40,6 @@ static ImageDefinition dummy_image; static const DDFCommandList image_commands[] = { DDF_FIELD("IMAGE_DATA", dummy_image, type_, DDFImageGetType), - DDF_FIELD("PATCHES", dummy_image, patches_, DDFImageGetPatches), DDF_FIELD("SPECIAL", dummy_image, special_, DDFImageGetSpecial), DDF_FIELD("X_OFFSET", dummy_image, x_offset_, DDFMainGetFloat), DDF_FIELD("Y_OFFSET", dummy_image, y_offset_, DDFMainGetFloat), @@ -143,10 +141,6 @@ static void ImageParseField(const char *field, const char *contents, int index, LogDebug("IMAGE_PARSE: %s = %s;\n", field, contents); #endif - // ensure previous patches are cleared when beginning a new set - if (DDFCompareName(field, "PATCHES") == 0 && index == 0) - dynamic_image->patches_.clear(); - if (DDFMainParseField(image_commands, field, contents, (uint8_t *)dynamic_image)) return; // OK @@ -261,20 +255,6 @@ static void ImageParseLump(const char *spec) } } -static void ImageParseCompose(const char *info) -{ - const char *colon = DDFMainDecodeList(info, ':', true); - - if (colon == nullptr || colon == info || colon[1] == 0) - DDFError("Malformed image compose spec: %s\n", info); - - dynamic_image->compose_w_ = atoi(info); - dynamic_image->compose_h_ = atoi(colon + 1); - - if (dynamic_image->compose_w_ <= 0 || dynamic_image->compose_h_ <= 0) - DDFError("Illegal image compose size: %d x %d\n", dynamic_image->compose_w_, dynamic_image->compose_h_); -} - static void DDFImageGetType(const char *info, void *storage) { const char *colon = DDFMainDecodeList(info, ':', true); @@ -313,11 +293,6 @@ static void DDFImageGetType(const char *info, void *storage) dynamic_image->type_ = kImageDataPackage; ImageParseInfo(colon + 1); } - else if (DDFCompareName(keyword, "COMPOSE") == 0) - { - dynamic_image->type_ = kImageDataCompose; - ImageParseCompose(colon + 1); - } else DDFError("Unknown image type: %s\n", keyword); } @@ -368,28 +343,6 @@ static void DDFImageGetFixTrans(const char *info, void *storage) DDFError("Unknown FIX_TRANS type: %s\n", info); } -static void DDFImageGetPatches(const char *info, void *storage) -{ - // the syntax is: `NAME : XOFFSET : YOFFSET`. - // in the future we may accept more stuff at the end. - - const char *colon1 = DDFMainDecodeList(info, ':', true); - if (colon1 == nullptr || colon1 == info || colon1[1] == 0) - DDFError("Malformed patch spec: %s\n", info); - - const char *colon2 = DDFMainDecodeList(colon1 + 1, ':', true); - if (colon2 == nullptr || colon2 == colon1 + 1 || colon2[1] == 0) - DDFError("Malformed patch spec: %s\n", info); - - ComposePatch patch; - - patch.name = std::string(info, (int)(colon1 - info)); - patch.x = atoi(colon1 + 1); - patch.y = atoi(colon2 + 1); - - dynamic_image->patches_.push_back(patch); -} - // ---> imagedef_c class ImageDefinition::ImageDefinition() : name_(), belong_(kImageNamespaceGraphic), info_() @@ -407,10 +360,6 @@ void ImageDefinition::CopyDetail(const ImageDefinition &src) info_ = src.info_; format_ = src.format_; - compose_w_ = src.compose_w_; - compose_h_ = src.compose_h_; - patches_ = src.patches_; - special_ = src.special_; x_offset_ = src.x_offset_; y_offset_ = src.y_offset_; @@ -432,9 +381,6 @@ void ImageDefinition::Default() colour_ = SG_BLACK_RGBA32; format_ = kLumpImageFormatStandard; - compose_w_ = compose_h_ = 0; - patches_.clear(); - special_ = kImageSpecialNone; x_offset_ = y_offset_ = 0; diff --git a/source_files/ddf/ddf_image.h b/source_files/ddf/ddf_image.h index c9576d08e..29903fe53 100644 --- a/source_files/ddf/ddf_image.h +++ b/source_files/ddf/ddf_image.h @@ -37,8 +37,7 @@ enum ImageDataType kImageDataColor = 0, // solid colour kImageDataFile, // load from an image file kImageDataLump, // load from lump in a WAD - kImageDataPackage, // load from an EPK package - kImageDataCompose // compose from patches + kImageDataPackage // load from an EPK package }; enum ImageSpecial @@ -67,13 +66,6 @@ enum LumpImageFormat kLumpImageFormatDoom = 1, // the DOOM "patch" format (in a wad lump) }; -struct ComposePatch -{ - std::string name; - int x = 0; - int y = 0; -}; - class ImageDefinition { public: @@ -94,9 +86,6 @@ class ImageDefinition std::string info_; // kImageDataPackage, kImageDataFile, kImageDataLump LumpImageFormat format_; // - int compose_w_, compose_h_; // kImageDataCompose - std::vector patches_; // - ImageSpecial special_; // offsets for sprites (mainly) diff --git a/source_files/edge/m_cheat.cc b/source_files/edge/m_cheat.cc index f8c994c9c..6cfb35b5d 100644 --- a/source_files/edge/m_cheat.cc +++ b/source_files/edge/m_cheat.cc @@ -288,15 +288,18 @@ bool CheatResponder(InputEvent *ev) ImportantConsoleMessageLDF("LoadedCheat"); } -#if 0 // FIXME: this crashes ? else if (CheckCheatSequence(&cheat_take_all, key)) { - P_GiveInitialBenefits(pl, pl->map_object_->info_); - + for (WeaponDefinition *weap : weapondefs) + { + RemoveWeapon(pl, weap); + } + GiveInitialBenefits(pl, pl->map_object_->info_); + pl->ready_weapon_ = KWeaponSelectionNone; + SelectNewWeapon(pl, -100, kAmmunitionTypeDontCare); // -ACB- 1998/08/26 Stuff removed language reference ConsoleMessageLDF("StuffRemoval"); } -#endif else if (CheckCheatSequence(&cheat_suicide, key)) { TelefragMapObject(pl->map_object_, pl->map_object_, nullptr); diff --git a/source_files/edge/p_setup.cc b/source_files/edge/p_setup.cc index 779dbbbe0..48fc254f3 100644 --- a/source_files/edge/p_setup.cc +++ b/source_files/edge/p_setup.cc @@ -132,7 +132,7 @@ struct MUSINFOMapping // This is wonky, but essentially the idea is to not continually create // duplicate RTS music changing scripts for the same level if warping back and // forth, or using a hub or somesuch that happens to have music changers -static std::unordered_map musinfo_tracks; +static std::unordered_map musinfo_tracks; static void GetMUSINFOTracksForLevel(void) { diff --git a/source_files/edge/p_weapon.cc b/source_files/edge/p_weapon.cc index 2db72026b..437741621 100644 --- a/source_files/edge/p_weapon.cc +++ b/source_files/edge/p_weapon.cc @@ -1363,6 +1363,10 @@ void A_Lower(MapObject *mo) WeaponDefinition *info = p->weapons_[p->ready_weapon_].info; + // This *should* only happen with the 'idtakeall' cheat - Dasho + if (!info) + return; + if (p->zoom_field_of_view_ > 0) p->zoom_field_of_view_ = 0;