|
|
|
|
@ -8,19 +8,26 @@
|
|
|
|
|
#include "../DiabloUI/diabloui.h" |
|
|
|
|
|
|
|
|
|
HWND ghMainWnd; |
|
|
|
|
DWORD glSeedTbl[NUMLEVELS]; |
|
|
|
|
int gnLevelTypeTbl[NUMLEVELS]; |
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
int glEndSeed[NUMLEVELS]; |
|
|
|
|
int glMid1Seed[NUMLEVELS]; |
|
|
|
|
int glMid2Seed[NUMLEVELS]; |
|
|
|
|
int glMid3Seed[NUMLEVELS]; |
|
|
|
|
#else |
|
|
|
|
int glEndSeed[NUMLEVELS + 1]; |
|
|
|
|
int glMid1Seed[NUMLEVELS + 1]; |
|
|
|
|
int glMid2Seed[NUMLEVELS + 1]; |
|
|
|
|
int gnLevelTypeTbl[NUMLEVELS]; |
|
|
|
|
int glMid3Seed[NUMLEVELS + 1]; |
|
|
|
|
#endif |
|
|
|
|
int MouseX; |
|
|
|
|
int MouseY; |
|
|
|
|
BOOL gbGameLoopStartup; |
|
|
|
|
DWORD glSeedTbl[NUMLEVELS]; |
|
|
|
|
BOOL gbRunGame; |
|
|
|
|
int glMid3Seed[NUMLEVELS + 1]; |
|
|
|
|
BOOL gbRunGameResult; |
|
|
|
|
BOOL zoomflag; |
|
|
|
|
BOOL gbProcessPlayers; |
|
|
|
|
int glEndSeed[NUMLEVELS + 1]; |
|
|
|
|
BOOL gbLoadGame; |
|
|
|
|
HINSTANCE ghInst; |
|
|
|
|
int DebugMonsters[10]; |
|
|
|
|
@ -37,14 +44,6 @@ BOOL trigdebug;
|
|
|
|
|
int setseed; |
|
|
|
|
int debugmonsttypes; |
|
|
|
|
int PauseMode; |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
BOOLEAN UseTheoQuest; |
|
|
|
|
BOOLEAN UseCowFarmer; |
|
|
|
|
BOOLEAN UseNestArt; |
|
|
|
|
BOOLEAN UseBardTest; |
|
|
|
|
BOOLEAN UseBarbarianTest; |
|
|
|
|
BOOLEAN UseMultiTest; |
|
|
|
|
#endif |
|
|
|
|
int sgnTimeoutCurs; |
|
|
|
|
char sgbMouseDown; |
|
|
|
|
int color_cycle_timer; |
|
|
|
|
@ -112,9 +111,7 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer)
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
fExitProgram = FALSE; |
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
gbLoadGame = FALSE; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (!NetInit(bSinglePlayer, &fExitProgram)) { |
|
|
|
|
gbRunGameResult = !fExitProgram; |
|
|
|
|
@ -128,25 +125,16 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer)
|
|
|
|
|
InitQuests(); |
|
|
|
|
InitPortals(); |
|
|
|
|
InitDungMsgs(myplr); |
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
} |
|
|
|
|
if (!gbValidSaveFile || !gbLoadGame) { |
|
|
|
|
#else |
|
|
|
|
if (!gbValidSaveFile && gbLoadGame) |
|
|
|
|
inv_diablo_to_hellfire(myplr); |
|
|
|
|
#endif |
|
|
|
|
uMsg = WM_DIABNEWGAME; |
|
|
|
|
} else { |
|
|
|
|
uMsg = WM_DIABLOADGAME; |
|
|
|
|
} |
|
|
|
|
run_game_loop(uMsg); |
|
|
|
|
NetClose(); |
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
pfile_create_player_description(0, 0); |
|
|
|
|
} while (gbRunGameResult); |
|
|
|
|
#else |
|
|
|
|
} while (gbMaxPlayers == 1 || !gbRunGameResult); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
SNetDestroy(); |
|
|
|
|
return gbRunGameResult; |
|
|
|
|
@ -200,9 +188,7 @@ void run_game_loop(unsigned int uMsg)
|
|
|
|
|
} |
|
|
|
|
multi_process_network_packets(); |
|
|
|
|
game_loop(gbGameLoopStartup); |
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
msgcmd_send_chat(); |
|
|
|
|
#endif |
|
|
|
|
gbGameLoopStartup = FALSE; |
|
|
|
|
DrawAndBlit(); |
|
|
|
|
} |
|
|
|
|
@ -268,9 +254,6 @@ BOOL diablo_get_not_running()
|
|
|
|
|
{ |
|
|
|
|
SetLastError(0); |
|
|
|
|
CreateEvent(NULL, FALSE, FALSE, "DiabloEvent"); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
CreateEvent(NULL, FALSE, FALSE, "HellfireEvent"); |
|
|
|
|
#endif |
|
|
|
|
return GetLastError() != ERROR_ALREADY_EXISTS; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -287,10 +270,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|
|
|
|
int nData; |
|
|
|
|
char szFileName[MAX_PATH]; |
|
|
|
|
BOOL bNoEvent; |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
char content[256]; |
|
|
|
|
FILE *file; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
hInst = hInstance; |
|
|
|
|
#ifndef DEBUGGER |
|
|
|
|
@ -298,7 +277,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|
|
|
|
#endif |
|
|
|
|
ghInst = hInst; |
|
|
|
|
|
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
if (RestrictedTest()) |
|
|
|
|
ErrOkDlg(IDD_DIALOG10, 0, "C:\\Src\\Diablo\\Source\\DIABLO.CPP", 877); |
|
|
|
|
if (ReadOnlyTest()) { |
|
|
|
|
@ -306,23 +284,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|
|
|
|
szFileName[0] = '\0'; |
|
|
|
|
DirErrorDlg(szFileName); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
ShowCursor(FALSE); |
|
|
|
|
srand(GetTickCount()); |
|
|
|
|
InitHash(); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
alloc_plr(); |
|
|
|
|
lpTopLevelExceptionFilter = SetUnhandledExceptionFilter(diablo_TopLevelExceptionFilter); |
|
|
|
|
#else |
|
|
|
|
fault_get_filter(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
bNoEvent = diablo_get_not_running(); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if (diablo_find_window("DIABLO")) |
|
|
|
|
return 0; |
|
|
|
|
#endif |
|
|
|
|
if (diablo_find_window(GAME_NAME) || !bNoEvent) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
@ -330,16 +298,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|
|
|
|
SFileEnableDirectAccess(TRUE); |
|
|
|
|
#endif |
|
|
|
|
diablo_init_screen(); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if (lpCmdLine[0] == '\0') { |
|
|
|
|
content[0] = '\0'; |
|
|
|
|
if (file = fopen("command.txt", "r")) { |
|
|
|
|
fgets(content, sizeof(content) / sizeof(char), file); |
|
|
|
|
lpCmdLine = content; |
|
|
|
|
fclose(file); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
diablo_parse_flags(lpCmdLine); |
|
|
|
|
init_create_window(nCmdShow); |
|
|
|
|
ui_sound_init(); |
|
|
|
|
@ -358,12 +316,8 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|
|
|
|
char szValueName[] = "Intro"; |
|
|
|
|
if (!SRegLoadValue(APP_NAME, szValueName, 0, &nData)) |
|
|
|
|
nData = 1; |
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
if (nData) |
|
|
|
|
play_movie("gendata\\diablo1.smk", TRUE); |
|
|
|
|
#else |
|
|
|
|
play_movie("gendata\\Hellfire.smk", TRUE); |
|
|
|
|
#endif |
|
|
|
|
SRegSaveValue(APP_NAME, szValueName, 0, 0); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
@ -418,44 +372,6 @@ void diablo_parse_flags(char *args)
|
|
|
|
|
args += strlen(ds); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
char tq[] = "Theoquest"; |
|
|
|
|
if (_strnicmp(tq, args, strlen(tq)) == 0) { |
|
|
|
|
UseTheoQuest = TRUE; |
|
|
|
|
args += strlen(tq); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
char cq[] = "Cowquest"; |
|
|
|
|
if (_strnicmp(cq, args, strlen(cq)) == 0) { |
|
|
|
|
UseCowFarmer = TRUE; |
|
|
|
|
args += strlen(cq); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
char na[] = "NestArt"; |
|
|
|
|
if (_strnicmp(na, args, strlen(na)) == 0) { |
|
|
|
|
UseNestArt = TRUE; |
|
|
|
|
args += strlen(na); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
char bt[] = "Bardtest"; |
|
|
|
|
if (_strnicmp(bt, args, strlen(bt)) == 0) { |
|
|
|
|
UseBardTest = TRUE; |
|
|
|
|
args += strlen(bt); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
char mt[] = "Multitest"; |
|
|
|
|
if (_strnicmp(mt, bt, strlen(mt)) == 0) { // BUGFIX: secound arg should be args
|
|
|
|
|
UseMultiTest = TRUE; |
|
|
|
|
args += strlen(mt); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
char bb[] = "Barbariantest"; |
|
|
|
|
if (_strnicmp(bb, args, strlen(bb)) == 0) { |
|
|
|
|
UseBarbarianTest = TRUE; |
|
|
|
|
args += strlen(bb); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
c = tolower(*args); |
|
|
|
|
args++; |
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
@ -469,7 +385,7 @@ void diablo_parse_flags(char *args)
|
|
|
|
|
case 'b': |
|
|
|
|
/*
|
|
|
|
|
debug_mode_key_b = TRUE; |
|
|
|
|
*/ |
|
|
|
|
*/ |
|
|
|
|
break; |
|
|
|
|
case 'd': |
|
|
|
|
showintrodebug = FALSE; |
|
|
|
|
@ -483,16 +399,16 @@ void diablo_parse_flags(char *args)
|
|
|
|
|
break; |
|
|
|
|
case 'j': |
|
|
|
|
/*
|
|
|
|
|
while(isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while(isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
debug_mode_key_J_trigger = i; |
|
|
|
|
*/ |
|
|
|
|
while(isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while(isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
debug_mode_key_J_trigger = i; |
|
|
|
|
*/ |
|
|
|
|
break; |
|
|
|
|
case 'l': |
|
|
|
|
setlevel = FALSE; |
|
|
|
|
@ -602,18 +518,6 @@ void diablo_init_screen()
|
|
|
|
|
ClrDiabloMsg(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
LONG __stdcall diablo_TopLevelExceptionFilter(PEXCEPTION_POINTERS pExc) |
|
|
|
|
{ |
|
|
|
|
dx_cleanup(); |
|
|
|
|
init_cleanup(FALSE); |
|
|
|
|
if (lpTopLevelExceptionFilter) |
|
|
|
|
return lpTopLevelExceptionFilter(pExc); |
|
|
|
|
|
|
|
|
|
return EXCEPTION_CONTINUE_SEARCH; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
BOOL diablo_find_window(LPCSTR lpClassName) |
|
|
|
|
{ |
|
|
|
|
HWND hWnd, active; |
|
|
|
|
@ -1044,15 +948,6 @@ BOOL TryIconCurs()
|
|
|
|
|
NewCursor(CURSOR_HAND); |
|
|
|
|
} |
|
|
|
|
return TRUE; |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
} else if (pcurs == CURSOR_OIL) { |
|
|
|
|
if (pcursinvitem != -1) { |
|
|
|
|
DoOil(myplr, pcursinvitem); |
|
|
|
|
} else { |
|
|
|
|
SetCursor_(CURSOR_HAND); |
|
|
|
|
} |
|
|
|
|
return TRUE; |
|
|
|
|
#endif |
|
|
|
|
} else if (pcurs == CURSOR_TELEPORT) { |
|
|
|
|
if (pcursmonst != -1) { |
|
|
|
|
NetSendCmdParam3(TRUE, CMD_TSPELLID, pcursmonst, plr[myplr]._pTSpell, GetSpellLevel(myplr, plr[myplr]._pTSpell)); |
|
|
|
|
@ -1475,17 +1370,7 @@ void PressChar(int vkey)
|
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
case 'v': |
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
NetSendCmdString(1 << myplr, gszProductName); |
|
|
|
|
#else |
|
|
|
|
char *local_10[3]; |
|
|
|
|
char pszStr[120]; |
|
|
|
|
local_10[0] = "Normal"; |
|
|
|
|
local_10[1] = "Nightmare"; |
|
|
|
|
local_10[2] = "Hell"; |
|
|
|
|
sprintf(pszStr, "%s, mode = %s", gszProductName, local_10[gnDifficulty]); |
|
|
|
|
NetSendCmdString(1 << myplr, pszStr); |
|
|
|
|
#endif |
|
|
|
|
return; |
|
|
|
|
case 'V': |
|
|
|
|
NetSendCmdString(1 << myplr, gszVersionNumber); |
|
|
|
|
@ -1643,37 +1528,20 @@ void PressChar(int vkey)
|
|
|
|
|
|
|
|
|
|
void LoadLvlGFX() |
|
|
|
|
{ |
|
|
|
|
assert(! pDungeonCels); |
|
|
|
|
assert(!pDungeonCels); |
|
|
|
|
|
|
|
|
|
switch (leveltype) { |
|
|
|
|
case DTYPE_TOWN: |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
pDungeonCels = LoadFileInMem("NLevels\\TownData\\Town.CEL", NULL); |
|
|
|
|
pMegaTiles = LoadFileInMem("NLevels\\TownData\\Town.TIL", NULL); |
|
|
|
|
pLevelPieces = LoadFileInMem("NLevels\\TownData\\Town.MIN", NULL); |
|
|
|
|
#else |
|
|
|
|
pDungeonCels = LoadFileInMem("Levels\\TownData\\Town.CEL", NULL); |
|
|
|
|
pMegaTiles = LoadFileInMem("Levels\\TownData\\Town.TIL", NULL); |
|
|
|
|
pLevelPieces = LoadFileInMem("Levels\\TownData\\Town.MIN", NULL); |
|
|
|
|
#endif |
|
|
|
|
pSpecialCels = LoadFileInMem("Levels\\TownData\\TownS.CEL", NULL); |
|
|
|
|
break; |
|
|
|
|
case DTYPE_CATHEDRAL: |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if (currlevel < 21) { |
|
|
|
|
#endif |
|
|
|
|
pDungeonCels = LoadFileInMem("Levels\\L1Data\\L1.CEL", NULL); |
|
|
|
|
pMegaTiles = LoadFileInMem("Levels\\L1Data\\L1.TIL", NULL); |
|
|
|
|
pLevelPieces = LoadFileInMem("Levels\\L1Data\\L1.MIN", NULL); |
|
|
|
|
pSpecialCels = LoadFileInMem("Levels\\L1Data\\L1S.CEL", NULL); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
} else { |
|
|
|
|
pDungeonCels = LoadFileInMem("NLevels\\L5Data\\L5.CEL", NULL); |
|
|
|
|
pMegaTiles = LoadFileInMem("NLevels\\L5Data\\L5.TIL", NULL); |
|
|
|
|
pLevelPieces = LoadFileInMem("NLevels\\L5Data\\L5.MIN", NULL); |
|
|
|
|
pSpecialCels = LoadFileInMem("NLevels\\L5Data\\L5S.CEL", NULL); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
pDungeonCels = LoadFileInMem("Levels\\L1Data\\L1.CEL", NULL); |
|
|
|
|
pMegaTiles = LoadFileInMem("Levels\\L1Data\\L1.TIL", NULL); |
|
|
|
|
pLevelPieces = LoadFileInMem("Levels\\L1Data\\L1.MIN", NULL); |
|
|
|
|
pSpecialCels = LoadFileInMem("Levels\\L1Data\\L1S.CEL", NULL); |
|
|
|
|
break; |
|
|
|
|
#ifndef SPAWN |
|
|
|
|
case DTYPE_CATACOMBS: |
|
|
|
|
@ -1683,19 +1551,9 @@ void LoadLvlGFX()
|
|
|
|
|
pSpecialCels = LoadFileInMem("Levels\\L2Data\\L2S.CEL", NULL); |
|
|
|
|
break; |
|
|
|
|
case DTYPE_CAVES: |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if (currlevel < 17) { |
|
|
|
|
#endif |
|
|
|
|
pDungeonCels = LoadFileInMem("Levels\\L3Data\\L3.CEL", NULL); |
|
|
|
|
pMegaTiles = LoadFileInMem("Levels\\L3Data\\L3.TIL", NULL); |
|
|
|
|
pLevelPieces = LoadFileInMem("Levels\\L3Data\\L3.MIN", NULL); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
} else { |
|
|
|
|
pDungeonCels = LoadFileInMem("NLevels\\L6Data\\L6.CEL", NULL); |
|
|
|
|
pMegaTiles = LoadFileInMem("NLevels\\L6Data\\L6.TIL", NULL); |
|
|
|
|
pLevelPieces = LoadFileInMem("NLevels\\L6Data\\L6.MIN", NULL); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
pDungeonCels = LoadFileInMem("Levels\\L3Data\\L3.CEL", NULL); |
|
|
|
|
pMegaTiles = LoadFileInMem("Levels\\L3Data\\L3.TIL", NULL); |
|
|
|
|
pLevelPieces = LoadFileInMem("Levels\\L3Data\\L3.MIN", NULL); |
|
|
|
|
pSpecialCels = LoadFileInMem("Levels\\L1Data\\L1S.CEL", NULL); |
|
|
|
|
break; |
|
|
|
|
case DTYPE_HELL: |
|
|
|
|
@ -1713,7 +1571,7 @@ void LoadLvlGFX()
|
|
|
|
|
|
|
|
|
|
void LoadAllGFX() |
|
|
|
|
{ |
|
|
|
|
assert(! pSpeedCels); |
|
|
|
|
assert(!pSpeedCels); |
|
|
|
|
pSpeedCels = DiabloAllocPtr(0x100000); |
|
|
|
|
IncProgress(); |
|
|
|
|
IncProgress(); |
|
|
|
|
@ -1738,15 +1596,7 @@ void CreateLevel(int lvldir)
|
|
|
|
|
CreateL5Dungeon(glSeedTbl[currlevel], lvldir); |
|
|
|
|
InitL1Triggers(); |
|
|
|
|
Freeupstairs(); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if(currlevel < 21) { |
|
|
|
|
LoadRndLvlPal(1); |
|
|
|
|
} else { |
|
|
|
|
LoadRndLvlPal(5); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
LoadRndLvlPal(1); |
|
|
|
|
#endif |
|
|
|
|
break; |
|
|
|
|
#ifndef SPAWN |
|
|
|
|
case DTYPE_CATACOMBS: |
|
|
|
|
@ -1759,15 +1609,7 @@ void CreateLevel(int lvldir)
|
|
|
|
|
CreateL3Dungeon(glSeedTbl[currlevel], lvldir); |
|
|
|
|
InitL3Triggers(); |
|
|
|
|
Freeupstairs(); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if(currlevel < 17) { |
|
|
|
|
LoadRndLvlPal(3); |
|
|
|
|
} else { |
|
|
|
|
LoadRndLvlPal(6); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
LoadRndLvlPal(3); |
|
|
|
|
#endif |
|
|
|
|
break; |
|
|
|
|
case DTYPE_HELL: |
|
|
|
|
CreateL4Dungeon(glSeedTbl[currlevel], lvldir); |
|
|
|
|
@ -1878,10 +1720,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
|
|
|
|
|
glMid2Seed[currlevel] = GetRndSeed(); |
|
|
|
|
InitObjects(); |
|
|
|
|
InitItems(); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if ( currlevel < 17 ) |
|
|
|
|
#endif |
|
|
|
|
CreateThemeRooms(); |
|
|
|
|
CreateThemeRooms(); |
|
|
|
|
glMid3Seed[currlevel] = GetRndSeed(); |
|
|
|
|
InitMissiles(); |
|
|
|
|
InitDead(); |
|
|
|
|
@ -1924,7 +1763,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
|
|
|
|
|
ResyncMPQuests(); |
|
|
|
|
#ifndef SPAWN |
|
|
|
|
} else { |
|
|
|
|
assert(! pSpeedCels); |
|
|
|
|
assert(!pSpeedCels); |
|
|
|
|
pSpeedCels = DiabloAllocPtr(0x100000); |
|
|
|
|
LoadSetMap(); |
|
|
|
|
IncProgress(); |
|
|
|
|
@ -1992,28 +1831,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
|
|
|
|
|
ProcessVisionList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if ( currlevel >= 21 ) |
|
|
|
|
{ |
|
|
|
|
if ( currlevel == 21 ) |
|
|
|
|
{ |
|
|
|
|
items_427ABA(RowOfCornerStone, ColOfCornerStone); |
|
|
|
|
} |
|
|
|
|
if ( quests[Q_NAKRUL]._qactive == QUEST_DONE && currlevel == 24 ) // TODO: fix quest struct
|
|
|
|
|
{ |
|
|
|
|
objects_454BA8(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
if ( currlevel >= 17 ) |
|
|
|
|
music_start(currlevel > 20 ? TMUSIC_L5 : TMUSIC_L6); |
|
|
|
|
else |
|
|
|
|
music_start(leveltype); |
|
|
|
|
#else |
|
|
|
|
music_start(leveltype); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
while (!IncProgress()) |
|
|
|
|
; |
|
|
|
|
@ -2118,56 +1936,13 @@ void diablo_color_cyc_logic()
|
|
|
|
|
tc = GetTickCount(); |
|
|
|
|
if (tc - color_cycle_timer >= 50) { |
|
|
|
|
color_cycle_timer = tc; |
|
|
|
|
#ifndef HELLFIRE |
|
|
|
|
if (!palette_get_color_cycling()) |
|
|
|
|
return; |
|
|
|
|
#endif |
|
|
|
|
if (leveltype == DTYPE_HELL) { |
|
|
|
|
lighting_color_cycling(); |
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
} else if (currlevel >= 21) { |
|
|
|
|
palette_update_crypt(); |
|
|
|
|
} else if (currlevel >= 17) { |
|
|
|
|
palette_update_hive(); |
|
|
|
|
#endif |
|
|
|
|
} else if (leveltype == DTYPE_CAVES) { |
|
|
|
|
if (fullscreen) |
|
|
|
|
palette_update_caves(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef HELLFIRE |
|
|
|
|
void alloc_plr() |
|
|
|
|
{ |
|
|
|
|
plr = get_plr_mem(NULL); |
|
|
|
|
|
|
|
|
|
if(plr == NULL) { |
|
|
|
|
app_fatal("Unable to initialize memory"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
memset(plr, 0, sizeof(PlayerStruct) * MAX_PLRS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PlayerStruct *get_plr_mem(PlayerStruct *p) |
|
|
|
|
{ |
|
|
|
|
void *r; |
|
|
|
|
PlayerStruct *pPlayer; |
|
|
|
|
|
|
|
|
|
r = malloc(rand() & 0x7FFF); |
|
|
|
|
pPlayer = (PlayerStruct *)malloc(sizeof(PlayerStruct) * MAX_PLRS); |
|
|
|
|
|
|
|
|
|
if(r != NULL) { |
|
|
|
|
free(r); |
|
|
|
|
} |
|
|
|
|
if(pPlayer == NULL) { |
|
|
|
|
return p; |
|
|
|
|
} |
|
|
|
|
if(p != NULL) { |
|
|
|
|
memcpy(pPlayer, p, sizeof(PlayerStruct) * MAX_PLRS); |
|
|
|
|
free(p); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return pPlayer; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|