Browse Source

More cleanups

pull/700/head^2
Anders Jenbo 6 years ago
parent
commit
7e45f8bcc8
  1. 8
      Source/mainmenu.cpp
  2. 2
      Source/mainmenu.h
  3. 2
      Source/portal.cpp
  4. 8
      Source/themes.cpp
  5. 52
      Source/towners.cpp
  6. 2
      Source/towners.h
  7. 2
      Source/track.cpp
  8. 48
      Source/trigs.cpp
  9. 2
      defs.h

8
Source/mainmenu.cpp

@ -32,7 +32,7 @@ void __stdcall mainmenu_change_name(int arg1, int arg2, int arg3, int arg4, char
pfile_rename_hero(name_1, name_2); pfile_rename_hero(name_1, name_2);
} }
int __stdcall mainmenu_select_hero_dialog( BOOL __stdcall mainmenu_select_hero_dialog(
const _SNETPROGRAMDATA *client_info, const _SNETPROGRAMDATA *client_info,
const _SNETPLAYERDATA *user_info, const _SNETPLAYERDATA *user_info,
const _SNETUIDATA *ui_info, const _SNETUIDATA *ui_info,
@ -72,7 +72,7 @@ int __stdcall mainmenu_select_hero_dialog(
} }
if (dlgresult == SELHERO_PREVIOUS) { if (dlgresult == SELHERO_PREVIOUS) {
SErrSetLastError(1223); SErrSetLastError(1223);
return 0; return FALSE;
} }
pfile_create_player_description(cdesc, cdlen); pfile_create_player_description(cdesc, cdlen);
@ -85,7 +85,7 @@ int __stdcall mainmenu_select_hero_dialog(
if (cname && clen) if (cname && clen)
SStrCopy(cname, gszHero, clen); SStrCopy(cname, gszHero, clen);
return 1; return TRUE;
} }
void mainmenu_loop() void mainmenu_loop()
@ -126,7 +126,7 @@ void mainmenu_loop()
done = TRUE; done = TRUE;
break; break;
} }
} while (done == FALSE); } while (!done);
music_stop(); music_stop();
} }

2
Source/mainmenu.h

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

2
Source/portal.cpp

@ -109,7 +109,7 @@ void RemovePortalMissile(int id)
dFlags[missile[mi]._mix][missile[mi]._miy] &= ~BFLAG_MISSILE; dFlags[missile[mi]._mix][missile[mi]._miy] &= ~BFLAG_MISSILE;
dMissile[missile[mi]._mix][missile[mi]._miy] = 0; dMissile[missile[mi]._mix][missile[mi]._miy] = 0;
if (portal[id].level) if (portal[id].level != 0)
AddUnLight(missile[mi]._mlid); AddUnLight(missile[mi]._mlid);
DeleteMissile(mi, i); DeleteMissile(mi, i);

8
Source/themes.cpp

@ -24,7 +24,7 @@ BOOL bCrossFlag;
int ThemeGood[4] = { THEME_GOATSHRINE, THEME_SHRINE, THEME_SKELROOM, THEME_LIBRARY }; int ThemeGood[4] = { THEME_GOATSHRINE, THEME_SHRINE, THEME_SKELROOM, THEME_LIBRARY };
int trm5x[25] = { int trm5x[] = {
-2, -1, 0, 1, 2, -2, -1, 0, 1, 2,
-2, -1, 0, 1, 2, -2, -1, 0, 1, 2,
-2, -1, 0, 1, 2, -2, -1, 0, 1, 2,
@ -32,7 +32,7 @@ int trm5x[25] = {
-2, -1, 0, 1, 2 -2, -1, 0, 1, 2
}; };
int trm5y[25] = { int trm5y[] = {
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -40,13 +40,13 @@ int trm5y[25] = {
2, 2, 2, 2, 2 2, 2, 2, 2, 2
}; };
int trm3x[9] = { int trm3x[] = {
-1, 0, 1, -1, 0, 1,
-1, 0, 1, -1, 0, 1,
-1, 0, 1 -1, 0, 1
}; };
int trm3y[9] = { int trm3y[] = {
-1, -1, -1, -1, -1, -1,
0, 0, 0, 0, 0, 0,
1, 1, 1 1, 1, 1

52
Source/towners.cpp

@ -8,13 +8,13 @@ DWORD sgdwCowClicks;
BOOL bannerflag; BOOL bannerflag;
BOOL boyloadflag; BOOL boyloadflag;
BYTE *pCowCels; BYTE *pCowCels;
TownerStruct towner[16]; TownerStruct towner[NUM_TOWNERS];
#ifndef SPAWN #ifndef SPAWN
const int snSFX[3][NUM_CLASSES] = { const int snSFX[3][NUM_CLASSES] = {
{ PS_WARR52, PS_ROGUE52, PS_MAGE52 }, { PS_WARR52, PS_ROGUE52, PS_MAGE52 },
{ PS_WARR49, PS_ROGUE49, PS_MAGE49 }, { PS_WARR49, PS_ROGUE49, PS_MAGE49 },
{ PS_WARR50, PS_ROGUE50, PS_MAGE50 } { PS_WARR50, PS_ROGUE50, PS_MAGE50 },
}; };
#endif #endif
@ -86,9 +86,9 @@ char AnimOrder[6][148] = {
1, 2, 1, 19, 18, 19, 1, 2, 1, 2, 1, 2, 1, 19, 18, 19, 1, 2, 1, 2,
3, -1 } 3, -1 }
}; };
int TownCowX[3] = { 58, 56, 59 }; int TownCowX[] = { 58, 56, 59 };
int TownCowY[3] = { 16, 14, 20 }; int TownCowY[] = { 16, 14, 20 };
int TownCowDir[3] = { 1, 3, 4 }; int TownCowDir[] = { DIR_SW, DIR_NW, DIR_N };
int cowoffx[8] = { -1, 0, -1, -1, -1, 0, -1, -1 }; int cowoffx[8] = { -1, 0, -1, -1, -1, 0, -1, -1 };
int cowoffy[8] = { -1, -1, -1, 0, -1, -1, -1, 0 }; int cowoffy[8] = { -1, -1, -1, 0, -1, -1, -1, 0 };
QuestTalkData Qtalklist[] = { QuestTalkData Qtalklist[] = {
@ -197,7 +197,7 @@ void InitSmith()
{ {
int i; int i;
InitTownerInfo(numtowners, 96, 1, TOWN_SMITH, 62, 63, 0, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_SMITH, 62, 63, 0, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Smith\\SmithN.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\Smith\\SmithN.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -214,7 +214,7 @@ void InitBarOwner()
int i; int i;
bannerflag = FALSE; // unused bannerflag = FALSE; // unused
InitTownerInfo(numtowners, 96, 1, TOWN_TAVERN, 55, 62, 3, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_TAVERN, 55, 62, 3, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\TwnF\\TwnFN.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\TwnF\\TwnFN.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -230,7 +230,7 @@ void InitTownDead()
{ {
int i; int i;
InitTownerInfo(numtowners, 96, 1, TOWN_DEADGUY, 24, 32, -1, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_DEADGUY, 24, 32, -1, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Butch\\Deadguy.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\Butch\\Deadguy.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -246,7 +246,7 @@ void InitWitch()
{ {
int i; int i;
InitTownerInfo(numtowners, 96, 1, TOWN_WITCH, 80, 20, 5, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_WITCH, 80, 20, 5, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\Witch.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\Witch.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -262,7 +262,7 @@ void InitBarmaid()
{ {
int i; int i;
InitTownerInfo(numtowners, 96, 1, TOWN_BMAID, 43, 66, -1, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_BMAID, 43, 66, -1, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\WmnN.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\WmnN.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -279,7 +279,7 @@ void InitBoy()
int i; int i;
boyloadflag = TRUE; boyloadflag = TRUE;
InitTownerInfo(numtowners, 96, 1, TOWN_PEGBOY, 11, 53, -1, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_PEGBOY, 11, 53, -1, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\TownBoy\\PegKid1.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\TownBoy\\PegKid1.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -295,7 +295,7 @@ void InitHealer()
{ {
int i; int i;
InitTownerInfo(numtowners, 96, 1, TOWN_HEALER, 55, 79, 1, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_HEALER, 55, 79, 1, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Healer\\Healer.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\Healer\\Healer.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -311,7 +311,7 @@ void InitTeller()
{ {
int i; int i;
InitTownerInfo(numtowners, 96, 1, TOWN_STORY, 62, 71, 2, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_STORY, 62, 71, 2, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Strytell\\Strytell.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\Strytell\\Strytell.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -327,7 +327,7 @@ void InitDrunk()
{ {
int i; int i;
InitTownerInfo(numtowners, 96, 1, TOWN_DRUNK, 71, 84, 4, 10); InitTownerInfo(numtowners, 96, TRUE, TOWN_DRUNK, 71, 84, 4, 10);
InitQstSnds(numtowners); InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Drunk\\TwnDrunk.CEL", NULL); towner[numtowners]._tNData = LoadFileInMem("Towners\\Drunk\\TwnDrunk.CEL", NULL);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -351,22 +351,22 @@ void InitCows()
x = TownCowX[i]; x = TownCowX[i];
y = TownCowY[i]; y = TownCowY[i];
dir = TownCowDir[i]; dir = TownCowDir[i];
InitTownerInfo(numtowners, 128, 0, TOWN_COW, TownCowX[i], TownCowY[i], -1, 10); InitTownerInfo(numtowners, 128, FALSE, TOWN_COW, x, y, -1, 10);
towner[numtowners]._tNData = pCowCels; towner[numtowners]._tNData = pCowCels;
SetTownerGPtrs(towner[numtowners]._tNData, towner[numtowners]._tNAnim); SetTownerGPtrs(towner[numtowners]._tNData, towner[numtowners]._tNAnim);
towner[numtowners]._tNFrames = 12; towner[numtowners]._tNFrames = 12;
NewTownerAnim(numtowners, towner[numtowners]._tNAnim[dir], towner[numtowners]._tNFrames, 3); NewTownerAnim(numtowners, towner[numtowners]._tNAnim[dir], towner[numtowners]._tNFrames, 3);
towner[numtowners]._tAnimFrame = random_(0, 11) + 1; towner[numtowners]._tAnimFrame = random_(0, 11) + 1;
towner[numtowners]._tSelFlag = 1; towner[numtowners]._tSelFlag = TRUE;
strcpy(towner[numtowners]._tName, "Cow"); strcpy(towner[numtowners]._tName, "Cow");
xo = x + cowoffx[dir]; xo = x + cowoffx[dir];
yo = y + cowoffy[dir]; yo = y + cowoffy[dir];
if (!dMonster[x][yo]) if (dMonster[x][yo] == 0)
dMonster[x][yo] = -(numtowners + 1); dMonster[x][yo] = -(numtowners + 1);
if (!dMonster[xo][y]) if (dMonster[xo][y] == 0)
dMonster[xo][y] = -(numtowners + 1); dMonster[xo][y] = -(numtowners + 1);
if (!dMonster[xo][yo]) if (dMonster[xo][yo] == 0)
dMonster[xo][yo] = -(numtowners + 1); dMonster[xo][yo] = -(numtowners + 1);
numtowners++; numtowners++;
@ -379,7 +379,7 @@ void InitTowners()
boyloadflag = FALSE; boyloadflag = FALSE;
InitSmith(); InitSmith();
InitHealer(); InitHealer();
if (quests[Q_BUTCHER]._qactive && quests[Q_BUTCHER]._qactive != QUEST_DONE) if (quests[Q_BUTCHER]._qactive != QUEST_NOTAVAIL && quests[Q_BUTCHER]._qactive != QUEST_DONE)
InitTownDead(); InitTownDead();
InitBarOwner(); InitBarOwner();
InitTeller(); InitTeller();
@ -394,7 +394,7 @@ void FreeTownerGFX()
{ {
int i; int i;
for (i = 0; i < 16; i++) { for (i = 0; i < NUM_TOWNERS; i++) {
if (towner[i]._tNData == pCowCels) { if (towner[i]._tNData == pCowCels) {
towner[i]._tNData = NULL; towner[i]._tNData = NULL;
} else if (towner[i]._tNData) { } else if (towner[i]._tNData) {
@ -410,7 +410,7 @@ void TownCtrlMsg(int i)
int p; int p;
int dx, dy; int dx, dy;
if (towner[i]._tbtcnt) { if (towner[i]._tbtcnt != 0) {
p = towner[i]._tVar1; p = towner[i]._tVar1;
dx = abs(towner[i]._tx - plr[p]._px); dx = abs(towner[i]._tx - plr[p]._px);
dy = abs(towner[i]._ty - plr[p]._py); dy = abs(towner[i]._ty - plr[p]._py);
@ -519,7 +519,7 @@ void ProcessTowners()
{ {
int i, ao; int i, ao;
for (i = 0; i < 16; i++) { for (i = 0; i < NUM_TOWNERS; i++) {
switch (towner[i]._ttype) { switch (towner[i]._ttype) {
case TOWN_SMITH: case TOWN_SMITH:
TownBlackSmith(); TownBlackSmith();
@ -787,13 +787,13 @@ void TalkToTowner(int p, int t)
RemoveInvItem(p, i); RemoveInvItem(p, i);
quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE; quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE;
quests[Q_MUSHROOM]._qlog = TRUE; quests[Q_MUSHROOM]._qlog = TRUE;
quests[Q_MUSHROOM]._qvar1 = 2; quests[Q_MUSHROOM]._qvar1 = QS_TOMEGIVEN;
towner[t]._tbtcnt = 150; towner[t]._tbtcnt = 150;
towner[t]._tVar1 = p; towner[t]._tVar1 = p;
InitQTextMsg(TEXT_MUSH8); InitQTextMsg(TEXT_MUSH8);
towner[t]._tMsgSaid = TRUE; towner[t]._tMsgSaid = TRUE;
} else if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) { } else if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
if (quests[Q_MUSHROOM]._qvar1 >= 2 && quests[Q_MUSHROOM]._qvar1 <= 4) { if (quests[Q_MUSHROOM]._qvar1 >= QS_TOMEGIVEN && quests[Q_MUSHROOM]._qvar1 <= QS_MUSHPICKED) {
if (PlrHasItem(p, IDI_MUSHROOM, i) != NULL) { if (PlrHasItem(p, IDI_MUSHROOM, i) != NULL) {
RemoveInvItem(p, i); RemoveInvItem(p, i);
quests[Q_MUSHROOM]._qvar1 = 5; quests[Q_MUSHROOM]._qvar1 = 5;
@ -874,7 +874,7 @@ void TalkToTowner(int p, int t)
RemoveInvItem(p, i); RemoveInvItem(p, i);
SpawnQuestItem(IDI_SPECELIX, towner[t]._tx, towner[t]._ty + 1, 0, 0); SpawnQuestItem(IDI_SPECELIX, towner[t]._tx, towner[t]._ty + 1, 0, 0);
InitQTextMsg(TEXT_MUSH4); InitQTextMsg(TEXT_MUSH4);
quests[Q_MUSHROOM]._qvar1 = 7; quests[Q_MUSHROOM]._qvar1 = QS_BRAINGIVEN;
Qtalklist[TOWN_HEALER]._qblkm = -1; Qtalklist[TOWN_HEALER]._qblkm = -1;
} }
} }

2
Source/towners.h

@ -2,7 +2,7 @@
#ifndef __TOWNERS_H__ #ifndef __TOWNERS_H__
#define __TOWNERS_H__ #define __TOWNERS_H__
extern TownerStruct towner[16]; extern TownerStruct towner[NUM_TOWNERS];
int GetActiveTowner(int t); int GetActiveTowner(int t);
void SetTownerGPtrs(BYTE *pData, BYTE **pAnim); void SetTownerGPtrs(BYTE *pData, BYTE **pAnim);

2
Source/track.cpp

@ -34,7 +34,7 @@ void track_repeat_walk(BOOL rep)
sgbIsWalking = rep; sgbIsWalking = rep;
if (rep) { if (rep) {
sgbIsScrolling = 0; sgbIsScrolling = FALSE;
sgdwLastWalk = GetTickCount() - 50; sgdwLastWalk = GetTickCount() - 50;
NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy); NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy);
} else if (sgbIsScrolling) { } else if (sgbIsScrolling) {

48
Source/trigs.cpp

@ -33,30 +33,34 @@ void InitTownTriggers()
{ {
int i; int i;
trigs[0]._tx = 25; numtrigs = 0;
trigs[0]._ty = 29;
trigs[0]._tmsg = WM_DIABNEXTLVL; trigs[numtrigs]._tx = 25;
trigs[numtrigs]._ty = 29;
trigs[numtrigs]._tmsg = WM_DIABNEXTLVL;
numtrigs++;
numtrigs = 1;
#ifndef SPAWN #ifndef SPAWN
if (gbMaxPlayers == MAX_PLRS) { if (gbMaxPlayers == MAX_PLRS) {
for (i = 0; i < sizeof(townwarps) / sizeof(townwarps[0]); i++) { for (i = 0; i < sizeof(townwarps) / sizeof(townwarps[0]); i++) {
townwarps[i] = TRUE; townwarps[i] = TRUE;
} }
trigs[1]._tx = 49; trigs[numtrigs]._tx = 49;
trigs[1]._ty = 21; trigs[numtrigs]._ty = 21;
trigs[1]._tmsg = WM_DIABTOWNWARP; trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[1]._tlvl = 5; trigs[numtrigs]._tlvl = 5;
trigs[2]._tx = 17; numtrigs++;
trigs[2]._ty = 69; trigs[numtrigs]._tx = 17;
trigs[2]._tmsg = WM_DIABTOWNWARP; trigs[numtrigs]._ty = 69;
trigs[2]._tlvl = 9; trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[3]._tx = 41; trigs[numtrigs]._tlvl = 9;
trigs[3]._ty = 80; numtrigs++;
trigs[3]._tmsg = WM_DIABTOWNWARP; trigs[numtrigs]._tx = 41;
trigs[3]._tlvl = 13; trigs[numtrigs]._ty = 80;
numtrigs = 4; trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[numtrigs]._tlvl = 13;
numtrigs++;
} else { } else {
#endif #endif
for (i = 0; i < MAX_PLRS - 1; i++) { for (i = 0; i < MAX_PLRS - 1; i++) {
@ -64,11 +68,11 @@ void InitTownTriggers()
} }
#ifndef SPAWN #ifndef SPAWN
if (plr[myplr].pTownWarps & 1) { if (plr[myplr].pTownWarps & 1) {
trigs[1]._tx = 49; trigs[numtrigs]._tx = 49;
trigs[1]._ty = 21; trigs[numtrigs]._ty = 21;
trigs[1]._tmsg = WM_DIABTOWNWARP; trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[1]._tlvl = 5; trigs[numtrigs]._tlvl = 5;
numtrigs = 2; numtrigs++;
townwarps[0] = TRUE; townwarps[0] = TRUE;
} }
if (plr[myplr].pTownWarps & 2) { if (plr[myplr].pTownWarps & 2) {

2
defs.h

@ -56,6 +56,8 @@
#define VOLUME_MIN -1600 #define VOLUME_MIN -1600
#define VOLUME_MAX 0 #define VOLUME_MAX 0
#define NUM_TOWNERS 16
// todo: enums // todo: enums
#define NUMLEVELS 17 #define NUMLEVELS 17
#define SMITH_ITEMS 20 #define SMITH_ITEMS 20

Loading…
Cancel
Save