Just a short note about the state:
I revealed all stuff that has something to do with player0 or player1 and their datapackage, so that a class pointer replaces that ugly es-segment-register and all situations when other registers are temporary used for that purpose. wasn't easy, but did solve in the end. even (hopefully) fixed those few original bugs on the fly.
I want to do this now for the hero/champion-things too.
I already wrote a lot of macro-expressions, which looks nice, but leaves a lot of unrevealed things that also belong to the champions.
But creating classes and pointers for that may end in a desaster!
Two reasons for that:
1. all champion releated things don't work with a segment-register (like for the players), but with offsets only. Because the register that handles this may be used for several other (integer) purposes there is a pointer/integer-type-problem returning the value when the routine ends. (and this happens in hundreds of routines...)
2. three different types for champion-datas, the basic 32 byte-database for the 16 heroes, this 16 byte-database for (still don't know, but assume) the 128 'living' ones, and this one 1 * 16-byte slot for ... (who knows...).
Munky, are you sure that the 16-byte-datas are really in the same meaning and order of the first 16 bytes of the 32-byte-datas? - this would mean that there is no x and y with the champion/monster and only the map keeps track with the index of them... (which would be enough).
However: It's going really critical now.
If I can't solve this pretty clean, any more work is doomed
If I can - we will win!
Here is the current state of my player-class with all revealed and unrevealed things:
class c_player
{
protected:
ui8 mode; // 0
// bit0 = 0: is player0 bit0 = 1: is player1 (for both players presetted by default)
// bit1 = 0: not attacking bit1 = 1: attacking
// bit2 = 0: not sleeping bit2 = 1: sleeping
// bit3 = 0: not defending bit3 = 1: defending
public:
ui8 mousestate; // 1
ui16 mouse_x; // 2
ui16 mouse_y; // 4
ui8 boss; // 6
// replaced ESWORD(6) & 0x0FFu and ESWORD(6) & 0x0F into
// (i16)boss
i8 byte7; // 7 TODO: requested, but no setting found
protected:
ui8 gfx_y; // 8
// the highbyte 9 is never used, ESWORD(8) readonly,
// so I replaced the one appearance into (i16)get_gfx_y
i8 byte9; // 9 fillbyte now
public:
ui16 screenoffset; // 0x0A
i16 option; // 0x0C
// will be the option in BW_mainscreen_clickhandler!
// gets set in BW_csel_find_clickedrectangle, but in another places too
u_bbw word_e; // 0x0E
// 0xE as word, but also 0xE and 0xF as byte
// byte 0xE maybe the boss' formation index
ui8 color; // 0x10
ui8 bytex11; // fillbyte?
ui8 iconmask; // 0x12
ui8 bytex13; // fillbyte?
u_bbw dispmode; // 0x14
i16 word_16; // 0x16
i8 hero[4]; // 0x18...0x1B, there's a special 0x40 mask on them
i8 map_x; // 0x1C
ui8 bytex1D; // fillbyte?
i8 map_y; // 0x1E
ui8 bytex1F; // fillbyte?
i8 facedir; // 0x20
// the highbyte 0x21 is never set, ESWORD(0x20) is readonly,
// so I replaced the two appearances into (i16)es->facedir
ui8 bytex21; // fillbyte
i16 word_22; // 0x22
i16 word_24; // 0x24
ui8 hpos[4]; // 0x26...0x29 hero's position in party formation
i8 byte_2a; // 0x2a
i8 bytex2B; // fillbyte?
u_bbw word_2c; // 0x2C adressed as word and as byte, 0x2D not seen
u_bbw word_2e; // 0x2E adressed as word and as byte, 0x2F not seen
i16 wordx30; // fillword?
i16 wordx32; // fillword?
i8 byte_34; // 0x34
i8 byte_35; // 0x35
i16 wordx36; // fillword?
i16 wordx38; // fillword?
i8 byte_3a; // 0x3a
i8 byte_3b; // 0x3b
i8 byte_3c; // 0x3c
i8 byte_3d; // 0x3d
i8 byte_3e; // 0x3e
i8 byte_3f; // 0x3f
u_bbw word_40; // 0x40
i16 word_42; // 0x42
u_bbw word_44; // 0x44 note: b.lo should be unsigned
i16 word_46; // 0x46
i16 wordx48; // fillword?
i16 texttimecnt; // 0x4A
// set to 0xC8 or 1, counts down in timerroutine depending on
// es->texttimermode
i16 wordx4c; // fillword?
i8 byte_4e; // 0x4e
u_bbw word_4f; // 0x4f - TODO: odd alignment okay?
i8 bytex51; // fillbyte?
i8 texttimermode; // 0x52
// 0, 1 or 0x80u signed
// mode 1 means: count down es->texttimecnt and set to mode 0x80u if
// this one reaches 0.
// sub_1455A sets back to 0 then
i8 byte_53; // 0x53
i8 bytex54; // fillbyte?
i8 byte_55; // 0x55
i8 byte_56; // 0x56
i8 byte_57; // 0x57
i8 floor; // 0x58 from HERO_FLOOR
i8 bytex59; // fillbyte?
i8 byte_5a[4]; // 0x5A...0x5D
i8 byte_5e[4]; // 0x5E...0x61
ui16 word_62; // 0x62
public:
c_player();
// functions on mode:
bool is_player0(void) const { return (mode & 1) == 0; }
bool is_player1(void) const { return (mode & 1) != 0; }
void attack_on(void) { mode |= 2; }
void defend_on(void) { mode |= 8; }
bool is_defending(void) const { return (mode & 8) != 0; }
bool is_battleing(void) const { return (mode & 0x0A) != 0; }
void stop_battleing(void) { mode &= 1; } // also resets sleep mode!
void sleep(void) { mode |= 4; }
bool is_sleeping(void) const { return (mode & 4) != 0; }
void wakeup(void) { mode &= 0xFBu; }
bool is_in_no_special_mode(void) const { return (mode & 0x0FEu) == 0; }
i8 get_index(void) const { return mode & 1; }
ui8 get_index_ascii(void) const { return (mode & 1) + '0'; }
ui8 get_other_index_ascii(void) const { return ((~(mode)) & 1) + '0'; }
ui8 get_gfx_y(void) const { return gfx_y; }
void set_gfx_y(ui8 n) { gfx_y = n; }
};