Skip to content

Commit

Permalink
Fix "Take All" cheat; other tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Oct 8, 2024
1 parent 1ef32d6 commit b4e1caa
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 71 deletions.
4 changes: 4 additions & 0 deletions edge_base/blasphemer/scripts/language.ldf
Original file line number Diff line number Diff line change
Expand Up @@ -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";


Expand Down
2 changes: 2 additions & 0 deletions edge_base/heretic/scripts/language.ldf
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
54 changes: 0 additions & 54 deletions source_files/ddf/ddf_image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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_()
Expand All @@ -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_;
Expand All @@ -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;

Expand Down
13 changes: 1 addition & 12 deletions source_files/ddf/ddf_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -94,9 +86,6 @@ class ImageDefinition
std::string info_; // kImageDataPackage, kImageDataFile, kImageDataLump
LumpImageFormat format_; //

int compose_w_, compose_h_; // kImageDataCompose
std::vector<ComposePatch> patches_; //

ImageSpecial special_;

// offsets for sprites (mainly)
Expand Down
11 changes: 7 additions & 4 deletions source_files/edge/m_cheat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source_files/edge/p_setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, MUSINFOMapping> musinfo_tracks;
static std::unordered_map<std::string, MUSINFOMapping, epi::ContainerStringHash> musinfo_tracks;

static void GetMUSINFOTracksForLevel(void)
{
Expand Down
4 changes: 4 additions & 0 deletions source_files/edge/p_weapon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b4e1caa

Please sign in to comment.