Skip to content

Commit

Permalink
Should work now hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
monster860 committed Oct 20, 2022
1 parent 8891ca3 commit 586660e
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 46 deletions.
4 changes: 2 additions & 2 deletions src/core/byond_functions.inl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

F(String*, , GetStringTableEntry, int stringId)
F(void, , SetTurfAppearance, int appearance, int turf)
F(void, , SetAppearance, Value atom, int appearance)
F(void, REGPARM3, SetAppearance, Value atom, int appearance)
F(void, , SpliceString, unsigned int id)
F(void, , SetPixelX, Value atom, short pixel_x)
F(void, , SetPixelY, Value atom, short pixel_y)
Expand All @@ -29,7 +29,7 @@ F(void, REGPARM2, Output, Value target, Value unk, Value thing)
F(void*, , GetVisContents, Value thing, bool modify)
F(bool, , AddToScreen, Value thing, unsigned short client)
F(void, , RemoveFromScreen, Value thing, unsigned short client)
F(void, , SendMapsClient, unsigned short client)
F(void, REGPARM3, SendMapsClient, unsigned short client)

#ifdef _WIN32
F(void, _fastcall, SpliceAppearance, void* this_, int edx, int appearance) // it's actually __thiscall but c++ compilers are stupid
Expand Down
55 changes: 42 additions & 13 deletions src/core/byond_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ struct TableHolder2
unsigned int length;
};

template<class T>
template<class T, class S = unsigned int>
struct RefTable
{
RefTable(T*** e, unsigned int* l) : elements(*e), length(*l) {}
RefTable(T*** e, S* l) : elements(*e), length(*l) {}
RefTable(TableHolder2* th) : elements(*(T***)&th->elements), length(th->length) {}
RefTable(void* base, int elements_offset, int length_offset) : elements(**(T****)((int)base+elements_offset)), length(**(unsigned int**)((int)base + length_offset)) {}
RefTable(void* base, int elements_offset, int length_offset) : elements(**(T****)((int)base+elements_offset)), length(**(S**)((int)base + length_offset)) {}
RefTable() : elements(dummy_elements), length(dummy_length) {}
T**& elements;
unsigned int& length;
T *GetItem(unsigned int id) {
S& length;
T *GetItem(S id) {
if (id < this->length) {
return this->elements[id];
}
return nullptr;
}
private:
T** dummy_elements = nullptr;
unsigned int dummy_length = 0;
S dummy_length = 0;
};

struct TableHolder3
Expand All @@ -84,7 +84,11 @@ struct VarListEntry
struct Client {
unsigned char unk_0[0x4];
int address;
#ifdef _WIN32
unsigned char unk_8[0x64];
#else
unsigned char unk_8[0x44];
#endif
int key;
int ckey;
unsigned char unk_74[4];
Expand Down Expand Up @@ -187,7 +191,11 @@ struct Mob
int appearance; // 64
int appearance2; // 68
int appearance3; // 6c
#ifdef _WIN32
char unknown5[0x4C]; // 70
#else
char unknown5[0x48];
#endif
void* unknown_list3; // bc
unsigned short client; // c0
unsigned short unknown6;
Expand Down Expand Up @@ -233,19 +241,37 @@ struct TurfSharedInfo {
int unk_1c;
};

struct TurfTableHolder {
int* shared_info_id_table;
unsigned char* existence_table;
#ifdef _WIN32
struct WorldSizeHolder {
int turf_count;
unsigned short maxx;
unsigned short gap1;
unsigned short maxy;
unsigned short gap2;
unsigned short maxz;
};
#else
struct WorldSizeHolder {
int turf_count;
int maxx;
int maxy;
int maxz;
int gap;
unsigned short maxx;
unsigned short maxy;
unsigned short maxz;
};
#endif

#ifdef _WIN32
struct TurfHashtableHolder {
Turf** elements;
int size;
int mask;
unsigned short mask;
};
#else
struct TurfHashtableHolder {
unsigned short mask;
Turf** elements;
};
#endif

enum class AppearanceRbtColor : bool
{
Expand Down Expand Up @@ -290,6 +316,7 @@ struct Appearance
unsigned long long unk_4a_8 : 2;

unsigned long long appearance_flags : 12;
unsigned long long other_bits : 31;

unsigned char dir; // 50
unsigned char invisibility;
Expand Down Expand Up @@ -349,7 +376,9 @@ struct Appearance
int unk_d0;
int unk_d4;
int unk_d8;
#ifdef _WIN32
int unk_dc;
#endif
float *color_matrix; // e0
int refcount; // e4
};
Expand Down
10 changes: 7 additions & 3 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ std::unique_ptr<RefTable<Datum>> Core::datum_table;
//TableHolder2* Core::list_table = nullptr;
std::unique_ptr<RefTable<Mob>> Core::mob_table;
std::unique_ptr<RefTable<ImageOverlay>> Core::image_table;
std::unique_ptr<RefTable<Client>> Core::client_table;
std::unique_ptr<RefTable<Client, unsigned short>> Core::client_table;
TableHolder2* Core::appearance_list_table = nullptr;
AppearanceTable** Core::appearance_table = nullptr;
TurfTableHolder* Core::turf_table = nullptr;
TurfHashtableHolder* Core::turf_hashtable = nullptr;

int** Core::turf_table = nullptr;
Turf*** Core::turf_hashtable = nullptr;
unsigned short* Core::turf_hashtable_mask = nullptr;
unsigned char** Core::turf_existence_table = nullptr;
TurfSharedInfo*** Core::turf_shared_info_table = nullptr;
WorldSizeHolder* Core::world_size = nullptr;

void Core::Alert(const std::string& what) {
#ifdef _WIN32
Expand Down
10 changes: 7 additions & 3 deletions src/core/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ namespace Core {
extern std::unique_ptr<RefTable<Obj>> obj_table;
extern std::unique_ptr<RefTable<Datum>> datum_table;
//extern TableHolder2* list_table; //list list honk
extern std::unique_ptr<RefTable<Client>> client_table;
extern std::unique_ptr<RefTable<Client, unsigned short>> client_table;
extern std::unique_ptr<RefTable<Mob>> mob_table;
extern std::unique_ptr<RefTable<ImageOverlay>> image_table;
extern TableHolder2* appearance_list_table;
extern AppearanceTable** appearance_table;
extern TurfTableHolder* turf_table;
extern TurfHashtableHolder* turf_hashtable;

extern int** turf_table;
extern Turf*** turf_hashtable;
extern unsigned short* turf_hashtable_mask;
extern unsigned char** turf_existence_table;
extern TurfSharedInfo*** turf_shared_info_table;
extern WorldSizeHolder* world_size;
}
32 changes: 20 additions & 12 deletions src/core/find_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool Core::find_functions()
void* del_datum_ptr = Pocket::Sigscan::FindPattern(BYONDCORE, "?? ?? ?? ?? 73 55 A1 ?? ?? ?? ?? 8B 04 88 85 C0 74 49 8B 50 18 81 FA 00 00 00 70");
TRUE_OR_DIE(del_datum_ptr);
datum_table = std::make_unique<RefTable<Datum>>((void*)del_datum_ptr, 7, 0);
client_table = std::make_unique<RefTable<Client>>((void*)AddToScreen, 21, 11);
client_table = std::make_unique<RefTable<Client, unsigned short>>((void*)AddToScreen, 21, 11);
image_table = std::make_unique<RefTable<ImageOverlay>>((void*)GetVisContents, 0x86, 0x7F);
appearance_table = *(AppearanceTable***)Pocket::Sigscan::FindPattern(BYONDCORE, "55 8b ec a1 ?? ?? ?? ?? 8b 4d 08 3b 48 44 73 08 8b 40 40 8b 04 88 5d c3", 4);
void* get_id_list_ptr = Pocket::Sigscan::FindPattern(BYONDCORE, "55 8b ec 83 ec 0c 53 56 57 ff 75 08 e8 ?? ?? ?? ?? 83 c4 04 85 c0", 13);
Expand All @@ -70,9 +70,12 @@ bool Core::find_functions()
appearance_list_table = *(TableHolder2**)((int)get_id_list + 19);
char* get_shared_turf_ptr = (char*)Pocket::Sigscan::FindPattern(BYONDCORE, "55 8b ec 8b 4d 08 3b 0d ?? ?? ?? ?? 73 12 a1 ?? ?? ?? ?? 8b 0c 88 a1 ?? ?? ?? ?? 8b 04 88 5d c3 33 c0 5d c3");
TRUE_OR_DIE(get_shared_turf_ptr)
turf_table = *(TurfTableHolder**)(get_shared_turf_ptr + 15);
turf_table = *(int***)(get_shared_turf_ptr + 15);
turf_existence_table = ((int)turf_table + 4);
world_size = (WorldSizeHolder*)((int)turf_table + 8);
turf_shared_info_table = *(TurfSharedInfo****)(get_shared_turf_ptr + 23);
turf_hashtable = *(TurfHashtableHolder**)Pocket::Sigscan::FindPattern(BYONDCORE, "55 8b ec a1 ?? ?? ?? ?? 8b 55 08 23 c2 0f b7 c8 a1 ?? ?? ?? ??", 17);
turf_hashtable = *(Turf****)Pocket::Sigscan::FindPattern(BYONDCORE, "55 8b ec a1 ?? ?? ?? ?? 8b 55 08 23 c2 0f b7 c8 a1 ?? ?? ?? ??", 17);
turf_hashtable_mask = (int)(turf_hashtable + 8);
TRUE_OR_DIE(turf_hashtable);
#else
FIND_OR_DIE(GetStringTableEntry, "55 89 E5 83 EC 18 8B 45 ?? 39 05 ?? ?? ?? ?? 76 ?? 8B 15 ?? ?? ?? ?? 8B 04 ??");
Expand All @@ -84,8 +87,8 @@ bool Core::find_functions()
FIND_OR_DIE(SetAppearance, "55 89 e5 83 ec 38 3c 54 89 5d f4 89 cb");
FIND_OR_DIE(SetPixelX, "55 89 e5 57 56 53 81 ec 4c 01 00 00 8b 75 08 8b 5d 0c 0f b7 7d 10");
FIND_OR_DIE(SetPixelY, "55 89 e5 57 56 53 81 ec 6c 01 00 00 8b 75 08 8b 5d 0c 0f b7 7d 10");
FIND_OR_DIE(SetPixelW, "55 89 e5 81 ec 38 01 00 00 89 7d fc 8b 7d 08 89 5d f4 0f b7 5d 10 89 75 f8 8b 75 0c 89 f8 3c 03 0f 84 d2 01 00 00 3c 02 0f 84 f2 00 00 00 89 3c 24 89 74 24 04 e8 ?? ?? ?? ?? 8b 15 d8 a9 67 00 89 85 f0 fe ff ff 8b 8d f0 fe ff ff 31 c0 3b 4a 44 0f 82 b9 01 00 00 8d 8d 04 ff ff ff 89 44 24 04 89 0c 24 e8 ?? ?? ?? ?? 89 d8 66 2b 85 5c ff ff ff");
FIND_OR_DIE(SetPixelZ, "55 89 e5 81 ec 38 01 00 00 89 7d fc 8b 7d 08 89 5d f4 0f b7 5d 10 89 75 f8 8b 75 0c 89 f8 3c 03 0f 84 d2 01 00 00 3c 02 0f 84 f2 00 00 00 89 3c 24 89 74 24 04 e8 ?? ?? ?? ?? 8b 15 d8 a9 67 00 89 85 f0 fe ff ff 8b 8d f0 fe ff ff 31 c0 3b 4a 44 0f 82 b9 01 00 00 8d 8d 04 ff ff ff 89 44 24 04 89 0c 24 e8 ?? ?? ?? ?? 89 d8 66 2b 85 5e ff ff ff");
FIND_OR_DIE(SetPixelW, "55 89 e5 81 ec 38 01 00 00 89 7d fc 8b 7d 08 89 5d f4 0f b7 5d 10 89 75 f8 8b 75 0c 89 f8 3c 03 0f 84 d2 01 00 00 3c 02 0f 84 f2 00 00 00 89 3c 24 89 74 24 04 e8 ?? ?? ?? ?? 8b 15 ?? ?? ?? ?? 89 85 f0 fe ff ff 8b 8d f0 fe ff ff 31 c0 3b 4a 44 0f 82 b9 01 00 00 8d 8d 04 ff ff ff 89 44 24 04 89 0c 24 e8 ?? ?? ?? ?? 89 d8 66 2b 85 5c ff ff ff");
FIND_OR_DIE(SetPixelZ, "55 89 e5 81 ec 38 01 00 00 89 7d fc 8b 7d 08 89 5d f4 0f b7 5d 10 89 75 f8 8b 75 0c 89 f8 3c 03 0f 84 d2 01 00 00 3c 02 0f 84 f2 00 00 00 89 3c 24 89 74 24 04 e8 ?? ?? ?? ?? 8b 15 ?? ?? ?? ?? 89 85 f0 fe ff ff 8b 8d f0 fe ff ff 31 c0 3b 4a 44 0f 82 b9 01 00 00 8d 8d 04 ff ff ff 89 44 24 04 89 0c 24 e8 ?? ?? ?? ?? 89 d8 66 2b 85 5e ff ff ff");
FIND_OR_DIE(SetMovableDir, "55 89 e5 81 ec 38 01 00 00 8b 45 08 89 75 f8 0f b6 55 10 89 7d fc 8b 7d 0c 89 5d f4 3c 03 89 c6 89 85 f4 fe ff ff");
FIND_OR_DIE(SetLoc, "55 89 e5 83 ec 38 89 5d f4 8b 45 0c 89 75 f8 8b 5d 10 8b 75 14 89 7d fc 0f b6 7d 08 89 45 e4 89 1c 24 89 74 24 04");
FIND_OR_DIE(SpliceAppearance, "55 89 e5 83 ec 18 89 5d f8 8b 5d 08 89 75 fc 8b 75 0c 8b 4b 38 89 f0 d3 e8 3b 43 28 89 c1");
Expand All @@ -94,7 +97,7 @@ bool Core::find_functions()
FIND_OR_DIE(Output, "55 89 e5 81 ec 98 01 00 00 89 5d f4 89 c3 8b 45 0c 80 fb 23 8b 4d 08 89 75 f8 8b 75 10 89 7d fc 8b 7d 14 89 95 94 fe ff ff 89 85 a4 fe ff ff");
FIND_OR_DIE(GetVisContents, "55 89 e5 83 ec 08 8b 55 08 8b 45 0c 0f b6 4d 10 80 fa 54 76 0b 31 c0 c9 c3");
FIND_OR_DIE(AddToScreen, "55 89 e5 83 ec 48 89 75 f8 0f b7 45 10 8b 75 08 66 3b 05 ?? ?? ?? ?? 89 7d fc 8b 7d 0c 89 5d f4 89 f2");
FIND_OR_DIE(RemoveFromScreen, "55 89 e5 53 83 ec 14 0f b7 45 10 66 3b 05 38 a9 67 00");
FIND_OR_DIE(RemoveFromScreen, "55 89 e5 53 83 ec 14 0f b7 45 10 66 3b 05 ?? ?? ?? ??");
FIND_OR_DIE(DelFilter, "55 89 e5 83 ec 18 89 5d f8 8b 5d 08 89 75 fc 8b 75 0c 8b 4b 6c 89 f0 d3 e8 3b 43 5c 89 c1");
FIND_OR_DIE(SendMapsClient, "55 0f b7 c0 89 e5 57 56 53 81 ec ?? ?? ?? ?? 89 04 24 89 85 ?? ?? ?? ?? e8 ?? ?? ?? ?? 85 c0 89 45 84 0f");
FIND_OR_DIE(CreateObj, "55 89 e5 57 56 53 83 ec 4c a1 ?? ?? ?? ?? 8b 7d 10 85 c0 0f 84 ?? ?? ?? ??");
Expand All @@ -104,7 +107,7 @@ bool Core::find_functions()
void* datum_table_ptr = Pocket::Sigscan::FindPattern(BYONDCORE, "55 89 E5 53 83 EC 44 8B 45 08 3B 05 ?? ?? ?? ?? 73 2C 8B 15 ?? ?? ?? ?? 8B 0C 82 85 C9 74 1F 8B 51 ??");
TRUE_OR_DIE(datum_table_ptr);
datum_table = std::make_unique<RefTable<Datum>>(datum_table_ptr, 20, 12);
client_table = std::make_unique<RefTable<Client>>((void*)AddToScreen, 0x26, 0x13);
client_table = std::make_unique<RefTable<Client, unsigned short>>((void*)AddToScreen, 0x26, 0x13);
obj_table = std::make_unique<RefTable<Obj>>((void*)GetVisContents, 0x7a, 0x72);
mob_table = std::make_unique<RefTable<Mob>>((void*)GetVisContents, 0x5a, 0x52);
image_table = std::make_unique<RefTable<ImageOverlay>>((void*)GetVisContents, 0x3a, 0x32);
Expand All @@ -115,14 +118,19 @@ bool Core::find_functions()
TRUE_OR_DIE(appearance_list_ptr);
appearance_list_table = *(TableHolder2**)appearance_list_ptr;

turf_table = *(TurfTableHolder**)((int)ChangeTurf + 0x32);
turf_shared_info_table = *(TurfSharedInfo****)((int)ChangeTurf + 0x2a);
turf_hashtable = *(TurfHashtableHolder**)((int)GetVisContents + 0xb9);
turf_table = *(int***)((int)ChangeTurf + 0x2a);
world_size = *(WorldSizeHolder**)((int)ChangeTurf + 0x22);
turf_shared_info_table = *(TurfSharedInfo****)((int)ChangeTurf + 0x32);
turf_hashtable = *(Turf****)((int)GetVisContents + 0xb9);
turf_hashtable_mask = *(unsigned short**)((int)GetVisContents + 0xb3);
turf_existence_table = *(unsigned char***)((int)GetVisContents + 0xa2);

// i love inlining i love inlining
animate_start_call = (unsigned int*)Pocket::Sigscan::FindPattern(BYONDCORE, "e8 ?? ?? ?? ?? 8b b5 ?? ?? ?? ?? 8b bd ?? ?? ?? ?? 89 34 24 89 7c 24 04 e8 ?? ?? ?? ?? 89 c7 31 f6 8d 85 ?? ?? ?? ??", 1);
animate_start_call = (unsigned int*)Pocket::Sigscan::FindPattern(BYONDCORE, "e8 ?? ?? ?? ?? 8b b5 ?? ?? ?? ?? 8b bd ?? ?? ?? ?? 89 34 24 89 7c 24 04 e8 ?? ?? ?? ?? 89 c7 31 f6 8d 85 ?? ?? ?? ??", 1);
TRUE_OR_DIE(animate_start_call);
AnimateStartFun = (AnimateStartFunPtr)RELATIVE_CALL_RESOLVE(animate_start_call);
animate_end_jump = (unsigned int*)Pocket::Sigscan::FindPattern(BYONDCORE, "89 7c 24 04 e8 ?? ?? ?? ?? a1 ?? ?? ?? ?? 8b 0d ?? ?? ?? ?? 8b 1d ?? ?? ?? ?? 0f b7 50 42 8b 78 3c 0f b7 f2 83 c2 01 89 0c f7 89 5c f7 04 66 89 50 42 a1 ?? ?? ?? ?? 0f b7 50 42 8b 40 3c 8d 54 d0 f8 8b 02 8b 52 04 89 04 24 89 54 24 04 e8 ?? ?? ?? ?? 8b 3d ?? ?? ?? ?? e9 ?? ?? ?? ?? ", 90);
animate_end_jump = (unsigned int*)Pocket::Sigscan::FindPattern(BYONDCORE, "89 7c 24 04 e8 ?? ?? ?? ?? a1 ?? ?? ?? ?? 8b 0d ?? ?? ?? ?? 8b 1d ?? ?? ?? ?? 0f b7 50 42 8b 78 3c 0f b7 f2 83 c2 01 89 0c f7 89 5c f7 04 66 89 50 42 a1 ?? ?? ?? ?? 0f b7 50 42 8b 40 3c 8d 54 d0 f8 8b 02 8b 52 04 89 04 24 89 54 24 04 e8 ?? ?? ?? ?? 8b 3d ?? ?? ?? ?? e9 ?? ?? ?? ??", 90);
TRUE_OR_DIE(animate_end_jump);
original_animate_end_jump = (unsigned int)RELATIVE_CALL_RESOLVE(animate_end_jump);

#endif
Expand Down
2 changes: 2 additions & 0 deletions src/core/subhook/subhook_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ static int subhook_disasm(void *src, int *reloc_op_offset) {
uint8_t opcode = 0;
int found_opcode = false;

if(code[0] == 0x0f && code[1] == 0xb7 && code[2] == 0xc0) return 3;

for (i = 0; i < sizeof(prefixes) / sizeof(*prefixes); i++) {
if (code[len] == prefixes[i]) {
len++;
Expand Down
4 changes: 2 additions & 2 deletions src/demo_writer/demo_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ HOOK_DEF(void, SetLoc)(Value atom, Value loc) {
oSetLoc(atom, loc);
}

HOOK_DEF(void, SetAppearance)(Value atom, int appearance) {
HOOK_DEF(void REGPARM3, SetAppearance)(Value atom, int appearance) {
oSetAppearance(atom, appearance);
mark_atom_dirty(atom);
}
Expand Down Expand Up @@ -123,7 +123,7 @@ HOOK_DEF(void, RemoveFromScreen)(Value thing, unsigned short client) {
update_client_screen(client);
oRemoveFromScreen(thing, client);
}
HOOK_DEF(void, SendMapsClient)(unsigned short client) {
HOOK_DEF(void REGPARM3, SendMapsClient)(unsigned short client) {
Client *clientobj = Core::client_table->GetItem(client);
if (clientobj && clientobj->update_flags & 8) {
update_client_screen(client);
Expand Down
20 changes: 17 additions & 3 deletions src/demo_writer/write_animate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,23 @@ void pre_animate_hook(void *some_struct, Value args) {
DecRefCount(animate_args);
animate_args = args;
IncRefCount(animate_args);
DecRefCount(last_animate_appearance);
last_animate_appearance = GetVariable(last_animate_obj, 0x106);
IncRefCount(last_animate_appearance);

Value len_value = GetVariable(animate_args, 0x39);
int len = len_value.valuef;
Value firstArg = { NULL_D, {0} };
if (len) firstArg = Core::DecReturn(GetAssocElement(animate_args, ValueFloat(1.0f)));
Value animate_obj;
if (firstArg.type == MOB || firstArg.type == OBJ || firstArg.type == TURF || firstArg.type == IMAGE) {
animate_obj = firstArg;
} else {
animate_obj = last_animate_obj;
}

if(animate_obj.type) {
DecRefCount(last_animate_appearance);
last_animate_appearance = GetVariable(animate_obj, 0x106);
IncRefCount(last_animate_appearance);
}
AnimateStartFun(some_struct, args);
}
#endif
Expand Down
10 changes: 5 additions & 5 deletions src/demo_writer/write_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class AtomUpdateBuffer {

template<>
inline int AtomUpdateBuffer<Turf, 0x2, false, false, false>::get_table_length() {
return Core::turf_table->turf_count;
return Core::world_size->turf_count;
}
template<>
inline int AtomUpdateBuffer<Obj, 0x3, true, true, false>::get_table_length() {
Expand All @@ -302,10 +302,10 @@ inline int AtomUpdateBuffer<ImageOverlay, 0x5, true, false, false>::get_table_le
}
template<>
inline Turf *AtomUpdateBuffer<Turf, 0x2, false, false, false>::get_element(int id) {
if (id < Core::turf_table->turf_count || Core::turf_table->existence_table[id] == 0) {
if (id >= Core::world_size->turf_count || (*Core::turf_existence_table)[id] == 0) {
return nullptr;
}
Turf* ref = Core::turf_hashtable->elements[id & Core::turf_hashtable->mask];
Turf* ref = (*Core::turf_hashtable)[id & *Core::turf_hashtable_mask];
while (ref && ref->id != id) {
ref = ref->next;
}
Expand All @@ -325,8 +325,8 @@ inline ImageOverlay* AtomUpdateBuffer<ImageOverlay, 0x5, true, false, false>::ge
}
template<>
inline int AtomUpdateBuffer<Turf, 0x2, false, false, false>::get_appearance(Turf* turf, int id) {
if (id >= Core::turf_table->turf_count) return 0xFFFF;
int shared_id = Core::turf_table->shared_info_id_table[id];
if (id >= Core::world_size->turf_count) return 0xFFFF;
int shared_id = (*Core::turf_table)[id];
return (*Core::turf_shared_info_table)[shared_id]->appearance;
}
template<>
Expand Down
6 changes: 3 additions & 3 deletions src/demo_writer/write_primitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ void write_world_size() {
struct {
char chunk_id = 1;
char chunk_length = 0x6;
short maxx = Core::turf_table->maxx;
short maxy = Core::turf_table->maxy;
short maxz = Core::turf_table->maxz;
short maxx = Core::world_size->maxx;
short maxy = Core::world_size->maxy;
short maxz = Core::world_size->maxz;
} data;
demo_file_handle.write((char*)&data, sizeof(data));
}

0 comments on commit 586660e

Please sign in to comment.