* Clean up town_draw_town_all
* Clean up town_draw_e_flag
* Clean up InitPlayerLoc
* Fix VS 2015 builds
* Clean up gendung_get_dpiece_num_from_coord
* Clean up town_draw_clipped_e_flag
* Clean up town_draw_clipped_e_flag_2
* Remove HIDWORD() as it is now unused
* Reorder lib
This is the orhter that they appear in the exe imports
* Make includes C compatible
cursor.h: SetCursor conflicts with existing function
engine.h: CelDecDatLightEntry and Cel2DecDatLightEntry use by reference
*&
objects.h: DeleteObject conflicts with existing function
* Start compiling select files as C
* Clean up
pfile still emits warnings when parsed as C:
err:msvcrt:demangle_datatype Unknown type @
err:msvcrt:demangle_datatype Unknown type @
Pretty close to the original binary except for the first loop, which generates differently. (TODO comment added) There are also some questionable double address calculations, which hopfully clear up when the loop is fixed as well.
Also added enums `inv_body_loc` and `inv_xy_slot` to clean up a lot of magic numbers.
This is now as close as it gets without switching to enum types/parameters everywhere, so the compiler can optimize all accesses/checks accordingly. This is especially noticeable in the way the code for the switch is generated (line 775). In the original binary you can see it does weird stuff if c is not one of the classes' enum value (probably due to optimization since the switch should be exhaustive).
I've tried switching the type of c to _ui_classes, also removing the UI_NUM_CLASSES value to see if that'd be enough to let it generate the optimized code, but nope, seems like we need to change it all at once. Currently, _pClass is a char, but an enum value would fit there as well, size-wise (alignment).
That's also why I'm guessing there had to be another enum for player classes, without the UI_NUM_CLASSES value...
Now Golem works on Linux as well.
---
Source/../defs.h: In function ‘void memset32(void*, unsigned int, size_t)’:
Source/../defs.h:35:8: error: expected ‘(’ before ‘{’ token
__asm {
^
Source/../defs.h:36:3: error: ‘mov’ was not declared in this scope
mov ecx, n
---
Source/../3rdParty/Storm/Source/storm.h:1300:15: error: conflicting declaration of C function ‘int SNetGetProviderCaps(_SNETCAPS*)’
int __stdcall SNetGetProviderCaps(struct _SNETCAPS *);
---
Source/../3rdParty/Storm/Source/storm.h:1297:18: error: conflicting declaration of C function ‘void* SNetRegisterEventHandler(int, void (__attribute__((__stdcall__)) *)(_SNETEVENT*))’
void * __stdcall SNetRegisterEventHandler(int,void (__stdcall*)(struct _SNETEVENT *));
---
Source/../3rdParty/Storm/Source/storm.h:1299:15: error: conflicting declaration of C function ‘int SNetInitializeProvider(long unsigned int, _SNETPROGRAMDATA*, _SNETPLAYERDATA*, _SNETUIDATA*, _SNETVERSIONDATA*)’
int __stdcall SNetInitializeProvider(unsigned long,struct _SNETPROGRAMDATA *,struct _SNETPLAYERDATA *,struct _SNETUIDATA *,struct _SNETVERSIONDATA *);
---
Source/multi.cpp:1046:75: error: cannot convert ‘_SNETPROGRAMDATA*’ to ‘client_info* {aka _client_info*}’ for argument ‘2’ to ‘BOOL SNetInitializeProvider(DWORD, client_info*, user_info*, battle_info*, module_info*)’