From e7065a0b023b32cd82d32705b141ceff0d48dd67 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Wed, 22 Aug 2018 17:32:03 +0200 Subject: [PATCH] Added `plr_class` enum, moving the define `NUM_CLASSES` into it. --- defs.h | 1 - enums.h | 8 ++++++++ structs.h | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/defs.h b/defs.h index 033d2b162..b0ff24352 100644 --- a/defs.h +++ b/defs.h @@ -28,7 +28,6 @@ #define MDMAXY 40 // todo: enums -#define NUM_CLASSES 3 #define NUM_INVLOC 7 #define NUM_SFX 858 #define NUMLEVELS 17 diff --git a/enums.h b/enums.h index ba5796943..6efa1d81a 100644 --- a/enums.h +++ b/enums.h @@ -2393,6 +2393,14 @@ enum _unique_items UITEM_INVALID = 0x5A, }; +enum plr_class +{ + PC_WARRIOR = 0x0, + PC_ROGUE = 0x1, + PC_SORCERER = 0x2, + NUM_CLASSES +}; + enum _ui_classes { UI_WARRIOR = 0x0, diff --git a/structs.h b/structs.h index b7779b0b1..4ba023b39 100644 --- a/structs.h +++ b/structs.h @@ -839,6 +839,13 @@ struct PlayerStruct char _pLightRad; unsigned char _pLvlChanging; char _pName[32]; + + // plr_class enum value. + // TODO: this could very well be `enum plr_class _pClass` + // since there are 3 bytes of alingment after this field. + // it could just be that the compiler optimized away all accesses to + // the higher bytes by using byte instructions, since all possible values + // of plr_class fit into one byte. char _pClass; int _pStrength; int _pBaseStr;