Browse Source

Merge branch 'master' of github.com:diasurgical/devilution

pull/109/head
Anders Jenbo 7 years ago
parent
commit
0c4b4719b8
  1. 59
      3rdParty/PKWare/Makefile
  2. 100
      3rdParty/PKWare/Pkware.dsp
  3. 4
      3rdParty/Storm/Source/storm.cpp
  4. 5
      3rdParty/Storm/Source/storm.h
  5. 6
      DiabloUI/DiabloUI.dsp
  6. 11
      Source/automap.cpp
  7. 387
      Source/control.cpp
  8. 2
      Source/control.h
  9. 6
      Source/cursor.cpp
  10. 73
      Source/diablo.cpp
  11. 370
      Source/engine.cpp
  12. 46
      Source/gmenu.cpp
  13. 55
      Source/init.cpp
  14. 2
      Source/init.h
  15. 39
      Source/items.cpp
  16. 10
      Source/lighting.cpp
  17. 1
      Source/list.h
  18. 4
      Source/mainmenu.cpp
  19. 2
      Source/mainmenu.h
  20. 148
      Source/missiles.cpp
  21. 667
      Source/monster.cpp
  22. 47
      Source/multi.cpp
  23. 2
      Source/multi.h
  24. 36
      Source/nthread.cpp
  25. 43
      Source/objects.cpp
  26. 6
      Source/objects.h
  27. 2
      Source/player.cpp
  28. 10
      Source/quests.cpp
  29. 18
      Source/stores.cpp
  30. 2
      Source/themes.cpp
  31. 342
      Source/trigs.cpp
  32. 10
      Source/trigs.h
  33. 9
      SourceX/dvlnet/abstract_net.h
  34. 8
      SourceX/dvlnet/base.cpp
  35. 10
      SourceX/dvlnet/base.h
  36. 12
      SourceX/dvlnet/loopback.cpp
  37. 8
      SourceX/dvlnet/loopback.h
  38. 4
      SourceX/storm/storm_net.cpp
  39. 2
      structs.h

59
3rdParty/PKWare/Makefile vendored

@ -0,0 +1,59 @@
VC5_DIR ?= $(HOME)/DevStudio_5.10/VC
# The $(VS6_DIR) directory is a copy of the "Microsoft Visual Studio" directory.
#
# To get a working setup on Linux or other "portable" copies of VS,
# the following DLLs have to be copied to the
# $(VS6_DIR)/VC98/Bin directory.
#
# - $(VS6_DIR)/Common/MSDev98/Bin/MSPDB60.DLL
#
# And to the $(VC5_DIR)/bin directory.
#
# - $(VC5_DIR)/SharedIDE/bin/MSDIS100.DLL
# - $(VC5_DIR)/SharedIDE/bin/MSPDB50.DLL
VS6_DIR ?= $(HOME)/VS6
VC6_DIR = $(VS6_DIR)/VC98
VC6_BIN_DIR = $(VC6_DIR)/Bin
VC6_INC_DIR = $(VC6_DIR)/Include
VC6_LIB_DIR = $(VC6_DIR)/Lib
VC5_LIB_DIR = $(VC5_DIR)/lib
IDE_DIR ?= $(VS6_DIR)/Common/MSDev98
IDE_BIN_DIR = $(IDE_DIR)/bin
ifeq ($(OS),Windows_NT)
CL = $(VC6_BIN_DIR)/CL.EXE
RC = $(IDE_BIN_DIR)/RC.EXE
VC5_LINK = $(VC5_DIR)/bin/link.exe
VC6_LINK = $(VC6_BIN_DIR)/link.exe
else
CL = wine $(VC6_BIN_DIR)/CL.EXE
RC = wine $(IDE_BIN_DIR)/RC.EXE
VC5_LINK = wine $(VC5_DIR)/bin/link.exe
VC6_LINK = wine $(VC6_BIN_DIR)/link.exe
endif
CFLAGS=/nologo /c /GX /W3 /O1 /I $(VC6_INC_DIR) /FD /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /Gm /Zi
LINKFLAGS=/nologo /subsystem:windows /machine:I386 /incremental:no
VC_LINK=$(VC5_LINK)
LINKFLAGS+= /LIBPATH:$(VC5_LIB_DIR)
all: pkware.lib
PKWARE_SRC=$(sort $(wildcard *.cpp))
PKWARE_OBJS=$(PKWARE_SRC:.cpp=.obj)
pkware.lib: $(PKWARE_OBJS)
$(VC_LINK) -lib /OUT:$@ $^ /nologo
%.obj: %.cpp
$(CL) $(CFLAGS) /Fo$@ $<
clean:
@$(RM) -v $(PKWARE_OBJS) pkware.lib vc60.{idb,pch,pdb}
.PHONY: clean all

100
3rdParty/PKWare/Pkware.dsp vendored

@ -0,0 +1,100 @@
# Microsoft Developer Studio Project File - Name="Pkware" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=Pkware - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Pkware.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Pkware.mak" CFG="Pkware - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Pkware - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "Pkware - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Pkware - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "WinRel"
# PROP BASE Intermediate_Dir "WinRel"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "WinRel"
# PROP Intermediate_Dir "WinRel"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Pkware - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "WinDebug"
# PROP BASE Intermediate_Dir "WinDebug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "WinDebug"
# PROP Intermediate_Dir "WinDebug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "Pkware - Win32 Release"
# Name "Pkware - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\explode.cpp
# End Source File
# Begin Source File
SOURCE=.\implode.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# End Target
# End Project

4
3rdParty/Storm/Source/storm.cpp vendored

@ -231,8 +231,8 @@ BOOLEAN __stdcall SFileSetBasePath(char *) rBool;
void __cdecl SDrawRealizePalette(void) rVoid; void __cdecl SDrawRealizePalette(void) rVoid;
BOOL __cdecl SVidPlayContinue(void) rBool; BOOL __cdecl SVidPlayContinue(void) rBool;
BOOL __stdcall SNetGetOwnerTurnsWaiting(DWORD *) rBool; BOOL __stdcall SNetGetOwnerTurnsWaiting(DWORD *) rBool;
void * __stdcall SNetUnregisterEventHandler(int,void (__stdcall*)(struct _SNETEVENT *)) rPVoid; BOOL __stdcall SNetUnregisterEventHandler(int,SEVTHANDLER) rPVoid;
void * __stdcall SNetRegisterEventHandler(int,void (__stdcall*)(struct _SNETEVENT *)) rPVoid; BOOL __stdcall SNetRegisterEventHandler(int,SEVTHANDLER) rPVoid;
BOOLEAN __stdcall SNetSetBasePlayer(int) rBool; BOOLEAN __stdcall SNetSetBasePlayer(int) rBool;
int __stdcall SNetInitializeProvider(unsigned long,struct _SNETPROGRAMDATA *,struct _SNETPLAYERDATA *,struct _SNETUIDATA *,struct _SNETVERSIONDATA *) rInt; int __stdcall SNetInitializeProvider(unsigned long,struct _SNETPROGRAMDATA *,struct _SNETPLAYERDATA *,struct _SNETUIDATA *,struct _SNETVERSIONDATA *) rInt;
int __stdcall SNetGetProviderCaps(struct _SNETCAPS *) rInt; int __stdcall SNetGetProviderCaps(struct _SNETCAPS *) rInt;

5
3rdParty/Storm/Source/storm.h vendored

@ -380,6 +380,7 @@ typedef struct _s_evt
DWORD dwSize; DWORD dwSize;
} S_EVT, *PS_EVT; } S_EVT, *PS_EVT;
typedef void (STORMAPI *SEVTHANDLER)(struct _SNETEVENT *);
// @TODO: "type" is unknown. // @TODO: "type" is unknown.
//HANDLE STORMAPI SNetRegisterEventHandler(int type, void (STORMAPI *sEvent)(PS_EVT)); //HANDLE STORMAPI SNetRegisterEventHandler(int type, void (STORMAPI *sEvent)(PS_EVT));
@ -1326,8 +1327,8 @@ BOOLEAN __stdcall SFileSetBasePath(char *);
void __cdecl SDrawRealizePalette(void); void __cdecl SDrawRealizePalette(void);
BOOL __cdecl SVidPlayContinue(void); BOOL __cdecl SVidPlayContinue(void);
BOOL __stdcall SNetGetOwnerTurnsWaiting(DWORD *); BOOL __stdcall SNetGetOwnerTurnsWaiting(DWORD *);
void * __stdcall SNetUnregisterEventHandler(int,void (__stdcall*)(struct _SNETEVENT *)); BOOL __stdcall SNetUnregisterEventHandler(int,SEVTHANDLER);
void * __stdcall SNetRegisterEventHandler(int,void (__stdcall*)(struct _SNETEVENT *)); BOOL __stdcall SNetRegisterEventHandler(int,SEVTHANDLER);
BOOLEAN __stdcall SNetSetBasePlayer(int); BOOLEAN __stdcall SNetSetBasePlayer(int);
int __stdcall SNetInitializeProvider(unsigned long,struct _SNETPROGRAMDATA *,struct _SNETPLAYERDATA *,struct _SNETUIDATA *,struct _SNETVERSIONDATA *); int __stdcall SNetInitializeProvider(unsigned long,struct _SNETPROGRAMDATA *,struct _SNETPLAYERDATA *,struct _SNETUIDATA *,struct _SNETVERSIONDATA *);
int __stdcall SNetGetProviderCaps(struct _SNETCAPS *); int __stdcall SNetGetProviderCaps(struct _SNETCAPS *);

6
DiabloUI/DiabloUI.dsp

@ -40,6 +40,7 @@ RSC=rc.exe
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "WinRel" # PROP Output_Dir "WinRel"
# PROP Intermediate_Dir "WinRel" # PROP Intermediate_Dir "WinRel"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
@ -52,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 ../3rdParty/Storm/Source/WinRel/Storm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /def:"diabloui.def" # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /def:"diabloui.def"
!ELSEIF "$(CFG)" == "DiabloUI - Win32 Debug" !ELSEIF "$(CFG)" == "DiabloUI - Win32 Debug"
@ -65,6 +66,7 @@ LINK32=link.exe
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir "WinDebug" # PROP Output_Dir "WinDebug"
# PROP Intermediate_Dir "WinDebug" # PROP Intermediate_Dir "WinDebug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /O1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /O1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
@ -77,7 +79,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ../3rdParty/Storm/Source/WinDebug/Storm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /def:"diabloui.def" /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /def:"diabloui.def" /pdbtype:sept
!ENDIF !ENDIF

11
Source/automap.cpp

@ -501,6 +501,7 @@ void DrawAutomapPlr()
DrawLine(x, y, x - AutoMapYPos, y - AMPlayerX, COLOR_PLAYER); DrawLine(x, y, x - AutoMapYPos, y - AMPlayerX, COLOR_PLAYER);
DrawLine(x - AutoMapYPos, y - AMPlayerX, x - AMPlayerX, y - AMPlayerX, COLOR_PLAYER); DrawLine(x - AutoMapYPos, y - AMPlayerX, x - AMPlayerX, y - AMPlayerX, COLOR_PLAYER);
DrawLine(x - AutoMapYPos, y - AMPlayerX, x - AMPlayerY - AMPlayerX, y, COLOR_PLAYER); DrawLine(x - AutoMapYPos, y - AMPlayerX, x - AMPlayerY - AMPlayerX, y, COLOR_PLAYER);
break;
} }
} }
@ -591,7 +592,7 @@ void SetAutomapView(int x, int y)
} else if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) { } else if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) {
automapview[xx - 1][yy] = 1; automapview[xx - 1][yy] = 1;
} }
return; break;
case 3: case 3:
if (solid) { if (solid) {
if (GetAutomapType(xx + 1, yy, FALSE) == 0x4007) if (GetAutomapType(xx + 1, yy, FALSE) == 0x4007)
@ -599,7 +600,7 @@ void SetAutomapView(int x, int y)
} else if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000) { } else if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000) {
automapview[xx][yy - 1] = 1; automapview[xx][yy - 1] = 1;
} }
return; break;
case 4: case 4:
if (solid) { if (solid) {
if (GetAutomapType(xx, yy + 1, FALSE) == 0x4007) if (GetAutomapType(xx, yy + 1, FALSE) == 0x4007)
@ -614,7 +615,7 @@ void SetAutomapView(int x, int y)
if (GetAutomapType(xx - 1, yy - 1, FALSE) & 0x4000) if (GetAutomapType(xx - 1, yy - 1, FALSE) & 0x4000)
automapview[xx - 1][yy - 1] = 1; automapview[xx - 1][yy - 1] = 1;
} }
return; break;
case 5: case 5:
if (solid) { if (solid) {
if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000) if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000)
@ -624,7 +625,7 @@ void SetAutomapView(int x, int y)
} else if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) { } else if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) {
automapview[xx - 1][yy] = 1; automapview[xx - 1][yy] = 1;
} }
return; break;
case 6: case 6:
if (solid) { if (solid) {
if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000)
@ -634,7 +635,7 @@ void SetAutomapView(int x, int y)
} else if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000) { } else if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000) {
automapview[xx][yy - 1] = 1; automapview[xx][yy - 1] = 1;
} }
return; break;
} }
} }

387
Source/control.cpp

@ -576,10 +576,6 @@ void SetSpell()
plr[myplr]._pRSplType = pSplType; plr[myplr]._pRSplType = pSplType;
} }
} }
// 4B8834: using guessed type int pSpell;
// 4B8954: using guessed type int pSplType;
// 4B8C98: using guessed type int spselflag;
// 52571C: using guessed type int drawpanflag;
void SetSpeedSpell(int slot) void SetSpeedSpell(int slot)
{ {
@ -624,7 +620,6 @@ void ToggleSpell(int slot)
drawpanflag = 255; drawpanflag = 255;
} }
} }
// 52571C: using guessed type int drawpanflag;
void CPrintString(int nOffset, int nCel, char col) void CPrintString(int nOffset, int nCel, char col)
{ {
@ -1264,7 +1259,6 @@ void ClearCtrlPan()
DrawPanelBox(0, sgbPlrTalkTbl + 16, 640, 128, 64, 512); DrawPanelBox(0, sgbPlrTalkTbl + 16, 640, 128, 64, 512);
DrawInfoBox(); DrawInfoBox();
} }
// 4B8840: using guessed type int sgbPlrTalkTbl;
void DrawCtrlPan() void DrawCtrlPan()
{ {
@ -1337,7 +1331,6 @@ void DoSpeedBook()
SetCursorPos(X, Y); SetCursorPos(X, Y);
} }
// 4B8C98: using guessed type int spselflag;
void DoPanBtn() void DoPanBtn()
{ {
@ -1367,21 +1360,16 @@ void control_set_button_down(int btn_id)
void control_check_btn_press() void control_check_btn_press()
{ {
int v0; // edx
int v1; // esi
v0 = MouseX;
v1 = MouseY;
if (MouseX >= PanBtnPos[3][0] if (MouseX >= PanBtnPos[3][0]
&& MouseX <= PanBtnPos[3][0] + PanBtnPos[3][2] && MouseX <= PanBtnPos[3][0] + PanBtnPos[3][2]
&& MouseY >= PanBtnPos[3][1] && MouseY >= PanBtnPos[3][1]
&& MouseY <= PanBtnPos[3][1] + PanBtnPos[3][3]) { && MouseY <= PanBtnPos[3][1] + PanBtnPos[3][3]) {
control_set_button_down(3); control_set_button_down(3);
} }
if (v0 >= PanBtnPos[6][0] if (MouseX >= PanBtnPos[6][0]
&& v0 <= PanBtnPos[6][0] + PanBtnPos[6][2] && MouseX <= PanBtnPos[6][0] + PanBtnPos[6][2]
&& v1 >= PanBtnPos[6][1] && MouseY >= PanBtnPos[6][1]
&& v1 <= PanBtnPos[6][1] + PanBtnPos[6][3]) { && MouseY <= PanBtnPos[6][1] + PanBtnPos[6][3]) {
control_set_button_down(6); control_set_button_down(6);
} }
} }
@ -1397,53 +1385,34 @@ void DoAutoMap()
InitDiabloMsg(EMSG_NO_AUTOMAP_IN_TOWN); InitDiabloMsg(EMSG_NO_AUTOMAP_IN_TOWN);
} }
} }
// 679660: using guessed type char gbMaxPlayers;
void CheckPanelInfo() void CheckPanelInfo()
{ {
int v0; // edi int i, c, v, s;
int v1; // eax
int v2; // ecx
int v3; // ecx
int v4; // edi
int v5; // eax
int *v6; // edx
int v7; // ebx
int v8; // ebx
int *v9; // eax
signed int v10; // edx
int v11; // ecx
int v12; // [esp+10h] [ebp-4h]
v0 = 0;
panelflag = 0; panelflag = 0;
ClearPanel(); ClearPanel();
if (numpanbtns > 0) { for (i = 0; i < numpanbtns; i++) {
do { if (MouseX >= PanBtnPos[i][0]
v1 = v0; && MouseX <= PanBtnPos[i][0] + PanBtnPos[i][2]
v2 = PanBtnPos[v0][0]; && MouseY >= PanBtnPos[i][1]
if (MouseX >= v2 && MouseX <= v2 + PanBtnPos[v1][2]) { && MouseY <= PanBtnPos[i][1] + PanBtnPos[i][3]) {
v3 = PanBtnPos[v1][1]; if (i != 7) {
if (MouseY >= v3 && MouseY <= v3 + PanBtnPos[v1][3]) { strcpy(infostr, PanBtnStr[i]);
if (v0 == 7) { } else {
if (FriendlyMode) if (FriendlyMode)
strcpy(infostr, "Player friendly"); strcpy(infostr, "Player friendly");
else else
strcpy(infostr, "Player attack"); strcpy(infostr, "Player attack");
} else {
strcpy(infostr, PanBtnStr[v0]);
}
if (PanBtnHotKey[v0]) {
sprintf(tempstr, "Hotkey : %s", PanBtnHotKey[v0]);
AddPanelString(tempstr, 1);
}
infoclr = COL_WHITE;
panelflag = 1;
pinfoflag = TRUE;
}
} }
++v0; if (PanBtnHotKey[i]) {
} while (v0 < numpanbtns); sprintf(tempstr, "Hotkey : %s", PanBtnHotKey[i]);
AddPanelString(tempstr, 1);
}
infoclr = COL_WHITE;
panelflag = 1;
pinfoflag = TRUE;
}
} }
if (!spselflag && MouseX >= 565 && MouseX < 621 && MouseY >= 416 && MouseY < 472) { if (!spselflag && MouseX >= 565 && MouseX < 621 && MouseY >= 416 && MouseY < 472) {
strcpy(infostr, "Select current spell button"); strcpy(infostr, "Select current spell button");
@ -1452,62 +1421,58 @@ void CheckPanelInfo()
pinfoflag = TRUE; pinfoflag = TRUE;
strcpy(tempstr, "Hotkey : 's'"); strcpy(tempstr, "Hotkey : 's'");
AddPanelString(tempstr, 1); AddPanelString(tempstr, 1);
v4 = plr[myplr]._pRSpell; v = plr[myplr]._pRSpell;
if (v4 != -1) { if (v != -1) {
switch (_LOBYTE(plr[myplr]._pRSplType)) { switch (plr[myplr]._pRSplType) {
case RSPLTYPE_SKILL: case RSPLTYPE_SKILL:
sprintf(tempstr, "%s Skill", spelldata[v4].sSkillText); sprintf(tempstr, "%s Skill", spelldata[v].sSkillText);
LABEL_54:
AddPanelString(tempstr, 1); AddPanelString(tempstr, 1);
break; break;
case RSPLTYPE_SPELL: case RSPLTYPE_SPELL:
sprintf(tempstr, "%s Spell", spelldata[v4].sNameText); sprintf(tempstr, "%s Spell", spelldata[v].sNameText);
AddPanelString(tempstr, 1); AddPanelString(tempstr, 1);
v11 = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[v4]; c = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[v];
if (v11 < 0) if (c < 0)
v11 = 0; c = 0;
if (v11) if (!c)
sprintf(tempstr, "Spell Level %i", v11);
else
sprintf(tempstr, "Spell Level 0 - Unusable"); sprintf(tempstr, "Spell Level 0 - Unusable");
goto LABEL_54; else
sprintf(tempstr, "Spell Level %i", c);
AddPanelString(tempstr, 1);
break;
case RSPLTYPE_SCROLL: case RSPLTYPE_SCROLL:
sprintf(tempstr, "Scroll of %s", spelldata[v4].sNameText); sprintf(tempstr, "Scroll of %s", spelldata[v].sNameText);
AddPanelString(tempstr, 1); AddPanelString(tempstr, 1);
v12 = 0; s = 0;
v5 = myplr; for (i = 0; i < plr[myplr]._pNumInv; i++) {
if (plr[myplr]._pNumInv > 0) { if (plr[myplr].InvList[i]._itype != -1
v6 = &plr[v5].InvList[0]._iMiscId; && (plr[myplr].InvList[i]._iMiscId == IMISC_SCROLL || plr[myplr].InvList[i]._iMiscId == IMISC_SCROLLT)
v7 = plr[myplr]._pNumInv; && plr[myplr].InvList[i]._iSpell == v) {
do { s++;
if (*(v6 - 53) != -1 && (*v6 == IMISC_SCROLL || *v6 == IMISC_SCROLLT) && v6[1] == v4) }
++v12;
v6 += 92;
--v7;
} while (v7);
} }
v8 = v12; for (i = 0; i < MAXBELTITEMS; i++) {
v9 = &plr[v5].SpdList[0]._iMiscId; if (plr[myplr].SpdList[i]._itype != -1
v10 = MAXBELTITEMS; && (plr[myplr].SpdList[i]._iMiscId == IMISC_SCROLL || plr[myplr].SpdList[i]._iMiscId == IMISC_SCROLLT)
do { && plr[myplr].SpdList[i]._iSpell == v) {
if (*(v9 - 53) != -1 && (*v9 == IMISC_SCROLL || *v9 == IMISC_SCROLLT) && v9[1] == v4) s++;
++v8; }
v9 += 92; }
--v10; if (s == 1)
} while (v10);
if (v8 == 1)
strcpy(tempstr, "1 Scroll"); strcpy(tempstr, "1 Scroll");
else else
sprintf(tempstr, "%i Scrolls", v8); sprintf(tempstr, "%i Scrolls", s);
goto LABEL_54; AddPanelString(tempstr, 1);
break;
case RSPLTYPE_CHARGES: case RSPLTYPE_CHARGES:
sprintf(tempstr, "Staff of %s", spelldata[v4].sNameText); sprintf(tempstr, "Staff of %s", spelldata[v].sNameText);
AddPanelString(tempstr, 1); AddPanelString(tempstr, 1);
if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges == 1) if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges == 1)
strcpy(tempstr, "1 Charge"); strcpy(tempstr, "1 Charge");
else else
sprintf(tempstr, "%i Charges", plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges); sprintf(tempstr, "%i Charges", plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges);
goto LABEL_54; AddPanelString(tempstr, 1);
break;
} }
} }
} }
@ -1595,10 +1560,6 @@ void CheckBtnUp()
if (gamemenuOff) if (gamemenuOff)
gamemenu_off(); gamemenu_off();
} }
// 484368: using guessed type int FriendlyMode;
// 4B8960: using guessed type int talkflag;
// 4B8968: using guessed type int sbookflag;
// 646D00: using guessed type char qtextflag;
void FreeControlPan() void FreeControlPan()
{ {
@ -1651,9 +1612,9 @@ void DrawInfoBox()
char *v10; // ebx char *v10; // ebx
DrawPanelBox(177, 62, 288, 60, 241, 558); DrawPanelBox(177, 62, 288, 60, 241, 558);
v0 = trigflag_3; v0 = trigflag;
v1 = spselflag; v1 = spselflag;
if (!panelflag && !trigflag_3 && pcursinvitem == -1) { if (!panelflag && !trigflag && pcursinvitem == -1) {
if (spselflag) { if (spselflag) {
LABEL_32: LABEL_32:
infoclr = COL_WHITE; infoclr = COL_WHITE;
@ -1745,55 +1706,37 @@ LABEL_33:
// 4B8CC1: using guessed type char pcursobj; // 4B8CC1: using guessed type char pcursobj;
// 4B8CC2: using guessed type char pcursplr; // 4B8CC2: using guessed type char pcursplr;
void control_print_info_str(int y, char *str, BOOLEAN center, int lines) void control_print_info_str(int y, char *str, BOOL center, int lines)
{ {
int v4; // edi BYTE c;
char *v5; // ebx char *tmp;
unsigned char v6; // cl int screen_x, line, nOffset;
signed int v7; // eax
char *v8; // esi line = 0;
int v9; // eax nOffset = lineoffset[y + 4 * lines + lines];
unsigned char v10; // esi
unsigned char v11; // al
int width; // [esp+18h] [ebp+Ch]
v4 = 0;
v5 = str;
width = lineoffset[y + 4 * lines + lines];
if (center == 1) { if (center == 1) {
v6 = *str; screen_x = 0;
v7 = 0; tmp = str;
v8 = str; while (*tmp) {
if (!*str) c = gbFontTransTbl[(BYTE)*tmp++];
goto LABEL_14; screen_x += fontkern[fontframe[c]] + 1;
do { }
++v8; if (screen_x < 288)
v7 += fontkern[fontframe[gbFontTransTbl[v6]]] + 2; line = (288 - screen_x) >> 1;
v6 = *v8; nOffset += line;
} while (*v8);
if (v7 < 288)
LABEL_14:
v4 = (288 - v7) >> 1;
width += v4;
} }
while (1) { while (*str) {
v11 = *v5; c = gbFontTransTbl[(BYTE)*str++];
if (!*v5) c = fontframe[c];
break; line += fontkern[c] + 2;
++v5; if (c) {
v9 = gbFontTransTbl[v11]; if (line < 288) {
_LOBYTE(v9) = fontframe[v9]; CPrintString(nOffset, c, infoclr);
v10 = (unsigned char)v9;
v4 += fontkern[(unsigned char)v9] + 2;
if ((_BYTE)v9) {
if (v4 < 288) {
CPrintString(width, v10, infoclr);
} }
} }
width += fontkern[v10] + 2; nOffset += fontkern[c] + 2;
} }
} }
// 4B883C: using guessed type int infoclr;
void PrintGameStr(int x, int y, char *str, int color) void PrintGameStr(int x, int y, char *str, int color)
{ {
@ -1801,8 +1744,7 @@ void PrintGameStr(int x, int y, char *str, int color)
int off; int off;
off = PitchTbl[y + 160] + x + 64; off = PitchTbl[y + 160] + x + 64;
while (*str) { while (*str) {
c = gbFontTransTbl[(BYTE)*str]; c = gbFontTransTbl[(BYTE)*str++];
str++;
c = fontframe[c]; c = fontframe[c];
if (c) if (c)
CPrintString(off, c, color); CPrintString(off, c, color);
@ -2035,95 +1977,66 @@ void DrawChr()
ADD_PlrStringXY(143, 332, 174, a4, a5[0]); ADD_PlrStringXY(143, 332, 174, a4, a5[0]);
} }
/**
* @brief Identical to MY_PlrStringXY(x, y, width, pszStr, col, 1)
*/
void ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col) void ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col)
{ {
int v5; // eax BYTE c;
char *v6; // edx char *tmp;
unsigned char v7; // al int nOffset, screen_x, line, widthOffset;
int v8; // esi
int v9; // edi nOffset = x + PitchTbl[y + 160] + 64;
int v10; // ecx widthOffset = width - x + 1;
unsigned char v11; // bl line = 0;
unsigned char v12; // al screen_x = 0;
int v13; // ebx tmp = pszStr;
int widtha; // [esp+Ch] [ebp-4h] while (*tmp) {
int widthb; // [esp+Ch] [ebp-4h] c = gbFontTransTbl[(BYTE)*tmp++];
screen_x += fontkern[fontframe[c]] + 1;
v5 = PitchTbl[y + 160]; }
v6 = pszStr; if (screen_x < widthOffset)
widtha = v5 + x + 64; line = (widthOffset - screen_x) >> 1;
v7 = *pszStr; nOffset += line;
v8 = width - x + 1; while (*pszStr) {
v9 = 0; c = gbFontTransTbl[(BYTE)*pszStr++];
v10 = 0; c = fontframe[c];
if (*pszStr) { line += fontkern[c] + 1;
v11 = *pszStr; if (c) {
do { if (line < widthOffset)
++v6; CPrintString(nOffset, c, col);
v10 += fontkern[fontframe[gbFontTransTbl[v11]]] + 1;
v11 = *v6;
} while (*v6);
}
if (v10 < v8)
v9 = (v8 - v10) >> 1;
widthb = v9 + widtha;
while (v7) {
++pszStr;
v12 = fontframe[gbFontTransTbl[v7]];
v13 = v12;
v9 += fontkern[v12] + 1;
if (v12) {
if (v9 < v8)
CPrintString(widthb, v12, col);
} }
widthb += fontkern[v13] + 1; nOffset += fontkern[c] + 1;
v7 = *pszStr;
} }
} }
void MY_PlrStringXY(int x, int y, int width, char *pszStr, char col, int base) void MY_PlrStringXY(int x, int y, int width, char *pszStr, char col, int base)
{ {
char *v6; // ebx BYTE c;
unsigned char v7; // al char *tmp;
int v8; // edx int nOffset, screen_x, line, widthOffset;
int v9; // esi
char *v10; // edi nOffset = x + PitchTbl[y + 160] + 64;
unsigned char v11; // cl widthOffset = width - x + 1;
unsigned char v12; // al line = 0;
int v13; // edi screen_x = 0;
int widtha; // [esp+Ch] [ebp-4h] tmp = pszStr;
int widthb; // [esp+Ch] [ebp-4h] while (*tmp) {
int v16; // [esp+18h] [ebp+8h] c = gbFontTransTbl[(BYTE)*tmp++];
screen_x += fontkern[fontframe[c]] + base;
v6 = pszStr; }
widtha = PitchTbl[y + 160] + x + 64; if (screen_x < widthOffset)
v7 = *pszStr; line = (widthOffset - screen_x) >> 1;
v8 = 0; nOffset += line;
v9 = width - x + 1; while (*pszStr) {
v16 = 0; c = gbFontTransTbl[(BYTE)*pszStr++];
v10 = pszStr; c = fontframe[c];
if (*pszStr) { line += fontkern[c] + base;
v11 = *pszStr; if (c) {
do { if (line < widthOffset)
++v10; CPrintString(nOffset, c, col);
v8 += base + fontkern[fontframe[gbFontTransTbl[v11]]];
v11 = *v10;
} while (*v10);
}
if (v8 < v9)
v16 = (v9 - v8) >> 1;
widthb = v16 + widtha;
while (v7) {
++v6;
v12 = fontframe[gbFontTransTbl[v7]];
v13 = v12;
v16 += base + fontkern[v12];
if (v12) {
if (v16 < v9)
CPrintString(widthb, v12, col);
} }
widthb += base + fontkern[v13]; nOffset += fontkern[c] + base;
v7 = *v6;
} }
} }
@ -2265,8 +2178,6 @@ int DrawDurIcon4Item(ItemStruct *item, int x, int frame)
case ITYPE_STAFF: case ITYPE_STAFF:
frame = 8; frame = 8;
break; break;
default:
break;
} }
} else { } else {
frame = 1; frame = 1;
@ -2441,7 +2352,7 @@ void DrawSpellBook()
void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col) void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col)
{ {
BYTE nCel; BYTE c;
char *tmp; char *tmp;
int screen_x, line, width; int screen_x, line, width;
@ -2451,24 +2362,22 @@ void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col)
screen_x = 0; screen_x = 0;
tmp = pszStr; tmp = pszStr;
while (*tmp) { while (*tmp) {
nCel = gbFontTransTbl[(BYTE)*tmp]; c = gbFontTransTbl[(BYTE)*tmp++];
tmp++; screen_x += fontkern[fontframe[c]] + 1;
screen_x += fontkern[fontframe[nCel]] + 1;
} }
if (screen_x < 222) if (screen_x < 222)
line = (222 - screen_x) >> 1; line = (222 - screen_x) >> 1;
width += line; width += line;
} }
while (*pszStr) { while (*pszStr) {
nCel = gbFontTransTbl[(BYTE)*pszStr]; c = gbFontTransTbl[(BYTE)*pszStr++];
pszStr++; c = fontframe[c];
nCel = fontframe[nCel]; line += fontkern[c] + 1;
line += fontkern[nCel] + 1; if (c) {
if (nCel) {
if (line <= 222) if (line <= 222)
CPrintString(width, nCel, col); CPrintString(width, c, col);
} }
width += fontkern[nCel] + 1; width += fontkern[c] + 1;
} }
} }

2
Source/control.h

@ -85,7 +85,7 @@ void CheckBtnUp();
void FreeControlPan(); void FreeControlPan();
BOOL control_WriteStringToBuffer(BYTE *str); BOOL control_WriteStringToBuffer(BYTE *str);
void DrawInfoBox(); void DrawInfoBox();
void control_print_info_str(int y, char *str, BOOLEAN center, int lines); void control_print_info_str(int y, char *str, BOOL center, int lines);
void PrintGameStr(int x, int y, char *str, int color); void PrintGameStr(int x, int y, char *str, int color);
void DrawChr(); void DrawChr();
void ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col); void ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col);

6
Source/cursor.cpp

@ -129,7 +129,7 @@ void CheckTown()
|| cursmx == missile[mx]._mix - 2 && cursmy == missile[mx]._miy - 2 || cursmx == missile[mx]._mix - 2 && cursmy == missile[mx]._miy - 2
|| cursmx == missile[mx]._mix - 1 && cursmy == missile[mx]._miy - 2 || cursmx == missile[mx]._mix - 1 && cursmy == missile[mx]._miy - 2
|| cursmx == missile[mx]._mix && cursmy == missile[mx]._miy) { || cursmx == missile[mx]._mix && cursmy == missile[mx]._miy) {
trigflag_3 = 1; trigflag = TRUE;
ClearPanel(); ClearPanel();
strcpy(infostr, "Town Portal"); strcpy(infostr, "Town Portal");
sprintf(tempstr, "from %s", plr[missile[mx]._misource]._pName); sprintf(tempstr, "from %s", plr[missile[mx]._misource]._pName);
@ -155,7 +155,7 @@ void CheckRportal()
|| cursmx == missile[mx]._mix - 2 && cursmy == missile[mx]._miy - 2 || cursmx == missile[mx]._mix - 2 && cursmy == missile[mx]._miy - 2
|| cursmx == missile[mx]._mix - 1 && cursmy == missile[mx]._miy - 2 || cursmx == missile[mx]._mix - 1 && cursmy == missile[mx]._miy - 2
|| cursmx == missile[mx]._mix && cursmy == missile[mx]._miy) { || cursmx == missile[mx]._mix && cursmy == missile[mx]._miy) {
trigflag_3 = 1; trigflag = TRUE;
ClearPanel(); ClearPanel();
strcpy(infostr, "Portal to"); strcpy(infostr, "Portal to");
if (!setlevel) if (!setlevel)
@ -263,7 +263,7 @@ void CheckCursMove()
pcursplr = -1; pcursplr = -1;
uitemflag = 0; uitemflag = 0;
panelflag = 0; panelflag = 0;
trigflag_3 = 0; trigflag = FALSE;
if(plr[myplr]._pInvincible) { if(plr[myplr]._pInvincible) {
return; return;

73
Source/diablo.cpp

@ -1291,6 +1291,7 @@ void diablo_pause_game()
// 525740: using guessed type int PauseMode; // 525740: using guessed type int PauseMode;
// 679660: using guessed type char gbMaxPlayers; // 679660: using guessed type char gbMaxPlayers;
/* NOTE: `return` must be used instead of `break` to be bin exact as C++ */
void PressChar(int vkey) void PressChar(int vkey)
{ {
if(gmenu_exception() || control_talk_last_key(vkey) || sgnTimeoutCurs != 0 || deathflag) { if(gmenu_exception() || control_talk_last_key(vkey) || sgnTimeoutCurs != 0 || deathflag) {
@ -1316,11 +1317,11 @@ void PressChar(int vkey)
case 'G': case 'G':
case 'g': case 'g':
DecreaseGamma(); DecreaseGamma();
break; return;
case 'F': case 'F':
case 'f': case 'f':
IncreaseGamma(); IncreaseGamma();
break; return;
case 'I': case 'I':
case 'i': case 'i':
if(!stextflag) { if(!stextflag) {
@ -1336,7 +1337,7 @@ void PressChar(int vkey)
} }
} }
} }
break; return;
case 'C': case 'C':
case 'c': case 'c':
if(!stextflag) { if(!stextflag) {
@ -1352,7 +1353,7 @@ void PressChar(int vkey)
} }
} }
} }
break; return;
case 'Q': case 'Q':
case 'q': case 'q':
if(!stextflag) { if(!stextflag) {
@ -1363,11 +1364,11 @@ void PressChar(int vkey)
questlog = FALSE; questlog = FALSE;
} }
} }
break; return;
case 'Z': case 'Z':
case 'z': case 'z':
zoomflag = zoomflag == 0; zoomflag = zoomflag == 0;
break; return;
case 'S': case 'S':
case 's': case 's':
if(!stextflag) { if(!stextflag) {
@ -1379,86 +1380,86 @@ void PressChar(int vkey)
} }
track_repeat_walk(0); track_repeat_walk(0);
} }
break; return;
case 'B': case 'B':
case 'b': case 'b':
if(!stextflag) { if(!stextflag) {
invflag = 0; invflag = 0;
sbookflag = sbookflag == 0; sbookflag = sbookflag == 0;
} }
break; return;
case '+': case '+':
case '=': case '=':
if(automapflag) { if(automapflag) {
AutomapZoomIn(); AutomapZoomIn();
} }
break; return;
case '-': case '-':
case '_': case '_':
if(automapflag) { if(automapflag) {
AutomapZoomOut(); AutomapZoomOut();
} }
break; return;
case 'v': case 'v':
NetSendCmdString(1 << myplr, gszProductName); NetSendCmdString(1 << myplr, gszProductName);
break; return;
case 'V': case 'V':
NetSendCmdString(1 << myplr, gszVersionNumber); NetSendCmdString(1 << myplr, gszVersionNumber);
break; return;
case '!': case '!':
case '1': case '1':
if(plr[myplr].SpdList[0]._itype != -1 && plr[myplr].SpdList[0]._itype != 11) { if(plr[myplr].SpdList[0]._itype != -1 && plr[myplr].SpdList[0]._itype != 11) {
UseInvItem(myplr, 47); UseInvItem(myplr, 47);
} }
break; return;
case '@': case '@':
case '2': case '2':
if(plr[myplr].SpdList[1]._itype != -1 && plr[myplr].SpdList[1]._itype != 11) { if(plr[myplr].SpdList[1]._itype != -1 && plr[myplr].SpdList[1]._itype != 11) {
UseInvItem(myplr, 48); UseInvItem(myplr, 48);
} }
break; return;
case '#': case '#':
case '3': case '3':
if(plr[myplr].SpdList[2]._itype != -1 && plr[myplr].SpdList[2]._itype != 11) { if(plr[myplr].SpdList[2]._itype != -1 && plr[myplr].SpdList[2]._itype != 11) {
UseInvItem(myplr, 49); UseInvItem(myplr, 49);
} }
break; return;
case '$': case '$':
case '4': case '4':
if(plr[myplr].SpdList[3]._itype != -1 && plr[myplr].SpdList[3]._itype != 11) { if(plr[myplr].SpdList[3]._itype != -1 && plr[myplr].SpdList[3]._itype != 11) {
UseInvItem(myplr, 50); UseInvItem(myplr, 50);
} }
break; return;
case '%': case '%':
case '5': case '5':
if(plr[myplr].SpdList[4]._itype != -1 && plr[myplr].SpdList[4]._itype != 11) { if(plr[myplr].SpdList[4]._itype != -1 && plr[myplr].SpdList[4]._itype != 11) {
UseInvItem(myplr, 51); UseInvItem(myplr, 51);
} }
break; return;
case '^': case '^':
case '6': case '6':
if(plr[myplr].SpdList[5]._itype != -1 && plr[myplr].SpdList[5]._itype != 11) { if(plr[myplr].SpdList[5]._itype != -1 && plr[myplr].SpdList[5]._itype != 11) {
UseInvItem(myplr, 52); UseInvItem(myplr, 52);
} }
break; return;
case '&': case '&':
case '7': case '7':
if(plr[myplr].SpdList[6]._itype != -1 && plr[myplr].SpdList[6]._itype != 11) { if(plr[myplr].SpdList[6]._itype != -1 && plr[myplr].SpdList[6]._itype != 11) {
UseInvItem(myplr, 53); UseInvItem(myplr, 53);
} }
break; return;
case '*': case '*':
case '8': case '8':
#ifdef _DEBUG #ifdef _DEBUG
if(debug_mode_key_inverted_v || debug_mode_key_w) { if(debug_mode_key_inverted_v || debug_mode_key_w) {
NetSendCmd(TRUE, CMD_CHEAT_EXPERIENCE); NetSendCmd(TRUE, CMD_CHEAT_EXPERIENCE);
break; return;
} }
#endif #endif
if(plr[myplr].SpdList[7]._itype != -1 && plr[myplr].SpdList[7]._itype != 11) { if(plr[myplr].SpdList[7]._itype != -1 && plr[myplr].SpdList[7]._itype != 11) {
UseInvItem(myplr, 54); UseInvItem(myplr, 54);
} }
break; return;
#ifdef _DEBUG #ifdef _DEBUG
case ')': case ')':
case '0': case '0':
@ -1478,52 +1479,52 @@ void PressChar(int vkey)
} }
arrowdebug++; arrowdebug++;
} }
break; return;
case ':': case ':':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
SetAllSpellsCheat(); SetAllSpellsCheat();
} }
break; return;
case '[': case '[':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
TakeGoldCheat(); TakeGoldCheat();
} }
break; return;
case ']': case ']':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
MaxSpellsCheat(); MaxSpellsCheat();
} }
break; return;
case 'a': case 'a':
if(debug_mode_key_inverted_v) { if(debug_mode_key_inverted_v) {
spelldata[SPL_TELEPORT].sTownSpell = 1; spelldata[SPL_TELEPORT].sTownSpell = 1;
plr[myplr]._pSplLvl[plr[myplr]._pSpell]++; plr[myplr]._pSplLvl[plr[myplr]._pSpell]++;
} }
break; return;
case 'D': case 'D':
PrintDebugPlayer(TRUE); PrintDebugPlayer(TRUE);
break; return;
case 'd': case 'd':
PrintDebugPlayer(FALSE); PrintDebugPlayer(FALSE);
break; return;
case 'e': case 'e':
if(debug_mode_key_d) { if(debug_mode_key_d) {
sprintf(tempstr, "EFlag = %i", plr[myplr]._peflag); sprintf(tempstr, "EFlag = %i", plr[myplr]._peflag);
NetSendCmdString(1 << myplr, tempstr); NetSendCmdString(1 << myplr, tempstr);
} }
break; return;
case 'L': case 'L':
case 'l': case 'l':
if(debug_mode_key_inverted_v) { if(debug_mode_key_inverted_v) {
ToggleLighting(); ToggleLighting();
} }
break; return;
case 'M': case 'M':
NextDebugMonster(); NextDebugMonster();
break; return;
case 'm': case 'm':
GetDebugMonster(); GetDebugMonster();
break; return;
case 'R': case 'R':
case 'r': case 'r':
sprintf(tempstr, "seed = %i", glSeedTbl[currlevel]); sprintf(tempstr, "seed = %i", glSeedTbl[currlevel]);
@ -1532,7 +1533,7 @@ void PressChar(int vkey)
NetSendCmdString(1 << myplr, tempstr); NetSendCmdString(1 << myplr, tempstr);
sprintf(tempstr, "End = %i", glEndSeed[currlevel]); sprintf(tempstr, "End = %i", glEndSeed[currlevel]);
NetSendCmdString(1 << myplr, tempstr); NetSendCmdString(1 << myplr, tempstr);
break; return;
case 'T': case 'T':
case 't': case 't':
if(debug_mode_key_inverted_v) { if(debug_mode_key_inverted_v) {
@ -1541,17 +1542,17 @@ void PressChar(int vkey)
sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]); sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]);
NetSendCmdString(1 << myplr, tempstr); NetSendCmdString(1 << myplr, tempstr);
} }
break; return;
case '|': case '|':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
GiveGoldCheat(); GiveGoldCheat();
} }
break; return;
case '~': case '~':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
StoresCheat(); StoresCheat();
} }
break; return;
#endif #endif
} }
} }

370
Source/engine.cpp

@ -2090,234 +2090,208 @@ void engine_draw_pixel(int sx, int sy)
// 52B99C: using guessed type int gbNotInView; // 52B99C: using guessed type int gbNotInView;
// 69CF0C: using guessed type int gpBufEnd; // 69CF0C: using guessed type int gpBufEnd;
// Exact copy from https://github.com/erich666/GraphicsGems/blob/dad26f941e12c8bf1f96ea21c1c04cd2206ae7c9/gems/DoubleLine.c
// Except:
// * not in view checks
// * global variable instead of reverse flag
// * condition for pixels_left < 0 removed
/* /*
* Xiaolin Wu's anti-aliased line algorithm Symmetric Double Step Line Algorithm
*/ by Brian Wyvill
from "Graphics Gems", Academic Press, 1990
*/
#define GG_SWAP(A, B) \
{ \
(A) ^= (B); \
(B) ^= (A); \
(A) ^= (B); \
}
#define GG_ABSOLUTE(I, J, K) (((I) - (J)) * ((K) = (((I) - (J)) < 0 ? -1 : 1)))
void DrawLine(int x0, int y0, int x1, int y1, BYTE col) void DrawLine(int x0, int y0, int x1, int y1, BYTE col)
{ {
int i, sx, sy, dx, dy, nx, ny, xlen, ylen, pixels, remain, xy_same, line_dir, mult_2, mult_4; int dx, dy, incr1, incr2, D, x, y, xend, c, pixels_left;
int sign_x, sign_y, step, i;
int x1_, y1_;
gbPixelCol = col; gbPixelCol = col;
gbNotInView = FALSE; gbNotInView = FALSE;
if(x0 < 0 + 64 || x0 >= 640 + 64) { if (x0 < 0 + 64 || x0 >= 640 + 64) {
gbNotInView = TRUE; gbNotInView = TRUE;
} }
if(x1 < 0 + 64 || x1 >= 640 + 64) { if (x1 < 0 + 64 || x1 >= 640 + 64) {
gbNotInView = TRUE; gbNotInView = TRUE;
} }
if(y0 < 0 + 160 || y0 >= 352 + 160) { if (y0 < 0 + 160 || y0 >= 352 + 160) {
gbNotInView = TRUE; gbNotInView = TRUE;
} }
if(y1 < 0 + 160 || y1 >= 352 + 160) { if (y1 < 0 + 160 || y1 >= 352 + 160) {
gbNotInView = TRUE; gbNotInView = TRUE;
} }
if(x1 - x0 < 0) { dx = GG_ABSOLUTE(x1, x0, sign_x);
nx = -1; dy = GG_ABSOLUTE(y1, y0, sign_y);
} else { /* decide increment sign by the slope sign */
nx = 1; if (sign_x == sign_y)
} step = 1;
xlen = nx * (x1 - x0); else
step = -1;
if(y1 - y0 < 0) {
ny = -1;
} else {
ny = 1;
}
ylen = ny * (y1 - y0);
if(ny == nx) {
xy_same = 1;
} else {
xy_same = -1;
}
if(ylen > xlen) { if (dy > dx) { /* chooses axis of greatest movement (make
x0 ^= y0 ^= x0 ^= y0; * dx) */
x1 ^= y1 ^= x1 ^= y1; GG_SWAP(x0, y0);
xlen ^= ylen ^= xlen ^= ylen; GG_SWAP(x1, y1);
GG_SWAP(dx, dy);
gbRotateMap = TRUE; gbRotateMap = TRUE;
} else { } else
gbRotateMap = FALSE; gbRotateMap = FALSE;
} /* note error check for dx==0 should be included here */
if (x0 > x1) { /* start from the smaller coordinate */
if(x0 > x1) { x = x1;
sx = x1; y = y1;
sy = y1; x1_ = x0;
dx = x0; y1_ = y0;
dy = y0;
} else { } else {
sx = x0; x = x0;
sy = y0; y = y0;
dx = x1; x1_ = x1;
dy = y1; y1_ = y1;
} }
pixels = (xlen - 1) / 4; /* Note dx=n implies 0 - n or (dx+1) pixels to be set */
remain = (xlen - 1) % 4; /* Go round loop dx/4 times then plot last 0,1,2 or 3 pixels */
engine_draw_pixel(sx, sy); /* In fact (dx-1)/4 as 2 pixels are already plotted */
engine_draw_pixel(dx, dy); xend = (dx - 1) / 4;
pixels_left = (dx - 1) % 4; /* number of pixels left over at the end */
line_dir = (ylen << 2) - xlen - xlen; engine_draw_pixel(x, y);
if(line_dir < 0) { engine_draw_pixel(x1_, y1_); /* plot first two points */
mult_2 = ylen << 1; incr2 = 4 * dy - 2 * dx;
mult_4 = (mult_2 << 1) - xlen; if (incr2 < 0) { /* slope less than 1/2 */
for(i = 0; i < pixels; i++) { c = 2 * dy;
sx++; incr1 = 2 * c;
dx--; D = incr1 - dx;
if(mult_4 < 0) {
engine_draw_pixel(sx, sy); for (i = 0; i < xend; i++) { /* plotting loop */
sx++; ++x;
engine_draw_pixel(sx, sy); --x1_;
engine_draw_pixel(dx, dy); if (D < 0) {
dx--; /* pattern 1 forwards */
engine_draw_pixel(dx, dy); engine_draw_pixel(x, y);
mult_4 += mult_2 + mult_2; engine_draw_pixel(++x, y);
} else if(mult_4 < mult_2) { /* pattern 1 backwards */
engine_draw_pixel(sx, sy); engine_draw_pixel(x1_, y1_);
sy += xy_same; engine_draw_pixel(--x1_, y1_);
sx++; D += incr1;
engine_draw_pixel(sx, sy);
engine_draw_pixel(dx, dy);
dy -= xy_same;
dx--;
engine_draw_pixel(dx, dy);
mult_4 += line_dir;
} else { } else {
sy += xy_same; if (D < c) {
engine_draw_pixel(sx, sy); /* pattern 2 forwards */
sx++; engine_draw_pixel(x, y);
engine_draw_pixel(sx, sy); engine_draw_pixel(++x, y += step);
dy -= xy_same; /* pattern 2 backwards */
engine_draw_pixel(dx, dy); engine_draw_pixel(x1_, y1_);
dx--; engine_draw_pixel(--x1_, y1_ -= step);
engine_draw_pixel(dx, dy); } else {
mult_4 += line_dir; /* pattern 3 forwards */
} engine_draw_pixel(x, y += step);
} engine_draw_pixel(++x, y);
if(remain != 0) { /* pattern 3 backwards */
if(mult_4 < 0) { engine_draw_pixel(x1_, y1_ -= step);
sx++; engine_draw_pixel(--x1_, y1_);
engine_draw_pixel(sx, sy);
if(remain > 1) {
sx++;
engine_draw_pixel(sx, sy);
}
if(remain > 2) {
dx--;
engine_draw_pixel(dx, dy);
}
} else if(mult_4 < mult_2) {
sx++;
engine_draw_pixel(sx, sy);
if(remain > 1) {
sy += xy_same;
sx++;
engine_draw_pixel(sx, sy);
}
if(remain > 2) {
dx--;
engine_draw_pixel(dx, dy);
} }
D += incr2;
}
} /* end for */
/* plot last pattern */
if (pixels_left) {
if (D < 0) {
engine_draw_pixel(++x, y); /* pattern 1 */
if (pixels_left > 1)
engine_draw_pixel(++x, y);
if (pixels_left > 2)
engine_draw_pixel(--x1_, y1_);
} else { } else {
sy += xy_same; if (D < c) {
sx++; engine_draw_pixel(++x, y); /* pattern 2 */
engine_draw_pixel(sx, sy); if (pixels_left > 1)
if(remain > 1) { engine_draw_pixel(++x, y += step);
sx++; if (pixels_left > 2)
engine_draw_pixel(sx, sy); engine_draw_pixel(--x1_, y1_);
} } else {
if(remain > 2) { /* pattern 3 */
dy -= xy_same; engine_draw_pixel(++x, y += step);
dx--; if (pixels_left > 1)
engine_draw_pixel(dx, dy); engine_draw_pixel(++x, y);
if (pixels_left > 2)
engine_draw_pixel(--x1_, y1_ -= step);
} }
} }
} } /* end if pixels_left */
} else { }
mult_2 = (ylen - xlen) << 1; /* end slope < 1/2 */
mult_4 = (mult_2 << 1) + xlen; else { /* slope greater than 1/2 */
for(i = 0; i < pixels; i++) { c = 2 * (dy - dx);
sx++; incr1 = 2 * c;
dx--; D = incr1 + dx;
if(mult_4 > 0) { for (i = 0; i < xend; i++) {
sy += xy_same; ++x;
engine_draw_pixel(sx, sy); --x1_;
sy += xy_same; if (D > 0) {
sx++; /* pattern 4 forwards */
engine_draw_pixel(sx, sy); engine_draw_pixel(x, y += step);
dy -= xy_same; engine_draw_pixel(++x, y += step);
engine_draw_pixel(dx, dy); /* pattern 4 backwards */
dy -= xy_same; engine_draw_pixel(x1_, y1_ -= step);
dx--; engine_draw_pixel(--x1_, y1_ -= step);
engine_draw_pixel(dx, dy); D += incr1;
mult_4 += mult_2 + mult_2;
} else if(mult_4 < mult_2) {
engine_draw_pixel(sx, sy);
sy += xy_same;
sx++;
engine_draw_pixel(sx, sy);
engine_draw_pixel(dx, dy);
dy -= xy_same;
dx--;
engine_draw_pixel(dx, dy);
mult_4 += line_dir;
} else { } else {
sy += xy_same; if (D < c) {
engine_draw_pixel(sx, sy); /* pattern 2 forwards */
sx++; engine_draw_pixel(x, y);
engine_draw_pixel(sx, sy); engine_draw_pixel(++x, y += step);
dy -= xy_same;
engine_draw_pixel(dx, dy); /* pattern 2 backwards */
dx--; engine_draw_pixel(x1_, y1_);
engine_draw_pixel(dx, dy); engine_draw_pixel(--x1_, y1_ -= step);
mult_4 += line_dir; } else {
} /* pattern 3 forwards */
} engine_draw_pixel(x, y += step);
if(remain != 0) { engine_draw_pixel(++x, y);
if(mult_4 > 0) { /* pattern 3 backwards */
sy += xy_same; engine_draw_pixel(x1_, y1_ -= step);
sx++; engine_draw_pixel(--x1_, y1_);
engine_draw_pixel(sx, sy);
if(remain > 1) {
sy += xy_same;
sx++;
engine_draw_pixel(sx, sy);
}
if(remain > 2) {
dy -= xy_same;
dx--;
engine_draw_pixel(dx, dy);
}
} else if(mult_4 < mult_2) {
sx++;
engine_draw_pixel(sx, sy);
if(remain > 1) {
sy += xy_same;
sx++;
engine_draw_pixel(sx, sy);
}
if(remain > 2) {
dx--;
engine_draw_pixel(dx, dy);
} }
D += incr2;
}
} /* end for */
/* plot last pattern */
if (pixels_left) {
if (D > 0) {
engine_draw_pixel(++x, y += step); /* pattern 4 */
if (pixels_left > 1)
engine_draw_pixel(++x, y += step);
if (pixels_left > 2)
engine_draw_pixel(--x1_, y1_ -= step);
} else { } else {
sy += xy_same; if (D < c) {
sx++; engine_draw_pixel(++x, y); /* pattern 2 */
engine_draw_pixel(sx, sy); if (pixels_left > 1)
if(remain > 1) { engine_draw_pixel(++x, y += step);
sx++; if (pixels_left > 2)
engine_draw_pixel(sx, sy); engine_draw_pixel(--x1_, y1_);
} } else {
if(remain > 2) { /* pattern 3 */
if(mult_4 > mult_2) { engine_draw_pixel(++x, y += step);
dy -= xy_same; if (pixels_left > 1)
dx--; engine_draw_pixel(++x, y);
engine_draw_pixel(dx, dy); if (pixels_left > 2) {
} else { if (D > c) /* step 3 */
dx--; engine_draw_pixel(--x1_, y1_ -= step);
engine_draw_pixel(dx, dy); else /* step 2 */
engine_draw_pixel(--x1_, y1_);
} }
} }
} }

46
Source/gmenu.cpp

@ -7,8 +7,8 @@ BOOLEAN mouseNavigation; // weak
void *PentSpin_cel; void *PentSpin_cel;
TMenuItem *sgpCurrItem; TMenuItem *sgpCurrItem;
void *BigTGold_cel; void *BigTGold_cel;
int dword_634474; // weak int PentSpin_tick; // weak
char byte_634478; // weak char PentSpin_frame; // weak
void(*dword_63447C)(TMenuItem *); void(*dword_63447C)(TMenuItem *);
TMenuItem *sgpCurrentMenu; // idb TMenuItem *sgpCurrentMenu; // idb
void *option_cel; void *option_cel;
@ -74,7 +74,7 @@ void FreeGMenu()
void gmenu_init_menu() void gmenu_init_menu()
{ {
byte_634478 = 1; PentSpin_frame = 1;
sgpCurrentMenu = 0; sgpCurrentMenu = 0;
sgpCurrItem = 0; sgpCurrItem = 0;
dword_63447C = 0; dword_63447C = 0;
@ -87,7 +87,7 @@ void gmenu_init_menu()
optbar_cel = LoadFileInMem("Data\\optbar.CEL", 0); optbar_cel = LoadFileInMem("Data\\optbar.CEL", 0);
} }
// 634464: using guessed type char mouseNavigation; // 634464: using guessed type char mouseNavigation;
// 634478: using guessed type char byte_634478; // 634478: using guessed type char PentSpin_frame;
// 63448C: using guessed type int sgCurrentMenuIdx; // 63448C: using guessed type int sgCurrentMenuIdx;
BOOL gmenu_exception() BOOL gmenu_exception()
@ -161,29 +161,33 @@ void gmenu_up_down(BOOL isDown)
void gmenu_draw() void gmenu_draw()
{ {
int v0; // edi int y;
TMenuItem *i; // esi TMenuItem *i;
DWORD v2; // eax DWORD ticks;
if (sgpCurrentMenu) { if (sgpCurrentMenu) {
if (dword_63447C) if (dword_63447C)
dword_63447C(sgpCurrentMenu); dword_63447C(sgpCurrentMenu);
CelDecodeOnly(236, 262, (BYTE *)sgpLogo, 1, 296); CelDecodeOnly(236, 262, (BYTE *)sgpLogo, 1, 296);
v0 = 320; y = 320;
for (i = sgpCurrentMenu; i->fnMenu; v0 += 45) { i = sgpCurrentMenu;
gmenu_draw_menu_item(i, v0); if (sgpCurrentMenu->fnMenu) {
++i; while (i->fnMenu) {
gmenu_draw_menu_item(i, y);
i++;
y += 45;
}
} }
v2 = GetTickCount();
if ((signed int)(v2 - dword_634474) > 25) { ticks = GetTickCount();
if (++byte_634478 == 9) if ((int)(ticks - PentSpin_tick) > 25) {
byte_634478 = 1; PentSpin_frame++;
dword_634474 = v2; if (PentSpin_frame == 9)
PentSpin_frame = 1;
PentSpin_tick = ticks;
} }
} }
} }
// 634474: using guessed type int dword_634474;
// 634478: using guessed type char byte_634478;
void gmenu_draw_menu_item(TMenuItem *pItem, int a2) void gmenu_draw_menu_item(TMenuItem *pItem, int a2)
{ {
@ -226,11 +230,11 @@ void gmenu_draw_menu_item(TMenuItem *pItem, int a2)
gmenu_print_text(384 - (v5 >> 1), v2, v3->pszStr); gmenu_print_text(384 - (v5 >> 1), v2, v3->pszStr);
if (v3 == sgpCurrItem) { if (v3 == sgpCurrItem) {
v13 = v2 + 1; v13 = v2 + 1;
CelDecodeOnly(v11 - 54, v13, (BYTE *)PentSpin_cel, (unsigned char)byte_634478, 48); CelDecodeOnly(v11 - 54, v13, (BYTE *)PentSpin_cel, (unsigned char)PentSpin_frame, 48);
CelDecodeOnly(v11 + v5 + 4, v13, (BYTE *)PentSpin_cel, (unsigned char)byte_634478, 48); CelDecodeOnly(v11 + v5 + 4, v13, (BYTE *)PentSpin_cel, (unsigned char)PentSpin_frame, 48);
} }
} }
// 634478: using guessed type char byte_634478; // 634478: using guessed type char PentSpin_frame;
// 69BEF8: using guessed type int light_table_index; // 69BEF8: using guessed type int light_table_index;
void gmenu_clear_buffer(int x, int y, int width, int height) void gmenu_clear_buffer(int x, int y, int width, int height)

55
Source/init.cpp

@ -328,38 +328,35 @@ char *init_strip_trailing_slash(char *path)
return result; return result;
} }
int init_read_test_file(char *mpq_path, char *mpq_name, int flags, HANDLE *archive) BOOL init_read_test_file(char *pszPath, char *pszArchive, int flags, HANDLE *phArchive)
{ {
char *v4; // edi DWORD dwSize;
DWORD v5; // eax char *pszDrive, *pszRoot;
const char *v7; // ebx char szDrive[MAX_PATH];
const char *v8; // esi
char Buffer[MAX_PATH]; // [esp+Ch] [ebp-108h] dwSize = GetLogicalDriveStrings(sizeof(szDrive), szDrive);
char *mpq_patha; // [esp+110h] [ebp-4h] if(dwSize == 0 || dwSize > sizeof(szDrive)) {
return FALSE;
v4 = mpq_name; }
mpq_patha = mpq_path;
v5 = GetLogicalDriveStrings(sizeof(Buffer), Buffer); while(*pszArchive == '\\') {
if (!v5 || v5 > sizeof(Buffer)) pszArchive++;
return 0; }
while (*v4 == '\\')
++v4; pszDrive = szDrive;
v7 = Buffer; while(*pszDrive != '\0') {
if (!Buffer[0]) pszRoot = pszDrive;
return 0; while(*pszDrive++ != '\0');
while (1) { if(GetDriveType(pszRoot) == DRIVE_CDROM) {
v8 = v7; strcpy(pszPath, pszRoot);
v7 += strlen(v7) + 1; strcat(pszPath, pszArchive);
if (GetDriveType(v8) == DRIVE_CDROM) { if(SFileOpenArchive(pszPath, flags, 1, phArchive)) {
strcpy(mpq_patha, v8); return TRUE;
strcat(mpq_patha, v4); }
if (SFileOpenArchive(mpq_patha, flags, 1, archive))
break;
} }
if (!*v7)
return 0;
} }
return 1;
return FALSE;
} }
void init_get_file_info() void init_get_file_info()

2
Source/init.h

@ -25,7 +25,7 @@ void init_await_mom_parent_exit();
void init_archives(); void init_archives();
HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int flags, int fs); HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int flags, int fs);
char *init_strip_trailing_slash(char *path); char *init_strip_trailing_slash(char *path);
int init_read_test_file(char *mpq_path, char *mpq_name, int flags, HANDLE *archive); BOOL init_read_test_file(char *pszPath, char *pszArchive, int flags, HANDLE *phArchive);
void init_get_file_info(); void init_get_file_info();
LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void init_activate_window(HWND hWnd, BOOL bActive); void init_activate_window(HWND hWnd, BOOL bActive);

39
Source/items.cpp

@ -1992,24 +1992,23 @@ void SpawnUnique(int uid, int x, int y)
{ {
int ii, itype; int ii, itype;
if (numitems < MAXITEMS) { if (numitems >= MAXITEMS)
ii = itemavail[0]; return;
GetSuperItemSpace(x, y, itemavail[0]);
itype = 0;
itemactive[numitems] = ii;
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
if (AllItemsList[0].iItemId != UniqueItemList[uid].UIItemId) { ii = itemavail[0];
while (AllItemsList[itype].iItemId != UniqueItemList[uid].UIItemId) { GetSuperItemSpace(x, y, ii);
itype++; itemavail[0] = itemavail[MAXITEMS - numitems - 1];
} itemactive[numitems] = ii;
}
GetItemAttrs(ii, itype, currlevel); itype = 0;
GetUniqueItem(ii, uid); while (AllItemsList[itype].iItemId != UniqueItemList[uid].UIItemId) {
SetupItem(ii); itype++;
numitems++;
} }
GetItemAttrs(ii, itype, currlevel);
GetUniqueItem(ii, uid);
SetupItem(ii);
numitems++;
} }
void ItemRndDur(int ii) void ItemRndDur(int ii)
@ -2356,7 +2355,7 @@ void SpawnRock()
item[i]._ix = xx; item[i]._ix = xx;
item[i]._iy = yy; item[i]._iy = yy;
dItem[xx][item[i]._iy] = i + 1; dItem[xx][item[i]._iy] = i + 1;
GetItemAttrs(i, 7, currlevel); GetItemAttrs(i, IDI_ROCK, currlevel);
SetupItem(i); SetupItem(i);
item[i]._iSelFlag = 2; item[i]._iSelFlag = 2;
item[i]._iPostDraw = 1; item[i]._iPostDraw = 1;
@ -2372,10 +2371,10 @@ void RespawnItem(int i, BOOL FlipFlag)
it = ItemCAnimTbl[item[i]._iCurs]; it = ItemCAnimTbl[item[i]._iCurs];
item[i]._iAnimData = itemanims[it]; item[i]._iAnimData = itemanims[it];
item[i]._iAnimLen = ItemAnimLs[it]; item[i]._iAnimLen = ItemAnimLs[it];
item[i]._iRequest = FALSE;
item[i]._iAnimWidth = 96; item[i]._iAnimWidth = 96;
item[i]._iAnimWidth2 = 16; item[i]._iAnimWidth2 = 16;
item[i]._iPostDraw = FALSE; item[i]._iPostDraw = FALSE;
item[i]._iRequest = FALSE;
if (FlipFlag) { if (FlipFlag) {
item[i]._iAnimFrame = 1; item[i]._iAnimFrame = 1;
item[i]._iAnimFlag = TRUE; item[i]._iAnimFlag = TRUE;
@ -2470,10 +2469,10 @@ void GetItemStr(int i)
int nGold; int nGold;
if (item[i]._itype != ITYPE_GOLD) { if (item[i]._itype != ITYPE_GOLD) {
if (!item[i]._iIdentified) if (item[i]._iIdentified)
strcpy(infostr, item[i]._iName);
else
strcpy(infostr, item[i]._iIName); strcpy(infostr, item[i]._iIName);
else
strcpy(infostr, item[i]._iName);
if (item[i]._iMagical == ITEM_QUALITY_MAGIC) if (item[i]._iMagical == ITEM_QUALITY_MAGIC)
infoclr = COL_BLUE; infoclr = COL_BLUE;

10
Source/lighting.cpp

@ -916,12 +916,12 @@ void MakeLightTable()
*tbl++ = 0; *tbl++ = 0;
} }
for (i = 0; i < 16; i++) { for (k = 0; k < 16; k++) {
for (j = 0; j < 128; j++) { for (l = 0; l < 128; l++) {
if (j > (i + 1) * 8) { /* check */ if (l > (k + 1) * 8) {
lightradius[i][j] = 15; lightradius[k][l] = 15;
} else { } else {
lightradius[i][j] = j * 15.0 / ((i + 1) * 8.0) + 0.5; lightradius[k][l] = l * 15.0 / ((k + 1) * 8.0) + 0.5;
} }
} }
} }

1
Source/list.h

@ -152,6 +152,7 @@ void TList<T>::Insert(T *node, InsertPos pos, T *ref)
break; break;
case BEFORE: case BEFORE:
i->InsertBefore(node, reflink); i->InsertBefore(node, reflink);
break;
} }
} }

4
Source/mainmenu.cpp

@ -20,9 +20,9 @@ void mainmenu_refresh_music()
} while (!menu_music_track_id || menu_music_track_id == 1); } while (!menu_music_track_id || menu_music_track_id == 1);
} }
void __stdcall mainmenu_create_hero(char *name_1, char *name_2) void __stdcall mainmenu_create_hero(int arg1, int arg2, int arg3, int arg4, char *name_1, char *name_2)
{ {
if (UiValidPlayerName(name_1)) if (UiValidPlayerName(name_2))
pfile_create_save_file(name_1, name_2); pfile_create_save_file(name_1, name_2);
} }

2
Source/mainmenu.h

@ -5,7 +5,7 @@
extern char gszHero[16]; extern char gszHero[16];
void mainmenu_refresh_music(); void mainmenu_refresh_music();
void __stdcall mainmenu_create_hero(char *name_1, char *name_2); void __stdcall mainmenu_create_hero(int arg1, int arg2, int arg3, int arg4, char *name_1, char *name_2);
int __stdcall mainmenu_select_hero_dialog( int __stdcall mainmenu_select_hero_dialog(
const _SNETPROGRAMDATA *client_info, const _SNETPROGRAMDATA *client_info,
const _SNETPLAYERDATA *user_info, const _SNETPLAYERDATA *user_info,

148
Source/missiles.cpp

@ -1750,7 +1750,7 @@ BOOL CheckIfTrig(int x, int y)
{ {
int i; int i;
for (i = 0; i < trigflag_4; i++) { for (i = 0; i < numtrigs; i++) {
if ((x == trigs[i]._tx && y == trigs[i]._ty) || (abs(trigs[i]._tx - x) < 2 && abs(trigs[i]._ty - y) < 2)) if ((x == trigs[i]._tx && y == trigs[i]._ty) || (abs(trigs[i]._tx - x) < 2 && abs(trigs[i]._ty - y) < 2))
return TRUE; return TRUE;
} }
@ -3188,80 +3188,90 @@ void MI_Fireball(int i)
void MI_Lightctrl(int i) void MI_Lightctrl(int i)
{ {
int v1; // esi int pn, dam, p, mx, my;
int v2; // eax
int v3; // eax
int v5; // edi
signed int v6; // ebx
signed int v7; // edx
int v8; // ecx
int v9; // eax
int v10; // [esp-10h] [ebp-24h]
int v11; // [esp-Ch] [ebp-20h]
int v12; // [esp-8h] [ebp-1Ch]
int v13; // [esp+Ch] [ebp-8h]
int ia; // [esp+10h] [ebp-4h]
ia = i; /// ASSERT: assert((DWORD)i < MAXMISSILES);
v1 = i; missile[i]._mirange--;
v2 = missile[i]._misource;
--missile[v1]._mirange; p = missile[i]._misource;
if (v2 == -1) { if(p != -1) {
v5 = random(81, currlevel) + 2 * currlevel; if(missile[i]._micaster == 0) {
} else if (missile[v1]._micaster) { dam = (random(79, 2) + random(79, plr[p]._pLevel) + 2) << 6;
v5 = 2
* ((unsigned char)monster[v2].mMinDamage
+ random(80, (unsigned char)monster[v2].mMaxDamage - (unsigned char)monster[v2].mMinDamage + 1));
} else {
v3 = random(79, plr[v2]._pLevel);
v5 = (v3 + random(79, 2) + 2) << 6;
}
missile[v1]._mitxoff += missile[v1]._mixvel;
missile[v1]._mityoff += missile[v1]._miyvel;
GetMissilePos(ia);
v6 = missile[v1]._mix;
v7 = missile[v1]._miy;
v8 = missile[v1]._misource;
v13 = missile[v1]._miy;
v9 = dPiece[missile[v1]._mix][v7];
if (v8 != -1 || v6 != missile[v1]._misx || v7 != missile[v1]._misy) {
if (!nMissileTable[v9])
goto LABEL_12;
missile[v1]._mirange = 0;
}
if (!nMissileTable[v9]) {
LABEL_12:
if (v6 == missile[v1]._miVar1 && v7 == missile[v1]._miVar2 || v6 <= 0 || v7 <= 0 || v6 >= MAXDUNX || v7 >= MAXDUNY)
goto LABEL_27;
if (v8 == -1) {
v12 = missile[v1]._mispllvl;
v11 = v5;
v10 = -1;
} else { } else {
if (missile[v1]._micaster == 1) { dam = 2 * (monster[p].mMinDamage + random(80, monster[p].mMaxDamage - monster[p].mMinDamage + 1));
v9 = (int)monster[v8].MType; }
_LOBYTE(v9) = *(_BYTE *)v9; } else {
if ((unsigned char)v9 >= MT_STORM && (unsigned char)v9 <= MT_MAEL) { dam = random(81, currlevel) + 2 * currlevel;
_LOBYTE(v9) = missile[v1]._micaster; }
AddMissile(v6, v7, missile[v1]._misx, missile[v1]._misy, ia, MIS_LIGHTNING2, v9, v8, v5, missile[v1]._mispllvl);
LABEL_26: missile[i]._mitxoff += missile[i]._mixvel;
v7 = v13; missile[i]._mityoff += missile[i]._miyvel;
missile[v1]._miVar1 = missile[v1]._mix; GetMissilePos(i);
missile[v1]._miVar2 = missile[v1]._miy;
goto LABEL_27; mx = missile[i]._mix;
my = missile[i]._miy;
/// ASSERT: assert((DWORD)mx < MAXDUNX);
/// ASSERT: assert((DWORD)my < MAXDUNY);
pn = dPiece[mx][my];
/// ASSERT: assert((DWORD)pn <= MAXTILES);
if(missile[i]._misource == -1) {
if((mx != missile[i]._misx || my != missile[i]._misy) && nMissileTable[pn] != 0) {
missile[i]._mirange = 0;
}
} else if(nMissileTable[pn] != 0) {
missile[i]._mirange = 0;
}
if(nMissileTable[pn] == 0) {
if((mx != missile[i]._miVar1 || my != missile[i]._miVar2) && mx > 0 && my > 0 && mx < MAXDUNX && my < MAXDUNY) {
if(missile[i]._misource != -1) {
if(missile[i]._micaster == 1
&& monster[missile[i]._misource].MType->mtype >= MT_STORM
&& monster[missile[i]._misource].MType->mtype <= MT_MAEL) {
AddMissile(
mx,
my,
missile[i]._misx,
missile[i]._misy,
i,
MIS_LIGHTNING2,
missile[i]._micaster,
missile[i]._misource,
dam,
missile[i]._mispllvl);
} else {
AddMissile(
mx,
my,
missile[i]._misx,
missile[i]._misy,
i,
MIS_LIGHTNING,
missile[i]._micaster,
missile[i]._misource,
dam,
missile[i]._mispllvl);
} }
} else {
AddMissile(
mx,
my,
missile[i]._misx,
missile[i]._misy,
i,
MIS_LIGHTNING,
missile[i]._micaster,
missile[i]._misource,
dam,
missile[i]._mispllvl);
} }
v12 = missile[v1]._mispllvl; missile[i]._miVar1 = missile[i]._mix;
v11 = v5; missile[i]._miVar2 = missile[i]._miy;
v10 = v8;
} }
_LOBYTE(v9) = missile[v1]._micaster;
AddMissile(v6, v7, missile[v1]._misx, missile[v1]._misy, ia, MIS_LIGHTNING, v9, v10, v11, v12);
goto LABEL_26;
} }
LABEL_27: if(missile[i]._mirange == 0 || mx <= 0 || my <= 0 || mx >= MAXDUNX || my > MAXDUNY) {
if (!missile[v1]._mirange || v6 <= 0 || v7 <= 0 || v6 >= MAXDUNX || v7 > MAXDUNY) missile[i]._miDelFlag = TRUE;
missile[v1]._miDelFlag = TRUE; }
} }
void MI_Lightning(int i) void MI_Lightning(int i)

667
Source/monster.cpp

@ -958,7 +958,7 @@ void InitMonsters()
if (!setlevel && currlevel == 16) if (!setlevel && currlevel == 16)
LoadDiabMonsts(); LoadDiabMonsts();
} }
nt = trigflag_4; nt = numtrigs;
if (currlevel == 15) if (currlevel == 15)
nt = 1; nt = 1;
for (i = 0; i < nt; i++) { for (i = 0; i < nt; i++) {
@ -1698,6 +1698,8 @@ void M2MStartKill(int i, int mid)
if ((DWORD)i >= MAXMONSTERS) { if ((DWORD)i >= MAXMONSTERS) {
app_fatal("M2MStartKill: Invalid monster (attacker) %d", i); app_fatal("M2MStartKill: Invalid monster (attacker) %d", i);
}
if ((DWORD)i >= MAXMONSTERS) { /// BUGFIX: should check `mid`
app_fatal("M2MStartKill: Invalid monster (killed) %d", mid); app_fatal("M2MStartKill: Invalid monster (killed) %d", mid);
} }
if (!monster[i].MType) if (!monster[i].MType)
@ -3040,173 +3042,84 @@ BOOL MAI_Path(int i)
void MAI_Snake(int i) void MAI_Snake(int i)
{ {
int esi1; // esi MonsterStruct *Monst;
MonsterStruct *esi3; // esi int fx, fy, mx, my, md;
BOOLEAN v3; // zf int pnum;
int v4; // ecx int tmp;
int v5; // eax
int v6; // ST1C_4
int v7; // edi
int v8; // edx
int v9; // ST18_4
int v10; // ebx
int v11; // eax
//int v12; // ST1C_4
int v14; // eax
int v15; // eax
int v16; // ecx
int v17; // edx
int v18; // ecx
int v19; // eax
//int v20; // ST1C_4
int v22; // eax
//int v23; // ST1C_4
int v24; // ebx
int v26; // ecx
int v27; // eax
int v28; // ecx
int v29; // ecx
int v30; // eax
int v31; // edx
int v32; // eax
int v33; // ecx
int v34; // ecx
int v35; // eax
char pattern[6]; // [esp+4h] [ebp-1Ch]
int micaster; // [esp+Ch] [ebp-14h]
int midir; // [esp+10h] [ebp-10h]
int v1; // [esp+14h] [ebp-Ch]
int v2; // [esp+18h] [ebp-8h]
int arglist; // [esp+1Ch] [ebp-4h]
esi1 = i;
arglist = i;
if ((DWORD)i >= MAXMONSTERS) if ((DWORD)i >= MAXMONSTERS)
app_fatal("MAI_Snake: Invalid monster %d", i); app_fatal("MAI_Snake: Invalid monster %d", i);
pattern[2] = 0; char pattern[6] = { 1, 1, 0, -1, -1, 0 };
pattern[3] = -1; Monst = monster + i;
pattern[4] = -1; pnum = Monst->_menemy;
pattern[5] = 0; if (Monst->_mmode != MM_STAND || !Monst->_msquelch)
esi3 = &monster[esi1]; return;
pattern[0] = 1; fx = Monst->_menemyx;
pattern[1] = 1; fy = Monst->_menemyy;
v3 = esi3->_mmode == MM_STAND; mx = Monst->_mx - fx;
micaster = esi3->_menemy; my = Monst->_my - fy;
if (v3 && esi3->_msquelch) { md = GetDirection(Monst->_mx, Monst->_my, Monst->_lastx, Monst->_lasty);
v4 = esi3->_mx; Monst->_mdir = md;
v5 = (unsigned char)esi3->_menemyy; if (abs(mx) >= 2 || abs(my) >= 2) {
v6 = esi3->_lasty; if (abs(mx) < 3 && abs(my) < 3 && LineClearF1(PosOkMonst, i, Monst->_mx, Monst->_my, fx, fy) && Monst->_mVar1 != MM_CHARGE) {
v1 = (unsigned char)esi3->_menemyx; if (AddMissile(Monst->_mx, Monst->_my, fx, fy, md, MIS_RHINO, pnum, i, 0, 0) != -1) {
v7 = v4 - v1; PlayEffect(i, 0);
v8 = esi3->_my; Monst->_mmode = MM_CHARGE;
v9 = esi3->_lastx; dMonster[Monst->_mx][Monst->_my] = -1 - i;
v2 = v5;
v10 = v8 - v5;
midir = GetDirection(v4, v8, v9, v6);
esi3->_mdir = midir;
if (abs(v7) < 2) {
v11 = abs(v10);
//v13 = v12;
if (v11 < 2) {
v14 = esi3->_mVar1;
if (v14 == MM_DELAY
|| v14 == MM_CHARGE
|| (v15 = random(105, 100), v16 = (unsigned char)esi3->_mint + 20, v15 < v16)) {
M_StartAttack(arglist);
LABEL_49:
if (esi3->_mmode == MM_STAND)
esi3->_mAnimData = esi3->MType->Anims[MA_STAND].Data[esi3->_mdir];
return;
}
v17 = 10 - (unsigned char)esi3->_mint + random(105, 10);
v18 = arglist;
LABEL_11:
M_StartDelay(v18, v17);
goto LABEL_49;
}
}
v19 = abs(v7);
//v21 = v20;
if (v19 >= 3 || (v22 = abs(v10), v22 >= 3)) /* v21 = v23, */
{
v24 = arglist;
} else {
v24 = arglist;
if (LineClearF1(PosOkMonst, arglist, esi3->_mx, esi3->_my, v1, v2) && esi3->_mVar1 != MM_CHARGE) {
if (AddMissile(esi3->_mx, esi3->_my, v1, v2, midir, MIS_RHINO, micaster, arglist, 0, 0) != -1) {
PlayEffect(arglist, 0);
v26 = esi3->_my + 112 * esi3->_mx;
esi3->_mmode = MM_CHARGE;
dMonster[0][v26] = -1 - v24;
}
goto LABEL_49;
}
}
if (esi3->_mVar1 != MM_DELAY) {
v27 = random(106, 100);
v28 = 2 * (unsigned char)esi3->_mint;
if (v27 < 35 - v28) {
v17 = 15 - (unsigned char)esi3->_mint + random(106, 10);
v18 = v24;
goto LABEL_11;
}
}
v29 = esi3->_mgoalvar1;
v30 = midir + pattern[v29];
if (v30 >= 0) {
v31 = v30 - 8;
if (v30 < 8)
v31 = midir + pattern[v29];
} else {
v31 = v30 + 8;
}
esi3->_mgoalvar1 = v29 + 1;
if (v29 + 1 > 5)
esi3->_mgoalvar1 = 0;
v32 = esi3->_mgoalvar2;
v33 = v31 - v32;
if (v31 - v32 >= 0) {
if (v33 >= 8)
v33 -= 8;
} else {
v33 += 8;
}
if (v33 <= 0) {
LABEL_47:
if (!M_DumbWalk(v24, esi3->_mgoalvar2))
M_CallWalk2(v24, esi3->_mdir);
goto LABEL_49;
}
if (v33 >= 4) {
if (v33 == 4) {
esi3->_mgoalvar2 = v31;
goto LABEL_47;
} }
v34 = v32 - 1; } else if (Monst->_mVar1 == MM_DELAY || random(106, 100) >= 35 - 2 * Monst->_mint) {
if (v32 - 1 < 0) { if (md + pattern[Monst->_mgoalvar1] < 0) {
v35 = v32 + 7; tmp = md + pattern[Monst->_mgoalvar1] + 8;
goto LABEL_46; } else {
tmp = md + pattern[Monst->_mgoalvar1] - 8;
if (md + pattern[Monst->_mgoalvar1] < 8)
tmp = md + pattern[Monst->_mgoalvar1];
} }
if (v34 >= 8) { Monst->_mgoalvar1++;
v35 = v32 - 9; if (Monst->_mgoalvar1 > 5)
goto LABEL_46; Monst->_mgoalvar1 = 0;
if (tmp - Monst->_mgoalvar2 < 0) {
md = tmp - Monst->_mgoalvar2 + 8;
} else if (tmp - Monst->_mgoalvar2 >= 8) {
md = tmp - Monst->_mgoalvar2 - 8;
} else
md = tmp - Monst->_mgoalvar2;
if (md > 0) {
if (md < 4) {
if (Monst->_mgoalvar2 + 1 < 0) {
md = Monst->_mgoalvar2 + 9;
} else if (Monst->_mgoalvar2 + 1 >= 8) {
md = Monst->_mgoalvar2 - 7;
} else
md = Monst->_mgoalvar2 + 1;
Monst->_mgoalvar2 = md;
} else if (md == 4) {
Monst->_mgoalvar2 = tmp;
} else {
if (Monst->_mgoalvar2 - 1 < 0) {
md = Monst->_mgoalvar2 + 7;
} else if (Monst->_mgoalvar2 - 1 >= 8) {
md = Monst->_mgoalvar2 - 9;
} else
md = Monst->_mgoalvar2 - 1;
Monst->_mgoalvar2 = md;
}
} }
if (!M_DumbWalk(i, Monst->_mgoalvar2))
M_CallWalk2(i, Monst->_mdir);
} else { } else {
v34 = v32 + 1; M_StartDelay(i, 15 - Monst->_mint + random(106, 10));
if (v32 + 1 < 0) {
v35 = v32 + 9;
LABEL_46:
esi3->_mgoalvar2 = v35;
goto LABEL_47;
}
if (v34 >= 8) {
v35 = v32 - 7;
goto LABEL_46;
}
} }
v35 = v34; } else {
goto LABEL_46; if (Monst->_mVar1 == MM_DELAY
|| Monst->_mVar1 == MM_CHARGE
|| (random(105, 100) < Monst->_mint + 20)) {
M_StartAttack(i);
} else
M_StartDelay(i, 10 - Monst->_mint + random(105, 10));
} }
if (Monst->_mmode == MM_STAND)
Monst->_mAnimData = Monst->MType->Anims[MA_STAND].Data[Monst->_mdir];
} }
void MAI_Bat(int i) void MAI_Bat(int i)
@ -3354,87 +3267,64 @@ void MAI_Fat(int i)
void MAI_Sneak(int i) void MAI_Sneak(int i)
{ {
int v1; // edi MonsterStruct *Monst;
MonsterStruct *v2; // esi int mx, my, md;
int v3; // ebx int dist, v;
int v4; // ebx
int v6; // edi
int v7; // eax
//int v8; // ST04_4
int v9; // eax
//int v10; // ST04_4
int v11; // eax
int v12; // edi
signed int v13; // ecx
int v14; // eax
int v15; // [esp+Ch] [ebp-10h]
int arglist; // [esp+10h] [ebp-Ch]
int v17; // [esp+14h] [ebp-8h]
int md; // [esp+18h] [ebp-4h]
v1 = i;
arglist = i;
if ((DWORD)i >= MAXMONSTERS) { if ((DWORD)i >= MAXMONSTERS) {
app_fatal("MAI_Sneak: Invalid monster %d", i); app_fatal("MAI_Sneak: Invalid monster %d", i);
} }
v2 = &monster[v1]; Monst = monster + i;
if (v2->_mmode == MM_STAND) { if (Monst->_mmode == MM_STAND) {
v3 = v2->_my; mx = Monst->_mx;
if (dLight[v2->_mx][v3] != lightmax) { my = Monst->_my;
v17 = v2->_mx - (unsigned char)v2->_menemyx; if (dLight[mx][my] != lightmax) {
v4 = v3 - (unsigned char)v2->_menemyy; mx -= Monst->_menemyx;
md = M_GetDir(v1); my -= Monst->_menemyy;
v6 = 5 - (unsigned char)v2->_mint;
if (v2->_mVar1 == MM_GOTHIT) { md = M_GetDir(i);
v2->_mgoalvar1 = 0; dist = 5 - Monst->_mint;
_LOBYTE(v2->_mgoal) = MGOAL_RETREAT; if (Monst->_mVar1 == MM_GOTHIT) {
Monst->_mgoalvar1 = 0;
Monst->_mgoal = MGOAL_RETREAT;
} else { } else {
v7 = abs(v17); if (abs(mx) >= dist + 3 || abs(my) >= dist + 3 || Monst->_mgoalvar1 > 8) {
//v5 = v8; Monst->_mgoalvar1 = 0;
if (v7 >= v6 + 3 || (v9 = abs(v4), v9 >= v6 + 3) || v2->_mgoalvar1 > 8) /* v5 = v10, */ Monst->_mgoal = MGOAL_NORMAL;
{
v2->_mgoalvar1 = 0;
_LOBYTE(v2->_mgoal) = MGOAL_NORMAL;
} }
} }
if (_LOBYTE(v2->_mgoal) == MGOAL_RETREAT) { if (Monst->_mgoal == MGOAL_RETREAT) {
if (v2->_mFlags & MFLAG_TARGETS_MONSTER) if (Monst->_mFlags & MFLAG_TARGETS_MONSTER)
md = GetDirection(v2->_mx, v2->_my, plr[v2->_menemy]._pownerx, plr[v2->_menemy]._pownery); md = GetDirection(Monst->_mx, Monst->_my, plr[Monst->_menemy]._pownerx, plr[Monst->_menemy]._pownery);
md = opposite[md]; md = opposite[md];
if (v2->MType->mtype == MT_UNSEEN) { if (Monst->MType->mtype == MT_UNSEEN) {
if (random(112, 2)) if (random(112, 2))
v11 = left[md]; md = left[md];
else else
v11 = right[md]; md = right[md];
md = v11;
} }
} }
v2->_mdir = md; Monst->_mdir = md;
v15 = random(112, 100); v = random(112, 100);
if (abs(v17) < v6 && abs(v4) < v6 && v2->_mFlags & MFLAG_HIDDEN) { if (abs(mx) < dist && abs(my) < dist && Monst->_mFlags & MFLAG_HIDDEN) {
M_StartFadein(arglist, md, FALSE); M_StartFadein(i, md, FALSE);
} else { } else {
v12 = v6 + 1; if ((abs(mx) >= dist + 1 || abs(my) >= dist + 1) && !(Monst->_mFlags & MFLAG_HIDDEN)) {
if (abs(v17) < v12 && abs(v4) < v12 || v2->_mFlags & MFLAG_HIDDEN) { M_StartFadeout(i, md, TRUE);
if (_LOBYTE(v2->_mgoal) == MGOAL_RETREAT
|| (abs(v17) >= 2 || abs(v4) >= 2)
&& ((v13 = v2->_mVar2, v13 > 20) && v15 < 4 * (unsigned char)v2->_mint + 14
|| ((v14 = v2->_mVar1, v14 == MM_WALK) || v14 == MM_WALK2 || v14 == MM_WALK3)
&& !v13
&& v15 < 4 * (unsigned char)v2->_mint + 64)) {
++v2->_mgoalvar1;
M_CallWalk(arglist, md);
}
} else { } else {
M_StartFadeout(arglist, md, TRUE); if (Monst->_mgoal == MGOAL_RETREAT
|| (abs(mx) >= 2 || abs(my) >= 2) && (Monst->_mVar2 > 20 && v < 4 * Monst->_mint + 14 || (Monst->_mVar1 == MM_WALK || Monst->_mVar1 == MM_WALK2 || Monst->_mVar1 == MM_WALK3) && Monst->_mVar2 == 0 && v < 4 * Monst->_mint + 64)) {
Monst->_mgoalvar1++;
M_CallWalk(i, md);
}
} }
} }
if (v2->_mmode == MM_STAND) { if (Monst->_mmode == MM_STAND) {
if (abs(v17) >= 2 || abs(v4) >= 2 || v15 >= 4 * (unsigned char)v2->_mint + 10) if (abs(mx) >= 2 || abs(my) >= 2 || v >= 4 * Monst->_mint + 10)
v2->_mAnimData = v2->MType->Anims[MA_STAND].Data[md]; Monst->_mAnimData = Monst->MType->Anims[MA_STAND].Data[md];
else else
M_StartAttack(arglist); M_StartAttack(i);
} }
} }
} }
@ -3606,112 +3496,60 @@ void MAI_Cleaver(int i)
void MAI_Round(int i, BOOL special) void MAI_Round(int i, BOOL special)
{ {
int v2; // esi MonsterStruct *Monst;
MonsterStruct *v3; // esi int fx, fy;
int v4; // edx int mx, my, md;
int v5; // ecx int dist, v;
int v6; // edi
int v7; // ebx
int v9; // eax
//int v10; // ST04_4
int v12; // eax
//int v13; // ST04_4
int v15; // edi
int v16; // eax
int v17; // ecx
BOOLEAN v18; // eax
//int v19; // eax
int v21; // eax
int v22; // eax
//int v23; // ST04_4
signed int v25; // ecx
int v26; // eax
int v27; // [esp+4h] [ebp-18h]
int v28; // [esp+8h] [ebp-14h]
char *v29; // [esp+8h] [ebp-14h]
int v30; // [esp+Ch] [ebp-10h]
int md; // [esp+10h] [ebp-Ch]
int v32; // [esp+14h] [ebp-8h]
int arglist; // [esp+18h] [ebp-4h]
v2 = i;
v27 = special;
arglist = i;
if ((DWORD)i >= MAXMONSTERS) if ((DWORD)i >= MAXMONSTERS)
app_fatal("MAI_Round: Invalid monster %d", i); app_fatal("MAI_Round: Invalid monster %d", i);
v3 = &monster[v2]; Monst = monster + i;
if (v3->_mmode == MM_STAND && v3->_msquelch) { if (Monst->_mmode == MM_STAND && Monst->_msquelch) {
v4 = v3->_my; fy = Monst->_menemyy;
v5 = v3->_mx; fx = Monst->_menemyx;
v28 = (unsigned char)v3->_menemyy; mx = Monst->_mx - fx;
v6 = (unsigned char)v3->_menemyx; my = Monst->_my - fy;
v7 = v5 - v6; md = GetDirection(Monst->_mx, Monst->_my, Monst->_lastx, Monst->_lasty);
v32 = v4 - v28; if ((BYTE)Monst->_msquelch < 255)
md = GetDirection(v5, v4, v3->_lastx, v3->_lasty); MonstCheckDoors(i);
if (v3->_msquelch < 0xFFu) /* check sign */ v = random(114, 100);
MonstCheckDoors(arglist); if ((abs(mx) >= 2 || abs(my) >= 2) && Monst->_msquelch == -1 && dTransVal[Monst->_mx][Monst->_my] == dTransVal[fx][fy]) {
v30 = random(114, 100); if (Monst->_mgoal == MGOAL_MOVE || (abs(mx) >= 4 || abs(my) >= 4) && random(115, 4) == 0) {
if ((abs(v7) >= 2 || abs(v32) >= 2) && v3->_msquelch == -1) { if (Monst->_mgoal != MGOAL_MOVE) {
v29 = &dTransVal[v6][v28]; Monst->_mgoalvar1 = 0;
if (dTransVal[v3->_mx][v3->_my] == *v29) { Monst->_mgoalvar2 = random(116, 2);
if (_LOBYTE(v3->_mgoal) != MGOAL_MOVE) {
v9 = abs(v7);
//v11 = v10;
if (v9 < 4) {
v12 = abs(v32);
//v11 = v13;
if (v12 < 4)
goto LABEL_26;
}
if (random(115, 4))
goto LABEL_26;
if (_LOBYTE(v3->_mgoal) != MGOAL_MOVE) {
v3->_mgoalvar1 = 0;
v3->_mgoalvar2 = random(116, 2);
}
} }
_LOBYTE(v3->_mgoal) = MGOAL_MOVE; Monst->_mgoal = MGOAL_MOVE;
v15 = abs(v32); if (abs(mx) > abs(my))
if (abs(v7) <= v15) dist = abs(mx);
v16 = abs(v32);
else else
v16 = abs(v7); dist = abs(my);
v17 = v3->_mgoalvar1; if (Monst->_mgoalvar1++ >= 2 * dist && DirOK(i, md) || dTransVal[Monst->_mx][Monst->_my] != dTransVal[fx][fy]) {
v3->_mgoalvar1 = v17 + 1; Monst->_mgoal = MGOAL_NORMAL;
if (v17 < 2 * v16 || (v18 = DirOK(arglist, md), !v18)) { } else if (!M_RoundWalk(i, md, &Monst->_mgoalvar2)) {
if (dTransVal[v3->_mx][v3->_my] == *v29) { M_StartDelay(i, random(125, 10) + 10);
//_LOBYTE(v19) = M_RoundWalk(arglist, md, &v3->_mgoalvar2);
if (!M_RoundWalk(arglist, md, &v3->_mgoalvar2)) {
v21 = random(125, 10);
M_StartDelay(arglist, v21 + 10);
}
goto LABEL_26;
}
} }
} }
} } else
_LOBYTE(v3->_mgoal) = MGOAL_NORMAL; Monst->_mgoal = MGOAL_NORMAL;
LABEL_26: if (Monst->_mgoal == MGOAL_NORMAL) {
if (_LOBYTE(v3->_mgoal) == MGOAL_NORMAL) { if (abs(mx) >= 2 || abs(my) >= 2) {
if (abs(v7) >= 2 || (v22 = abs(v32), v22 >= 2)) /* v24 = v23, */ if (Monst->_mVar2 > 20 && v < 2 * Monst->_mint + 28
{ || (Monst->_mVar1 == MM_WALK || Monst->_mVar1 == MM_WALK2 || Monst->_mVar1 == MM_WALK3)
v25 = v3->_mVar2; && Monst->_mVar2 == 0
if (v25 > 20 && v30 < 2 * (unsigned char)v3->_mint + 28 && v < 2 * Monst->_mint + 78) {
|| ((v26 = v3->_mVar1, v26 == MM_WALK) || v26 == MM_WALK2 || v26 == MM_WALK3) M_CallWalk(i, md);
&& !v25
&& v30 < 2 * (unsigned char)v3->_mint + 78) {
M_CallWalk(arglist, md);
} }
} else if (v30 < 2 * (unsigned char)v3->_mint + 23) { } else if (v < 2 * Monst->_mint + 23) {
v3->_mdir = md; Monst->_mdir = md;
if (v27 && v3->_mhitpoints<v3->_mmaxhp>> 1 && random(117, 2)) if (special && Monst->_mhitpoints < (Monst->_mmaxhp >> 1) && random(117, 2) != 0)
M_StartSpAttack(arglist); M_StartSpAttack(i);
else else
M_StartAttack(arglist); M_StartAttack(i);
} }
} }
if (v3->_mmode == MM_STAND) if (Monst->_mmode == MM_STAND)
v3->_mAnimData = v3->MType->Anims[MA_STAND].Data[md]; Monst->_mAnimData = Monst->MType->Anims[MA_STAND].Data[md];
} }
} }
@ -3782,138 +3620,91 @@ void MAI_AcidUniq(int i)
void MAI_Scav(int i) void MAI_Scav(int i)
{ {
int v1; // edi BOOL done;
int v2; // esi int x, y;
unsigned char *v3; // eax int _mx, _my;
int v4; // ecx MonsterStruct *Monst;
int v5; // ecx int _goalvar1;
signed int v6; // ebx
signed int v7; // edi
int v8; // edx
int v9; // eax
BOOLEAN v10; // eax
int v11; // ebx
int v12; // edi
signed int v13; // edi
int v14; // edx
int v15; // eax
BOOLEAN v16; // eax
int v17; // eax
int v18; // eax
int arglist; // [esp+Ch] [ebp-8h]
BOOL v20; // [esp+10h] [ebp-4h]
v1 = i;
arglist = i;
if ((DWORD)i >= MAXMONSTERS) if ((DWORD)i >= MAXMONSTERS)
app_fatal("MAI_Scav: Invalid monster %d", i); app_fatal("MAI_Scav: Invalid monster %d", i);
v2 = v1; Monst = monster + i;
v20 = 0; _mx = Monst->_mx;
if (monster[v1]._mmode == MM_STAND) { _my = Monst->_my;
if (monster[v2]._mhitpoints<monster[v2]._mmaxhp>> 1) { done = FALSE;
if (_LOBYTE(monster[v2]._mgoal) == MGOAL_HEALING) if (monster[i]._mmode != MM_STAND)
goto LABEL_10; return;
if (monster[v2].leaderflag) { if (Monst->_mhitpoints < (Monst->_mmaxhp >> 1) && Monst->_mgoal != MGOAL_HEALING) {
v3 = &monster[(unsigned char)monster[v2].leader].packsize; if (Monst->leaderflag) {
--*v3; monster[Monst->leader].packsize--;
monster[v2].leaderflag = 0; Monst->leaderflag = 0;
}
Monst->_mgoal = MGOAL_HEALING;
Monst->_mgoalvar3 = 10;
}
if (Monst->_mgoal == MGOAL_HEALING && Monst->_mgoalvar3 != 0) {
Monst->_mgoalvar3--;
if (dDead[Monst->_mx][Monst->_my]) {
M_StartEat(i);
if (!(Monst->_mFlags & MFLAG_NOHEAL))
Monst->_mhitpoints += 64;
if (Monst->_mhitpoints >= (Monst->_mmaxhp >> 1) + (Monst->_mmaxhp >> 2)) {
Monst->_mgoal = MGOAL_NORMAL;
Monst->_mgoalvar1 = 0;
Monst->_mgoalvar2 = 0;
} }
_LOBYTE(monster[v2]._mgoal) = MGOAL_HEALING; } else {
monster[v2]._mgoalvar3 = 10; if (Monst->_mgoalvar1 == 0) {
} if (random(120, 2) != 0) {
if (_LOBYTE(monster[v2]._mgoal) != MGOAL_HEALING) { for (y = -4; y <= 4 && !done; y++) {
LABEL_52: for (x = -4; x <= 4 && !done; x++) {
if (monster[v2]._mmode == MM_STAND) // BUGFIX: incorrect check of offset against limits of the dungeon
MAI_SkelSd(arglist); if (y < 0 || y >= MAXDUNY || x < 0 || x >= MAXDUNX)
return; continue;
} done = dDead[Monst->_mx + x][Monst->_my + y] != 0
LABEL_10: && LineClearF(
v4 = monster[v2]._mgoalvar3; CheckNoSolid,
if (v4) { Monst->_mx,
monster[v2]._mgoalvar3 = v4 - 1; Monst->_my,
v5 = monster[v2]._my; Monst->_mx + x,
if (dDead[monster[v2]._mx][v5]) { Monst->_my + y);
M_StartEat(v1); }
if (!(monster[v2]._mFlags & MFLAG_NOHEAL))
monster[v2]._mhitpoints += 64;
if (monster[v2]._mhitpoints >= (monster[v2]._mmaxhp >> 1) + (monster[v2]._mmaxhp >> 2)) {
_LOBYTE(monster[v2]._mgoal) = MGOAL_NORMAL;
monster[v2]._mgoalvar1 = 0;
monster[v2]._mgoalvar2 = 0;
}
} else {
if (!monster[v2]._mgoalvar1) {
v6 = arglist;
if (random(120, 2)) {
v7 = -4;
do {
if (v20)
break;
v6 = -4;
do {
if (v20)
break;
if (v7 >= 0 && v7 < MAXDUNY && v6 >= 0 && v6 < MAXDUNX) {
v8 = monster[v2]._mx;
v9 = monster[v2]._my;
v20 = dDead[v8 + v6][v9 + v7]
&& (v10 = LineClearF(
CheckNoSolid,
v8,
v9,
v8 + v6,
v9 + v7),
v10);
}
++v6;
} while (v6 <= 4);
++v7;
} while (v7 <= 4);
v11 = v6 - 1;
v12 = v7 - 1;
} else {
v13 = 4;
do {
if (v20)
break;
v6 = 4;
do {
if (v20)
break;
if (v13 >= 0 && v13 < MAXDUNY && v6 >= 0 && v6 < MAXDUNX) {
v14 = monster[v2]._mx;
v15 = monster[v2]._my;
v20 = dDead[v14 + v6][v15 + v13]
&& (v16 = LineClearF(
CheckNoSolid,
v14,
v15,
v14 + v6,
v15 + v13),
v16);
}
--v6;
} while (v6 >= -4);
--v13;
} while (v13 >= -4);
v11 = v6 + 1;
v12 = v13 + 1;
} }
if (v20) { x--;
monster[v2]._mgoalvar1 = monster[v2]._mx + v11 + 1; y--;
monster[v2]._mgoalvar2 = monster[v2]._my + v12 + 1; } else {
for (y = 4; y >= -4 && !done; y--) {
for (x = 4; x >= -4 && !done; x--) {
// BUGFIX: incorrect check of offset against limits of the dungeon
if (y < 0 || y >= MAXDUNY || x < 0 || x >= MAXDUNX)
continue;
done = dDead[Monst->_mx + x][Monst->_my + y] != 0
&& LineClearF(
CheckNoSolid,
Monst->_mx,
Monst->_my,
Monst->_mx + x,
Monst->_my + y);
}
} }
x++;
y++;
} }
v17 = monster[v2]._mgoalvar1; if (done) {
if (v17) { Monst->_mgoalvar1 = x + Monst->_mx + 1;
v18 = GetDirection(monster[v2]._mx, monster[v2]._my, v17 - 1, monster[v2]._mgoalvar2 - 1); Monst->_mgoalvar2 = y + Monst->_my + 1;
monster[v2]._mdir = v18;
M_CallWalk(arglist, v18);
} }
} }
if (Monst->_mgoalvar1) {
x = Monst->_mgoalvar1 - 1;
y = Monst->_mgoalvar2 - 1;
Monst->_mdir = GetDirection(Monst->_mx, Monst->_my, x, y);
M_CallWalk(i, Monst->_mdir);
}
} }
goto LABEL_52;
} }
if (Monst->_mmode == MM_STAND)
MAI_SkelSd(i);
} }
void MAI_Garg(int i) void MAI_Garg(int i)

47
Source/multi.cpp

@ -17,7 +17,7 @@ BOOLEAN sgbPlayerLeftGameTbl[MAX_PLRS];
int sgbSentThisCycle; // idb int sgbSentThisCycle; // idb
BOOL gbShouldValidatePackage; BOOL gbShouldValidatePackage;
BYTE gbActivePlayers; // weak BYTE gbActivePlayers; // weak
BOOLEAN gbGameDestroyed; // weak BOOLEAN gbGameDestroyed;
BOOLEAN sgbSendDeltaTbl[MAX_PLRS]; BOOLEAN sgbSendDeltaTbl[MAX_PLRS];
_gamedata sgGameInitInfo; _gamedata sgGameInitInfo;
char byte_678640; // weak char byte_678640; // weak
@ -611,35 +611,29 @@ void NetClose()
nthread_cleanup(); nthread_cleanup();
dthread_cleanup(); dthread_cleanup();
tmsg_cleanup(); tmsg_cleanup();
multi_event_handler(0); multi_event_handler(FALSE);
SNetLeaveGame(3); SNetLeaveGame(3);
msgcmd_cmd_cleanup(); msgcmd_cmd_cleanup();
if (gbMaxPlayers > 1) if (gbMaxPlayers > 1)
Sleep(2000); Sleep(2000);
} }
char multi_event_handler(int a1) void multi_event_handler(BOOL add)
{ {
int v1; // edi DWORD i;
void *(__stdcall * v2)(int, void(__stdcall *)(_SNETEVENT *)); // ebx BOOL(STORMAPI * fn)
unsigned int v3; // esi (int, SEVTHANDLER);
int v4; // eax
char *v5; // eax if (add)
fn = SNetRegisterEventHandler;
v1 = a1; else
v2 = SNetRegisterEventHandler; fn = SNetUnregisterEventHandler;
if (!a1)
v2 = SNetUnregisterEventHandler; for (i = 0; i < 3; i++) {
v3 = 0; if (!fn(event_types[i], multi_handle_events) && add) {
do { app_fatal("SNetRegisterEventHandler:\n%s", TraceLastError());
v4 = (int)v2(event_types[v3], multi_handle_events);
if (!v4 && v1) {
v5 = TraceLastError();
app_fatal("SNetRegisterEventHandler:\n%s", v5);
} }
++v3; }
} while (v3 < 3);
return v4;
} }
void __stdcall multi_handle_events(_SNETEVENT *pEvt) void __stdcall multi_handle_events(_SNETEVENT *pEvt)
@ -776,11 +770,6 @@ BOOL NetInit(BOOL bSinglePlayer, BOOL *pfExitProgram)
return TRUE; return TRUE;
} }
// 6761B8: using guessed type char gbSomebodyWonGameKludge;
// 67862D: using guessed type char gbGameDestroyed;
// 678640: using guessed type char byte_678640;
// 6796E4: using guessed type char gbDeltaSender;
// 6796E8: using guessed type int sgbNetInited;
void buffer_init(TBuffer *pBuf) void buffer_init(TBuffer *pBuf)
{ {
@ -879,7 +868,7 @@ BOOL multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info,
plr[0].pBattleNet = 1; plr[0].pBattleNet = 1;
} }
multi_event_handler(1); multi_event_handler(TRUE);
if (UiSelectGame(1, client_info, user_info, ui_info, &fileinfo, &playerId)) if (UiSelectGame(1, client_info, user_info, ui_info, &fileinfo, &playerId))
break; break;

2
Source/multi.h

@ -43,7 +43,7 @@ void multi_handle_all_packets(int players, TPkt *packet, int a3);
void multi_process_tmsgs(); void multi_process_tmsgs();
void multi_send_zero_packet(int pnum, char a2, void *pbSrc, int dwLen); void multi_send_zero_packet(int pnum, char a2, void *pbSrc, int dwLen);
void NetClose(); void NetClose();
char multi_event_handler(int a1); void multi_event_handler(BOOL add);
void __stdcall multi_handle_events(_SNETEVENT *pEvt); void __stdcall multi_handle_events(_SNETEVENT *pEvt);
BOOL NetInit(BOOL bSinglePlayer, BOOL *pfExitProgram); BOOL NetInit(BOOL bSinglePlayer, BOOL *pfExitProgram);
void buffer_init(TBuffer *pBuf); void buffer_init(TBuffer *pBuf);

36
Source/nthread.cpp

@ -27,18 +27,19 @@ static HANDLE sghThread = INVALID_HANDLE_VALUE;
void nthread_terminate_game(const char *pszFcn) void nthread_terminate_game(const char *pszFcn)
{ {
DWORD sErr; // eax DWORD sErr;
sErr = SErrGetLastError(); sErr = SErrGetLastError();
if (sErr != STORM_ERROR_INVALID_PLAYER) { if (sErr == STORM_ERROR_INVALID_PLAYER) {
if (sErr == STORM_ERROR_GAME_TERMINATED || sErr == STORM_ERROR_NOT_IN_GAME) { return;
gbGameDestroyed = 1; } else if (sErr == STORM_ERROR_GAME_TERMINATED) {
} else { gbGameDestroyed = TRUE;
app_fatal("%s:\n%s", pszFcn, TraceLastError()); } else if (sErr == STORM_ERROR_NOT_IN_GAME) {
} gbGameDestroyed = TRUE;
} else {
app_fatal("%s:\n%s", pszFcn, TraceLastError());
} }
} }
// 67862D: using guessed type char gbGameDestroyed;
int nthread_send_and_recv_turn(int cur_turn, int turn_delta) int nthread_send_and_recv_turn(int cur_turn, int turn_delta)
{ {
@ -120,7 +121,6 @@ void nthread_set_turn_upper_bit()
{ {
turn_upper_bit = 0x80000000; turn_upper_bit = 0x80000000;
} }
// 679754: using guessed type int turn_upper_bit;
void nthread_start(BOOL set_turn_upper_bit) void nthread_start(BOOL set_turn_upper_bit)
{ {
@ -198,8 +198,8 @@ void nthread_start(BOOL set_turn_upper_bit)
unsigned int __stdcall nthread_handler(void *a1) unsigned int __stdcall nthread_handler(void *a1)
{ {
signed int delta; // esi int delta;
int received; // [esp+Ch] [ebp-4h] int received;
if (nthread_should_run) { if (nthread_should_run) {
while (1) { while (1) {
@ -227,8 +227,6 @@ unsigned int __stdcall nthread_handler(void *a1)
} }
return 0; return 0;
} }
// 679734: using guessed type char nthread_should_run;
// 679764: using guessed type int last_tick;
void nthread_cleanup() void nthread_cleanup()
{ {
@ -248,11 +246,6 @@ void nthread_cleanup()
sghThread = (HANDLE)-1; sghThread = (HANDLE)-1;
} }
} }
// 679734: using guessed type char nthread_should_run;
// 679738: using guessed type int gdwTurnsInTransit;
// 67975A: using guessed type char sgbThreadIsRunning;
// 67975C: using guessed type int gdwLargestMsgSize;
// 679760: using guessed type int gdwNormalMsgSize;
void nthread_ignore_mutex(BOOL bStart) void nthread_ignore_mutex(BOOL bStart)
{ {
@ -266,12 +259,11 @@ void nthread_ignore_mutex(BOOL bStart)
sgbThreadIsRunning = bStart; sgbThreadIsRunning = bStart;
} }
} }
// 67975A: using guessed type char sgbThreadIsRunning;
BOOL nthread_has_500ms_passed(BOOL unused) BOOL nthread_has_500ms_passed(BOOL unused)
{ {
DWORD currentTickCount; // eax DWORD currentTickCount;
int ticksElapsed; // ecx int ticksElapsed;
currentTickCount = GetTickCount(); currentTickCount = GetTickCount();
ticksElapsed = currentTickCount - last_tick; ticksElapsed = currentTickCount - last_tick;
@ -281,7 +273,5 @@ BOOL nthread_has_500ms_passed(BOOL unused)
} }
return ticksElapsed >= 0; return ticksElapsed >= 0;
} }
// 679660: using guessed type char gbMaxPlayers;
// 679764: using guessed type int last_tick;
DEVILUTION_END_NAMESPACE DEVILUTION_END_NAMESPACE

43
Source/objects.cpp

@ -1269,8 +1269,8 @@ void AddWeaponRack(int i)
void AddTorturedBody(int i) void AddTorturedBody(int i)
{ {
object[i]._oRndSeed = GetRndSeed(); object[i]._oRndSeed = GetRndSeed();
object[i]._oPreFlag = TRUE;
object[i]._oAnimFrame = random(0, 4) + 1; object[i]._oAnimFrame = random(0, 4) + 1;
object[i]._oPreFlag = TRUE;
} }
void GetRndObjLoc(int randarea, int *xx, int *yy) void GetRndObjLoc(int randarea, int *xx, int *yy)
@ -1512,12 +1512,17 @@ void Obj_Circle(int i)
object[i]._oAnimFrame = 2; object[i]._oAnimFrame = 2;
if (object[i]._otype == OBJ_MCIRCLE2) if (object[i]._otype == OBJ_MCIRCLE2)
object[i]._oAnimFrame = 4; object[i]._oAnimFrame = 4;
if (ox == 45 && oy == 47) { if (ox == 45) {
object[i]._oVar6 = 2; if (oy == 47) {
return; object[i]._oVar6 = 2;
} else if (object[i]._ox == 26 && object[i]._oy == 46) { return;
}
}
else {
if (object[i]._ox == 26 && object[i]._oy == 46) {
object[i]._oVar6 = 1; object[i]._oVar6 = 1;
return; return;
}
} }
object[i]._oVar6 = 0; object[i]._oVar6 = 0;
if (ox == 35 && object[i]._oy == 36 && object[i]._oVar5 == 3) { if (ox == 35 && object[i]._oy == 36 && object[i]._oVar5 == 3) {
@ -1574,9 +1579,9 @@ void ActivateTrapLine(int ttype, int tid)
{ {
int i, oi; int i, oi;
for (i = ttype; i < nobjects; i++) { for (i = 0; i < nobjects; i++) {
oi = objectactive[i]; oi = objectactive[i];
if (object[oi]._otype == i && object[oi]._oVar1 == tid) { if (object[oi]._otype == ttype && object[oi]._oVar1 == tid) {
object[oi]._oVar4 = 1; object[oi]._oVar4 = 1;
object[oi]._oAnimFlag = 1; object[oi]._oAnimFlag = 1;
object[oi]._oAnimDelay = 1; object[oi]._oAnimDelay = 1;
@ -2382,7 +2387,7 @@ void ObjChangeMapResync(int x1, int y1, int x2, int y2)
} }
} }
void OperateL1Door(int pnum, int i, unsigned char sendflag) void OperateL1Door(int pnum, int i, BOOL sendflag)
{ {
int dpx, dpy; int dpx, dpy;
@ -2742,7 +2747,7 @@ void OperateSarc(int pnum, int i, BOOL sendmsg)
} }
} }
void OperateL2Door(int pnum, int i, unsigned char sendflag) void OperateL2Door(int pnum, int i, BOOL sendflag)
{ {
int dpx, dpy; int dpx, dpy;
@ -2754,7 +2759,7 @@ void OperateL2Door(int pnum, int i, unsigned char sendflag)
OperateL2RDoor(pnum, i, sendflag); OperateL2RDoor(pnum, i, sendflag);
} }
void OperateL3Door(int pnum, int i, unsigned char sendflag) void OperateL3Door(int pnum, int i, BOOL sendflag)
{ {
int dpx, dpy; int dpx, dpy;
@ -3764,37 +3769,37 @@ void OperateObject(int pnum, int i, BOOL TeleFlag)
case OBJ_L1RDOOR: case OBJ_L1RDOOR:
if (TeleFlag) { if (TeleFlag) {
if (object[i]._otype == OBJ_L1LDOOR) if (object[i]._otype == OBJ_L1LDOOR)
OperateL1LDoor(pnum, i, 1); OperateL1LDoor(pnum, i, TRUE);
if (object[i]._otype == OBJ_L1RDOOR) if (object[i]._otype == OBJ_L1RDOOR)
OperateL1RDoor(pnum, i, 1); OperateL1RDoor(pnum, i, TRUE);
break; break;
} }
if (pnum == myplr) if (pnum == myplr)
OperateL1Door(pnum, i, 1); OperateL1Door(pnum, i, TRUE);
break; break;
case OBJ_L2LDOOR: case OBJ_L2LDOOR:
case OBJ_L2RDOOR: case OBJ_L2RDOOR:
if (TeleFlag) { if (TeleFlag) {
if (object[i]._otype == OBJ_L2LDOOR) if (object[i]._otype == OBJ_L2LDOOR)
OperateL2LDoor(pnum, i, 1); OperateL2LDoor(pnum, i, TRUE);
if (object[i]._otype == OBJ_L2RDOOR) if (object[i]._otype == OBJ_L2RDOOR)
OperateL2RDoor(pnum, i, 1); OperateL2RDoor(pnum, i, TRUE);
break; break;
} }
if (pnum == myplr) if (pnum == myplr)
OperateL2Door(pnum, i, 1); OperateL2Door(pnum, i, TRUE);
break; break;
case OBJ_L3LDOOR: case OBJ_L3LDOOR:
case OBJ_L3RDOOR: case OBJ_L3RDOOR:
if (TeleFlag) { if (TeleFlag) {
if (object[i]._otype == OBJ_L3LDOOR) if (object[i]._otype == OBJ_L3LDOOR)
OperateL3LDoor(pnum, i, 1); OperateL3LDoor(pnum, i, TRUE);
if (object[i]._otype == OBJ_L3RDOOR) if (object[i]._otype == OBJ_L3RDOOR)
OperateL3RDoor(pnum, i, 1); OperateL3RDoor(pnum, i, TRUE);
break; break;
} }
if (pnum == myplr) if (pnum == myplr)
OperateL3Door(pnum, i, 1); OperateL3Door(pnum, i, TRUE);
break; break;
case OBJ_LEVER: case OBJ_LEVER:
case OBJ_SWITCHSKL: case OBJ_SWITCHSKL:

6
Source/objects.h

@ -105,7 +105,7 @@ void OperateL3LDoor(int pnum, int oi, BOOL sendflag);
void MonstCheckDoors(int m); void MonstCheckDoors(int m);
void ObjChangeMap(int x1, int y1, int x2, int y2); void ObjChangeMap(int x1, int y1, int x2, int y2);
void ObjChangeMapResync(int x1, int y1, int x2, int y2); void ObjChangeMapResync(int x1, int y1, int x2, int y2);
void OperateL1Door(int pnum, int i, unsigned char sendflag); void OperateL1Door(int pnum, int i, BOOL sendflag);
void OperateLever(int pnum, int i); void OperateLever(int pnum, int i);
void OperateBook(int pnum, int i); void OperateBook(int pnum, int i);
void OperateBookLever(int pnum, int i); void OperateBookLever(int pnum, int i);
@ -116,8 +116,8 @@ void OperateInnSignChest(int pnum, int i);
void OperateSlainHero(int pnum, int i, BOOL sendmsg); void OperateSlainHero(int pnum, int i, BOOL sendmsg);
void OperateTrapLvr(int i); void OperateTrapLvr(int i);
void OperateSarc(int pnum, int i, BOOL sendmsg); void OperateSarc(int pnum, int i, BOOL sendmsg);
void OperateL2Door(int pnum, int i, unsigned char sendflag); void OperateL2Door(int pnum, int i, BOOL sendflag);
void OperateL3Door(int pnum, int i, unsigned char sendflag); void OperateL3Door(int pnum, int i, BOOL sendflag);
void OperatePedistal(int pnum, int i); void OperatePedistal(int pnum, int i);
void TryDisarm(int pnum, int i); void TryDisarm(int pnum, int i);
int ItemMiscIdIdx(int imiscid); int ItemMiscIdIdx(int imiscid);

2
Source/player.cpp

@ -2936,7 +2936,7 @@ BOOL PM_DoDeath(int pnum)
if (plr[pnum]._pVar8 >= 2 * plr[pnum]._pDFrames) { if (plr[pnum]._pVar8 >= 2 * plr[pnum]._pDFrames) {
if (deathdelay > 1 && pnum == myplr) { if (deathdelay > 1 && pnum == myplr) {
deathdelay--; deathdelay--;
if (deathdelay) { if (deathdelay == 1) {
deathflag = TRUE; deathflag = TRUE;
if (gbMaxPlayers == 1) { if (gbMaxPlayers == 1) {
gamemenu_previous(); gamemenu_previous();

10
Source/quests.cpp

@ -302,10 +302,10 @@ void CheckQuestKill(int m, BOOL sendmsg)
for (j = 0; j < 112; j++) { for (j = 0; j < 112; j++) {
for (i = 0; i < 112; i++) { for (i = 0; i < 112; i++) {
if (dPiece[i][j] == 370) { if (dPiece[i][j] == 370) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = 1026; trigs[numtrigs]._tmsg = 1026;
trigflag_4++; numtrigs++;
} }
} }
} }
@ -612,7 +612,7 @@ void ResyncQuests()
else else
LoadPalette("Levels\\L3Data\\L3pfoul.pal"); LoadPalette("Levels\\L3Data\\L3pfoul.pal");
for (i = 0; i < 32; i++) for (i = 0; i <= 32; i++)
palette_update_quest_palette(i); palette_update_quest_palette(i);
} }

18
Source/stores.cpp

@ -1820,19 +1820,19 @@ void S_SmithEnter()
gossipstart = QUEST_GRISWOLD2; gossipstart = QUEST_GRISWOLD2;
gossipend = QUEST_GRISWOLD13; gossipend = QUEST_GRISWOLD13;
StartStore(STORE_GOSSIP); StartStore(STORE_GOSSIP);
return; break;
case 12: case 12:
StartStore(STORE_SBUY); StartStore(STORE_SBUY);
return; break;
case 14: case 14:
StartStore(STORE_SPBUY); StartStore(STORE_SPBUY);
return; break;
case 16: case 16:
StartStore(STORE_SSELL); StartStore(STORE_SSELL);
return; break;
case 18: case 18:
StartStore(STORE_SREPAIR); StartStore(STORE_SREPAIR);
return; break;
case 20: case 20:
stextflag = STORE_NONE; stextflag = STORE_NONE;
break; break;
@ -2538,20 +2538,20 @@ void S_HealerEnter()
gossipstart = QUEST_PEPIN2; gossipstart = QUEST_PEPIN2;
gossipend = QUEST_PEPIN11; gossipend = QUEST_PEPIN11;
StartStore(STORE_GOSSIP); StartStore(STORE_GOSSIP);
return; break;
case 14: case 14:
if (plr[myplr]._pHitPoints != plr[myplr]._pMaxHP) if (plr[myplr]._pHitPoints != plr[myplr]._pMaxHP)
PlaySFX(IS_CAST8); PlaySFX(IS_CAST8);
drawhpflag = TRUE; drawhpflag = TRUE;
plr[myplr]._pHitPoints = plr[myplr]._pMaxHP; plr[myplr]._pHitPoints = plr[myplr]._pMaxHP;
plr[myplr]._pHPBase = plr[myplr]._pMaxHPBase; plr[myplr]._pHPBase = plr[myplr]._pMaxHPBase;
return; break;
case 16: case 16:
StartStore(STORE_HBUY); StartStore(STORE_HBUY);
return; break;
case 18: case 18:
stextflag = STORE_NONE; stextflag = STORE_NONE;
return; break;
} }
} }

2
Source/themes.cpp

@ -351,7 +351,7 @@ BOOL CheckThemeRoom(int tv)
{ {
int i, j, tarea; int i, j, tarea;
for (i = 0; i < trigflag_4; i++) { for (i = 0; i < numtrigs; i++) {
if (dTransVal[trigs[i]._tx][trigs[i]._ty] == tv) if (dTransVal[trigs[i]._tx][trigs[i]._ty] == tv)
return FALSE; return FALSE;
} }

342
Source/trigs.cpp

@ -2,11 +2,9 @@
DEVILUTION_BEGIN_NAMESPACE DEVILUTION_BEGIN_NAMESPACE
int trigflag_0; BOOL townwarps[3];
int trigflag_1; BOOL trigflag;
int trigflag_2; int numtrigs;
int trigflag_3;
int trigflag_4;
TriggerStruct trigs[MAXTRIGGERS]; TriggerStruct trigs[MAXTRIGGERS];
int TWarpFrom; // weak int TWarpFrom; // weak
@ -91,25 +89,25 @@ int L4PentaList[33] = {
void InitNoTriggers() void InitNoTriggers()
{ {
trigflag_4 = 0; numtrigs = 0;
trigflag_3 = 0; trigflag = 0;
} }
void InitTownTriggers() void InitTownTriggers()
{ {
char v0; // bl int i;
int v1; // eax
int v2; // eax
trigs[0]._tx = 25; trigs[0]._tx = 25;
trigs[0]._ty = 29; trigs[0]._ty = 29;
trigs[0]._tmsg = WM_DIABNEXTLVL; trigs[0]._tmsg = WM_DIABNEXTLVL;
trigflag_4 = 1;
if (gbMaxPlayers == 4) { numtrigs = 1;
if(gbMaxPlayers == MAX_PLRS) {
for(i = 0; i < sizeof(townwarps) / sizeof(townwarps[0]); i++) {
townwarps[i] = TRUE;
}
trigs[1]._tx = 49; trigs[1]._tx = 49;
trigflag_0 = 1;
trigflag_1 = 1;
trigflag_2 = 1;
trigs[1]._ty = 21; trigs[1]._ty = 21;
trigs[1]._tmsg = WM_DIABTOWNWARP; trigs[1]._tmsg = WM_DIABTOWNWARP;
trigs[1]._tlvl = 5; trigs[1]._tlvl = 5;
@ -121,38 +119,38 @@ void InitTownTriggers()
trigs[3]._ty = 80; trigs[3]._ty = 80;
trigs[3]._tmsg = WM_DIABTOWNWARP; trigs[3]._tmsg = WM_DIABTOWNWARP;
trigs[3]._tlvl = 13; trigs[3]._tlvl = 13;
trigflag_4 = 4; numtrigs = 4;
} else { } else {
trigflag_0 = 0; for(i = 0; i < 3; i++) {
trigflag_1 = 0; townwarps[i] = FALSE;
trigflag_2 = 0; }
v0 = plr[myplr].pTownWarps; if(plr[myplr].pTownWarps & 1) {
if (v0 & 1) {
trigs[1]._tx = 49; trigs[1]._tx = 49;
trigs[1]._ty = 21; trigs[1]._ty = 21;
trigs[1]._tmsg = WM_DIABTOWNWARP; trigs[1]._tmsg = WM_DIABTOWNWARP;
trigs[1]._tlvl = 5; trigs[1]._tlvl = 5;
trigflag_4 = 2; numtrigs = 2;
trigflag_0 = 1; townwarps[0] = TRUE;
} }
if (v0 & 2) { if(plr[myplr].pTownWarps & 2) {
trigflag_1 = 1; townwarps[1] = TRUE;
v1 = trigflag_4++; trigs[numtrigs]._tx = 17;
trigs[v1]._tx = 17; trigs[numtrigs]._ty = 69;
trigs[v1]._ty = 69; trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[v1]._tmsg = WM_DIABTOWNWARP; trigs[numtrigs]._tlvl = 9;
trigs[v1]._tlvl = 9; numtrigs++;
} }
if (v0 & 4) { if(plr[myplr].pTownWarps & 4) {
trigflag_2 = 1; townwarps[2] = TRUE;
v2 = trigflag_4++; trigs[numtrigs]._tx = 41;
trigs[v2]._tx = 41; trigs[numtrigs]._ty = 80;
trigs[v2]._ty = 80; trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[v2]._tmsg = WM_DIABTOWNWARP; trigs[numtrigs]._tlvl = 13;
trigs[v2]._tlvl = 13; numtrigs++;
} }
} }
trigflag_3 = 0;
trigflag = FALSE;
} }
// 679660: using guessed type char gbMaxPlayers; // 679660: using guessed type char gbMaxPlayers;
@ -160,120 +158,120 @@ void InitL1Triggers()
{ {
int j, i; int j, i;
trigflag_4 = 0; numtrigs = 0;
for (j = 0; j < MAXDUNY; j++) { for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++) { for (i = 0; i < MAXDUNX; i++) {
if (dPiece[i][j] == 129) { if (dPiece[i][j] == 129) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABPREVLVL; trigs[numtrigs]._tmsg = WM_DIABPREVLVL;
trigflag_4++; numtrigs++;
} }
if (dPiece[i][j] == 115) { if (dPiece[i][j] == 115) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABNEXTLVL; trigs[numtrigs]._tmsg = WM_DIABNEXTLVL;
trigflag_4++; numtrigs++;
} }
} }
} }
trigflag_3 = 0; trigflag = 0;
} }
void InitL2Triggers() void InitL2Triggers()
{ {
int i, j; int i, j;
trigflag_4 = 0; numtrigs = 0;
for (j = 0; j < MAXDUNY; j++) { for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++) { for (i = 0; i < MAXDUNX; i++) {
if (dPiece[i][j] == 267 && (i != quests[QTYPE_BONE]._qtx || j != quests[QTYPE_BONE]._qty)) { if (dPiece[i][j] == 267 && (i != quests[QTYPE_BONE]._qtx || j != quests[QTYPE_BONE]._qty)) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABPREVLVL; trigs[numtrigs]._tmsg = WM_DIABPREVLVL;
trigflag_4++; numtrigs++;
} }
if (dPiece[i][j] == 559) { if (dPiece[i][j] == 559) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABTWARPUP; trigs[numtrigs]._tmsg = WM_DIABTWARPUP;
trigs[trigflag_4]._tlvl = 0; trigs[numtrigs]._tlvl = 0;
trigflag_4++; numtrigs++;
} }
if (dPiece[i][j] == 271) { if (dPiece[i][j] == 271) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABNEXTLVL; trigs[numtrigs]._tmsg = WM_DIABNEXTLVL;
trigflag_4++; numtrigs++;
} }
} }
} }
trigflag_3 = 0; trigflag = 0;
} }
void InitL3Triggers() void InitL3Triggers()
{ {
int i, j; int i, j;
trigflag_4 = 0; numtrigs = 0;
for (j = 0; j < MAXDUNY; j++) { for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++) { for (i = 0; i < MAXDUNX; i++) {
if (dPiece[i][j] == 171) { if (dPiece[i][j] == 171) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABPREVLVL; trigs[numtrigs]._tmsg = WM_DIABPREVLVL;
trigflag_4++; numtrigs++;
} }
if (dPiece[i][j] == 168) { if (dPiece[i][j] == 168) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4] ._tmsg = WM_DIABNEXTLVL; trigs[numtrigs] ._tmsg = WM_DIABNEXTLVL;
trigflag_4++; numtrigs++;
} }
if (dPiece[i][j] == 549) { if (dPiece[i][j] == 549) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABTWARPUP; trigs[numtrigs]._tmsg = WM_DIABTWARPUP;
trigflag_4++; numtrigs++;
} }
} }
} }
trigflag_3 = 0; trigflag = 0;
} }
void InitL4Triggers() void InitL4Triggers()
{ {
int i, j; int i, j;
trigflag_4 = 0; numtrigs = 0;
for (j = 0; j < MAXDUNY; j++) { for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++) { for (i = 0; i < MAXDUNX; i++) {
if (dPiece[i][j] == 83) { if (dPiece[i][j] == 83) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABPREVLVL; trigs[numtrigs]._tmsg = WM_DIABPREVLVL;
trigflag_4++; numtrigs++;
} }
if (dPiece[i][j] == 422) { if (dPiece[i][j] == 422) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABTWARPUP; trigs[numtrigs]._tmsg = WM_DIABTWARPUP;
trigs[trigflag_4]._tlvl = 0; trigs[numtrigs]._tlvl = 0;
trigflag_4++; numtrigs++;
} }
if (dPiece[i][j] == 120) { if (dPiece[i][j] == 120) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABNEXTLVL; trigs[numtrigs]._tmsg = WM_DIABNEXTLVL;
trigflag_4++; numtrigs++;
} }
} }
} }
@ -281,20 +279,20 @@ void InitL4Triggers()
for (j = 0; j < MAXDUNY; j++) { for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++) { for (i = 0; i < MAXDUNX; i++) {
if (dPiece[i][j] == 370 && quests[QTYPE_VB]._qactive == 3) { if (dPiece[i][j] == 370 && quests[QTYPE_VB]._qactive == 3) {
trigs[trigflag_4]._tx = i; trigs[numtrigs]._tx = i;
trigs[trigflag_4]._ty = j; trigs[numtrigs]._ty = j;
trigs[trigflag_4]._tmsg = WM_DIABNEXTLVL; trigs[numtrigs]._tmsg = WM_DIABNEXTLVL;
trigflag_4++; numtrigs++;
} }
} }
} }
trigflag_3 = 0; trigflag = 0;
} }
void InitSKingTriggers() void InitSKingTriggers()
{ {
trigflag_3 = 0; trigflag = 0;
trigflag_4 = 1; numtrigs = 1;
trigs[0]._tx = 82; trigs[0]._tx = 82;
trigs[0]._ty = 42; trigs[0]._ty = 42;
trigs[0]._tmsg = WM_DIABRTNLVL; trigs[0]._tmsg = WM_DIABRTNLVL;
@ -302,8 +300,8 @@ void InitSKingTriggers()
void InitSChambTriggers() void InitSChambTriggers()
{ {
trigflag_3 = 0; trigflag = 0;
trigflag_4 = 1; numtrigs = 1;
trigs[0]._tx = 70; trigs[0]._tx = 70;
trigs[0]._ty = 39; trigs[0]._ty = 39;
trigs[0]._tmsg = WM_DIABRTNLVL; trigs[0]._tmsg = WM_DIABRTNLVL;
@ -311,8 +309,8 @@ void InitSChambTriggers()
void InitPWaterTriggers() void InitPWaterTriggers()
{ {
trigflag_3 = 0; trigflag = 0;
trigflag_4 = 1; numtrigs = 1;
trigs[0]._tx = 30; trigs[0]._tx = 30;
trigs[0]._ty = 83; trigs[0]._ty = 83;
trigs[0]._tmsg = WM_DIABRTNLVL; trigs[0]._tmsg = WM_DIABRTNLVL;
@ -320,8 +318,8 @@ void InitPWaterTriggers()
void InitVPTriggers() void InitVPTriggers()
{ {
trigflag_3 = 0; trigflag = 0;
trigflag_4 = 1; numtrigs = 1;
trigs[0]._tx = 35; trigs[0]._tx = 35;
trigs[0]._ty = 32; trigs[0]._ty = 32;
trigs[0]._tmsg = WM_DIABRTNLVL; trigs[0]._tmsg = WM_DIABRTNLVL;
@ -340,7 +338,7 @@ BOOL ForceTownTrig()
} }
} }
if (trigflag_0) { if (townwarps[0]) {
for (j = 0; TownWarp1List[j] != -1; j++) { for (j = 0; TownWarp1List[j] != -1; j++) {
if (dPiece[cursmx][cursmy] == TownWarp1List[j]) { if (dPiece[cursmx][cursmy] == TownWarp1List[j]) {
strcpy(infostr, "Down to catacombs"); strcpy(infostr, "Down to catacombs");
@ -351,7 +349,7 @@ BOOL ForceTownTrig()
} }
} }
if (trigflag_1) { if (townwarps[1]) {
for (k = 1199; k <= 1220; k++) { for (k = 1199; k <= 1220; k++) {
if (dPiece[cursmx][cursmy] == k) { if (dPiece[cursmx][cursmy] == k) {
strcpy(infostr, "Down to caves"); strcpy(infostr, "Down to caves");
@ -362,7 +360,7 @@ BOOL ForceTownTrig()
} }
} }
if (trigflag_2) { if (townwarps[2]) {
for (l = 1240; l <= 1254; l++) { for (l = 1240; l <= 1254; l++) {
if (dPiece[cursmx][cursmy] == l) { if (dPiece[cursmx][cursmy] == l) {
strcpy(infostr, "Down to hell"); strcpy(infostr, "Down to hell");
@ -386,7 +384,7 @@ BOOL ForceL1Trig()
sprintf(infostr, "Up to level %i", currlevel - 1); sprintf(infostr, "Up to level %i", currlevel - 1);
else else
strcpy(infostr, "Up to town"); strcpy(infostr, "Up to town");
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) { if (trigs[j]._tmsg == WM_DIABPREVLVL) {
cursmx = trigs[j]._tx; cursmx = trigs[j]._tx;
cursmy = trigs[j]._ty; cursmy = trigs[j]._ty;
@ -399,7 +397,7 @@ BOOL ForceL1Trig()
for (i = 0; L1DownList[i] != -1; i++) { for (i = 0; L1DownList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L1DownList[i]) { if (dPiece[cursmx][cursmy] == L1DownList[i]) {
sprintf(infostr, "Down to level %i", currlevel + 1); sprintf(infostr, "Down to level %i", currlevel + 1);
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursmx = trigs[j]._tx; cursmx = trigs[j]._tx;
cursmy = trigs[j]._ty; cursmy = trigs[j]._ty;
@ -418,7 +416,7 @@ BOOL ForceL2Trig()
for (i = 0; L2UpList[i] != -1; i++) { for (i = 0; L2UpList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L2UpList[i]) { if (dPiece[cursmx][cursmy] == L2UpList[i]) {
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) { if (trigs[j]._tmsg == WM_DIABPREVLVL) {
dx = abs(trigs[j]._tx - cursmx); dx = abs(trigs[j]._tx - cursmx);
dy = abs(trigs[j]._ty - cursmy); dy = abs(trigs[j]._ty - cursmy);
@ -436,7 +434,7 @@ BOOL ForceL2Trig()
for (i = 0; L2DownList[i] != -1; i++) { for (i = 0; L2DownList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L2DownList[i]) { if (dPiece[cursmx][cursmy] == L2DownList[i]) {
sprintf(infostr, "Down to level %i", currlevel + 1); sprintf(infostr, "Down to level %i", currlevel + 1);
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursmx = trigs[j]._tx; cursmx = trigs[j]._tx;
cursmy = trigs[j]._ty; cursmy = trigs[j]._ty;
@ -449,7 +447,7 @@ BOOL ForceL2Trig()
if (currlevel == 5) { if (currlevel == 5) {
for (i = 0; L2TWarpUpList[i] != -1; i++) { for (i = 0; L2TWarpUpList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L2TWarpUpList[i]) { if (dPiece[cursmx][cursmy] == L2TWarpUpList[i]) {
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABTWARPUP) { if (trigs[j]._tmsg == WM_DIABTWARPUP) {
dx = abs(trigs[j]._tx - cursmx); dx = abs(trigs[j]._tx - cursmx);
dy = abs(trigs[j]._ty - cursmy); dy = abs(trigs[j]._ty - cursmy);
@ -475,7 +473,7 @@ BOOL ForceL3Trig()
for (i = 0; L3UpList[i] != -1; ++i) { for (i = 0; L3UpList[i] != -1; ++i) {
if (dPiece[cursmx][cursmy] == L3UpList[i]) { if (dPiece[cursmx][cursmy] == L3UpList[i]) {
sprintf(infostr, "Up to level %i", currlevel - 1); sprintf(infostr, "Up to level %i", currlevel - 1);
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) { if (trigs[j]._tmsg == WM_DIABPREVLVL) {
cursmx = trigs[j]._tx; cursmx = trigs[j]._tx;
cursmy = trigs[j]._ty; cursmy = trigs[j]._ty;
@ -488,7 +486,7 @@ BOOL ForceL3Trig()
for (i = 0; L3DownList[i] != -1; i++) { for (i = 0; L3DownList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L3DownList[i] || dPiece[cursmx + 1][cursmy] == L3DownList[i] || dPiece[cursmx + 2][cursmy] == L3DownList[i]) { if (dPiece[cursmx][cursmy] == L3DownList[i] || dPiece[cursmx + 1][cursmy] == L3DownList[i] || dPiece[cursmx + 2][cursmy] == L3DownList[i]) {
sprintf(infostr, "Down to level %i", currlevel + 1); sprintf(infostr, "Down to level %i", currlevel + 1);
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursmx = trigs[j]._tx; cursmx = trigs[j]._tx;
cursmy = trigs[j]._ty; cursmy = trigs[j]._ty;
@ -501,7 +499,7 @@ BOOL ForceL3Trig()
if (currlevel == 9) { if (currlevel == 9) {
for (i = 0; L3TWarpUpList[i] != -1; i++) { for (i = 0; L3TWarpUpList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L3TWarpUpList[i]) { if (dPiece[cursmx][cursmy] == L3TWarpUpList[i]) {
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABTWARPUP) { if (trigs[j]._tmsg == WM_DIABTWARPUP) {
dx = abs(trigs[j]._tx - cursmx); dx = abs(trigs[j]._tx - cursmx);
dy = abs(trigs[j]._ty - cursmy); dy = abs(trigs[j]._ty - cursmy);
@ -527,7 +525,7 @@ BOOL ForceL4Trig()
for (i = 0; L4UpList[i] != -1; ++i) { for (i = 0; L4UpList[i] != -1; ++i) {
if (dPiece[cursmx][cursmy] == L4UpList[i]) { if (dPiece[cursmx][cursmy] == L4UpList[i]) {
sprintf(infostr, "Up to level %i", currlevel - 1); sprintf(infostr, "Up to level %i", currlevel - 1);
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) { if (trigs[j]._tmsg == WM_DIABPREVLVL) {
cursmx = trigs[j]._tx; cursmx = trigs[j]._tx;
cursmy = trigs[j]._ty; cursmy = trigs[j]._ty;
@ -540,7 +538,7 @@ BOOL ForceL4Trig()
for (i = 0; L4DownList[i] != -1; i++) { for (i = 0; L4DownList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L4DownList[i]) { if (dPiece[cursmx][cursmy] == L4DownList[i]) {
sprintf(infostr, "Down to level %i", currlevel + 1); sprintf(infostr, "Down to level %i", currlevel + 1);
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursmx = trigs[j]._tx; cursmx = trigs[j]._tx;
cursmy = trigs[j]._ty; cursmy = trigs[j]._ty;
@ -553,7 +551,7 @@ BOOL ForceL4Trig()
if (currlevel == 13) { if (currlevel == 13) {
for (i = 0; L4TWarpUpList[i] != -1; i++) { for (i = 0; L4TWarpUpList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L4TWarpUpList[i]) { if (dPiece[cursmx][cursmy] == L4TWarpUpList[i]) {
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABTWARPUP) { if (trigs[j]._tmsg == WM_DIABTWARPUP) {
dx = abs(trigs[j]._tx - cursmx); dx = abs(trigs[j]._tx - cursmx);
dy = abs(trigs[j]._ty - cursmy); dy = abs(trigs[j]._ty - cursmy);
@ -573,7 +571,7 @@ BOOL ForceL4Trig()
for (i = 0; L4PentaList[i] != -1; i++) { for (i = 0; L4PentaList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L4PentaList[i]) { if (dPiece[cursmx][cursmy] == L4PentaList[i]) {
strcpy(infostr, "Down to Diablo"); strcpy(infostr, "Down to Diablo");
for (j = 0; j < trigflag_4; j++) { for (j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursmx = trigs[j]._tx; cursmx = trigs[j]._tx;
cursmy = trigs[j]._ty; cursmy = trigs[j]._ty;
@ -591,7 +589,7 @@ void Freeupstairs()
{ {
int i, yy, xx, tx, ty; int i, yy, xx, tx, ty;
for (i = 0; i < trigflag_4; i++) { for (i = 0; i < numtrigs; i++) {
tx = trigs[i]._tx; tx = trigs[i]._tx;
ty = trigs[i]._ty; ty = trigs[i]._ty;
@ -656,63 +654,49 @@ BOOL ForcePWaterTrig()
void CheckTrigForce() void CheckTrigForce()
{ {
int v0; // eax trigflag = FALSE;
int v1; // eax
if(MouseY > 352 - 1) {
trigflag_3 = 0; return;
if (MouseY <= 351) { }
if (setlevel) {
switch (setlvlnum) { if(!setlevel) {
case SL_SKELKING: switch(leveltype) {
v1 = ForceSKingTrig(); case DTYPE_TOWN:
break; trigflag = ForceTownTrig();
case SL_BONECHAMB: break;
v1 = ForceSChambTrig(); case DTYPE_CATHEDRAL:
break; trigflag = ForceL1Trig();
case SL_POISONWATER: break;
v1 = ForcePWaterTrig(); case DTYPE_CATACOMBS:
break; trigflag = ForceL2Trig();
default: break;
return; case DTYPE_CAVES:
} trigflag = ForceL3Trig();
goto LABEL_23; break;
} case DTYPE_HELL:
if (leveltype) { trigflag = ForceL4Trig();
switch (leveltype) { break;
case DTYPE_CATHEDRAL: }
v0 = ForceL1Trig(); if(leveltype != DTYPE_TOWN && !trigflag) {
break; trigflag = ForceQuests();
case DTYPE_CATACOMBS:
v0 = ForceL2Trig();
break;
case DTYPE_CAVES:
v0 = ForceL3Trig();
break;
case DTYPE_HELL:
v0 = ForceL4Trig();
break;
default:
LABEL_14:
if (leveltype == DTYPE_TOWN)
goto LABEL_24;
if (trigflag_3) {
LABEL_25:
ClearPanel();
return;
}
v1 = ForceQuests();
LABEL_23:
trigflag_3 = v1;
LABEL_24:
if (!trigflag_3)
return;
goto LABEL_25;
}
} else {
v0 = ForceTownTrig();
} }
trigflag_3 = v0; } else {
goto LABEL_14; switch(setlvlnum) {
case SL_SKELKING:
trigflag = ForceSKingTrig();
break;
case SL_BONECHAMB:
trigflag = ForceSChambTrig();
break;
case SL_POISONWATER:
trigflag = ForcePWaterTrig();
break;
}
}
if(trigflag) {
ClearPanel();
} }
} }
// 5CF31D: using guessed type char setlevel; // 5CF31D: using guessed type char setlevel;
@ -726,7 +710,7 @@ void CheckTriggers()
if (plr[myplr]._pmode) if (plr[myplr]._pmode)
return; return;
for (i = 0; i < trigflag_4; i++) { for (i = 0; i < numtrigs; i++) {
if (plr[myplr].WorldX != trigs[i]._tx || plr[myplr].WorldY != trigs[i]._ty) { if (plr[myplr].WorldX != trigs[i]._tx || plr[myplr].WorldY != trigs[i]._ty) {
continue; continue;
} }

10
Source/trigs.h

@ -2,13 +2,9 @@
#ifndef __TRIGS_H__ #ifndef __TRIGS_H__
#define __TRIGS_H__ #define __TRIGS_H__
// The trigflag variables (0-4) here were split up from the trigflag array. extern BOOL townwarps[3];
// Complete diff is part of PR #947 on Github. extern BOOL trigflag;
extern int trigflag_0; extern int numtrigs;
extern int trigflag_1;
extern int trigflag_2;
extern int trigflag_3;
extern int trigflag_4;
extern TriggerStruct trigs[MAXTRIGGERS]; extern TriggerStruct trigs[MAXTRIGGERS];
extern int TWarpFrom; // weak extern int TWarpFrom; // weak

9
SourceX/dvlnet/abstract_net.h

@ -11,7 +11,6 @@ namespace dvl {
namespace net { namespace net {
typedef std::vector<unsigned char> buffer_t; typedef std::vector<unsigned char> buffer_t;
typedef void(*snet_event_func)(struct _SNETEVENT*);
typedef unsigned long provider_t; typedef unsigned long provider_t;
class dvlnet_exception : public std::exception {}; class dvlnet_exception : public std::exception {};
@ -27,10 +26,10 @@ public:
DWORD* status) = 0; DWORD* status) = 0;
virtual bool SNetSendTurn(char* data, unsigned int size) = 0; virtual bool SNetSendTurn(char* data, unsigned int size) = 0;
virtual int SNetGetProviderCaps(struct _SNETCAPS* caps) = 0; virtual int SNetGetProviderCaps(struct _SNETCAPS* caps) = 0;
virtual void* SNetRegisterEventHandler(event_type evtype, virtual bool SNetRegisterEventHandler(event_type evtype,
snet_event_func func) = 0; SEVTHANDLER func) = 0;
virtual void* SNetUnregisterEventHandler(event_type evtype, virtual bool SNetUnregisterEventHandler(event_type evtype,
snet_event_func func) = 0; SEVTHANDLER func) = 0;
virtual bool SNetLeaveGame(int type) = 0; virtual bool SNetLeaveGame(int type) = 0;
virtual bool SNetDropPlayer(int playerid, DWORD flags) = 0; virtual bool SNetDropPlayer(int playerid, DWORD flags) = 0;
virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns) = 0; virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns) = 0;

8
SourceX/dvlnet/base.cpp

@ -195,13 +195,13 @@ int base::SNetGetProviderCaps(struct _SNETCAPS* caps)
return 1; return 1;
} }
void* base::SNetUnregisterEventHandler(event_type evtype, snet_event_func func) bool base::SNetUnregisterEventHandler(event_type evtype, SEVTHANDLER func)
{ {
registered_handlers.erase(evtype); registered_handlers.erase(evtype);
return (void*)func; return true;
} }
void* base::SNetRegisterEventHandler(event_type evtype, snet_event_func func) bool base::SNetRegisterEventHandler(event_type evtype, SEVTHANDLER func)
{ {
/* /*
engine registers handler for: engine registers handler for:
@ -212,7 +212,7 @@ void* base::SNetRegisterEventHandler(event_type evtype, snet_event_func func)
(engine uses same function for all three) (engine uses same function for all three)
*/ */
registered_handlers[evtype] = func; registered_handlers[evtype] = func;
return (void*)func; return true;
} }
bool base::SNetLeaveGame(int type) bool base::SNetLeaveGame(int type)

10
SourceX/dvlnet/base.h

@ -32,10 +32,10 @@ public:
DWORD* status); DWORD* status);
virtual bool SNetSendTurn(char* data, unsigned int size); virtual bool SNetSendTurn(char* data, unsigned int size);
virtual int SNetGetProviderCaps(struct _SNETCAPS* caps); virtual int SNetGetProviderCaps(struct _SNETCAPS* caps);
virtual void* SNetRegisterEventHandler(event_type evtype, virtual bool SNetRegisterEventHandler(event_type evtype,
snet_event_func func); SEVTHANDLER func);
virtual void* SNetUnregisterEventHandler(event_type evtype, virtual bool SNetUnregisterEventHandler(event_type evtype,
snet_event_func func); SEVTHANDLER func);
virtual bool SNetLeaveGame(int type); virtual bool SNetLeaveGame(int type);
virtual bool SNetDropPlayer(int playerid, DWORD flags); virtual bool SNetDropPlayer(int playerid, DWORD flags);
virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns); virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns);
@ -46,7 +46,7 @@ public:
void setup_gameinfo(buffer_t info); void setup_gameinfo(buffer_t info);
protected: protected:
std::map<event_type, snet_event_func> registered_handlers; std::map<event_type, SEVTHANDLER> registered_handlers;
buffer_t game_init_info; buffer_t game_init_info;
struct message_t { struct message_t {

12
SourceX/dvlnet/loopback.cpp

@ -63,20 +63,20 @@ int loopback::SNetGetProviderCaps(struct _SNETCAPS* caps)
return 1; return 1;
} }
void* loopback::SNetRegisterEventHandler(event_type evtype, bool loopback::SNetRegisterEventHandler(event_type evtype,
snet_event_func func) SEVTHANDLER func)
{ {
// not called in real singleplayer mode // not called in real singleplayer mode
// not needed in pseudo multiplayer mode (?) // not needed in pseudo multiplayer mode (?)
return this; return true;
} }
void* loopback::SNetUnregisterEventHandler(event_type evtype, bool loopback::SNetUnregisterEventHandler(event_type evtype,
snet_event_func func) SEVTHANDLER func)
{ {
// not called in real singleplayer mode // not called in real singleplayer mode
// not needed in pseudo multiplayer mode (?) // not needed in pseudo multiplayer mode (?)
return this; return true;
} }
bool loopback::SNetLeaveGame(int type) bool loopback::SNetLeaveGame(int type)

8
SourceX/dvlnet/loopback.h

@ -24,10 +24,10 @@ public:
DWORD* status); DWORD* status);
virtual bool SNetSendTurn(char* data, unsigned int size); virtual bool SNetSendTurn(char* data, unsigned int size);
virtual int SNetGetProviderCaps(struct _SNETCAPS* caps); virtual int SNetGetProviderCaps(struct _SNETCAPS* caps);
virtual void *SNetRegisterEventHandler(event_type evtype, virtual bool SNetRegisterEventHandler(event_type evtype,
snet_event_func func); SEVTHANDLER func);
virtual void *SNetUnregisterEventHandler(event_type evtype, virtual bool SNetUnregisterEventHandler(event_type evtype,
snet_event_func func); SEVTHANDLER func);
virtual bool SNetLeaveGame(int type); virtual bool SNetLeaveGame(int type);
virtual bool SNetDropPlayer(int playerid, DWORD flags); virtual bool SNetDropPlayer(int playerid, DWORD flags);
virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns); virtual bool SNetGetOwnerTurnsWaiting(DWORD *turns);

4
SourceX/storm/storm_net.cpp

@ -46,12 +46,12 @@ int SNetGetProviderCaps(struct _SNETCAPS *caps)
return dvlnet_inst->SNetGetProviderCaps(caps); return dvlnet_inst->SNetGetProviderCaps(caps);
} }
void *SNetUnregisterEventHandler(int evtype, void(*func)(struct _SNETEVENT *)) BOOL SNetUnregisterEventHandler(int evtype, SEVTHANDLER func)
{ {
return dvlnet_inst->SNetUnregisterEventHandler(*(event_type *)&evtype, func); return dvlnet_inst->SNetUnregisterEventHandler(*(event_type *)&evtype, func);
} }
void *SNetRegisterEventHandler(int evtype, void(*func)(struct _SNETEVENT *)) BOOL SNetRegisterEventHandler(int evtype, SEVTHANDLER func)
{ {
return dvlnet_inst->SNetRegisterEventHandler(*(event_type *)&evtype, func); return dvlnet_inst->SNetRegisterEventHandler(*(event_type *)&evtype, func);
} }

2
structs.h

@ -1247,8 +1247,6 @@ typedef struct _uiheroinfo {
// storm // storm
////////////////////////////////////////////////// //////////////////////////////////////////////////
// TPDEF PTR FCN VOID SEVTHANDLER
// TPDEF PTR FCN UCHAR SMSGIDLEPROC // TPDEF PTR FCN UCHAR SMSGIDLEPROC
// TPDEF PTR FCN VOID SMSGHANDLER // TPDEF PTR FCN VOID SMSGHANDLER

Loading…
Cancel
Save