Skip to content

Commit

Permalink
More cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
AJenbo committed Apr 26, 2020
1 parent b0a8a38 commit 7e45f8b
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 60 deletions.
8 changes: 4 additions & 4 deletions Source/mainmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

int __stdcall mainmenu_select_hero_dialog(
BOOL __stdcall mainmenu_select_hero_dialog(
const _SNETPROGRAMDATA *client_info,
const _SNETPLAYERDATA *user_info,
const _SNETUIDATA *ui_info,
Expand Down Expand Up @@ -72,7 +72,7 @@ int __stdcall mainmenu_select_hero_dialog(
}
if (dlgresult == SELHERO_PREVIOUS) {
SErrSetLastError(1223);
return 0;
return FALSE;
}

pfile_create_player_description(cdesc, cdlen);
Expand All @@ -85,7 +85,7 @@ int __stdcall mainmenu_select_hero_dialog(
if (cname && clen)
SStrCopy(cname, gszHero, clen);

return 1;
return TRUE;
}

void mainmenu_loop()
Expand Down Expand Up @@ -126,7 +126,7 @@ void mainmenu_loop()
done = TRUE;
break;
}
} while (done == FALSE);
} while (!done);

music_stop();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/mainmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern char gszHero[16];

void mainmenu_refresh_music();
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 _SNETPLAYERDATA *user_info,
const _SNETUIDATA *ui_info,
Expand Down
2 changes: 1 addition & 1 deletion Source/portal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void RemovePortalMissile(int id)
dFlags[missile[mi]._mix][missile[mi]._miy] &= ~BFLAG_MISSILE;
dMissile[missile[mi]._mix][missile[mi]._miy] = 0;

if (portal[id].level)
if (portal[id].level != 0)
AddUnLight(missile[mi]._mlid);

DeleteMissile(mi, i);
Expand Down
8 changes: 4 additions & 4 deletions Source/themes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@ BOOL bCrossFlag;

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
};

int trm5y[25] = {
int trm5y[] = {
-2, -2, -2, -2, -2,
-1, -1, -1, -1, -1,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
2, 2, 2, 2, 2
};

int trm3x[9] = {
int trm3x[] = {
-1, 0, 1,
-1, 0, 1,
-1, 0, 1
};

int trm3y[9] = {
int trm3y[] = {
-1, -1, -1,
0, 0, 0,
1, 1, 1
Expand Down
52 changes: 26 additions & 26 deletions Source/towners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ DWORD sgdwCowClicks;
BOOL bannerflag;
BOOL boyloadflag;
BYTE *pCowCels;
TownerStruct towner[16];
TownerStruct towner[NUM_TOWNERS];

#ifndef SPAWN
const int snSFX[3][NUM_CLASSES] = {
{ PS_WARR52, PS_ROGUE52, PS_MAGE52 },
{ PS_WARR49, PS_ROGUE49, PS_MAGE49 },
{ PS_WARR50, PS_ROGUE50, PS_MAGE50 }
{ PS_WARR50, PS_ROGUE50, PS_MAGE50 },
};
#endif

Expand Down Expand Up @@ -86,9 +86,9 @@ char AnimOrder[6][148] = {
1, 2, 1, 19, 18, 19, 1, 2, 1, 2,
3, -1 }
};
int TownCowX[3] = { 58, 56, 59 };
int TownCowY[3] = { 16, 14, 20 };
int TownCowDir[3] = { 1, 3, 4 };
int TownCowX[] = { 58, 56, 59 };
int TownCowY[] = { 16, 14, 20 };
int TownCowDir[] = { DIR_SW, DIR_NW, DIR_N };
int cowoffx[8] = { -1, 0, -1, -1, -1, 0, -1, -1 };
int cowoffy[8] = { -1, -1, -1, 0, -1, -1, -1, 0 };
QuestTalkData Qtalklist[] = {
Expand Down Expand Up @@ -197,7 +197,7 @@ void InitSmith()
{
int i;

InitTownerInfo(numtowners, 96, 1, TOWN_SMITH, 62, 63, 0, 10);
InitTownerInfo(numtowners, 96, TRUE, TOWN_SMITH, 62, 63, 0, 10);
InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Smith\\SmithN.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -214,7 +214,7 @@ void InitBarOwner()
int i;

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);
towner[numtowners]._tNData = LoadFileInMem("Towners\\TwnF\\TwnFN.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -230,7 +230,7 @@ void InitTownDead()
{
int i;

InitTownerInfo(numtowners, 96, 1, TOWN_DEADGUY, 24, 32, -1, 10);
InitTownerInfo(numtowners, 96, TRUE, TOWN_DEADGUY, 24, 32, -1, 10);
InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Butch\\Deadguy.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -246,7 +246,7 @@ void InitWitch()
{
int i;

InitTownerInfo(numtowners, 96, 1, TOWN_WITCH, 80, 20, 5, 10);
InitTownerInfo(numtowners, 96, TRUE, TOWN_WITCH, 80, 20, 5, 10);
InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\Witch.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -262,7 +262,7 @@ void InitBarmaid()
{
int i;

InitTownerInfo(numtowners, 96, 1, TOWN_BMAID, 43, 66, -1, 10);
InitTownerInfo(numtowners, 96, TRUE, TOWN_BMAID, 43, 66, -1, 10);
InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\WmnN.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -279,7 +279,7 @@ void InitBoy()
int i;

boyloadflag = TRUE;
InitTownerInfo(numtowners, 96, 1, TOWN_PEGBOY, 11, 53, -1, 10);
InitTownerInfo(numtowners, 96, TRUE, TOWN_PEGBOY, 11, 53, -1, 10);
InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\TownBoy\\PegKid1.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -295,7 +295,7 @@ void InitHealer()
{
int i;

InitTownerInfo(numtowners, 96, 1, TOWN_HEALER, 55, 79, 1, 10);
InitTownerInfo(numtowners, 96, TRUE, TOWN_HEALER, 55, 79, 1, 10);
InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Healer\\Healer.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -311,7 +311,7 @@ void InitTeller()
{
int i;

InitTownerInfo(numtowners, 96, 1, TOWN_STORY, 62, 71, 2, 10);
InitTownerInfo(numtowners, 96, TRUE, TOWN_STORY, 62, 71, 2, 10);
InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Strytell\\Strytell.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -327,7 +327,7 @@ void InitDrunk()
{
int i;

InitTownerInfo(numtowners, 96, 1, TOWN_DRUNK, 71, 84, 4, 10);
InitTownerInfo(numtowners, 96, TRUE, TOWN_DRUNK, 71, 84, 4, 10);
InitQstSnds(numtowners);
towner[numtowners]._tNData = LoadFileInMem("Towners\\Drunk\\TwnDrunk.CEL", NULL);
for (i = 0; i < 8; i++) {
Expand All @@ -351,22 +351,22 @@ void InitCows()
x = TownCowX[i];
y = TownCowY[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;
SetTownerGPtrs(towner[numtowners]._tNData, towner[numtowners]._tNAnim);
towner[numtowners]._tNFrames = 12;
NewTownerAnim(numtowners, towner[numtowners]._tNAnim[dir], towner[numtowners]._tNFrames, 3);
towner[numtowners]._tAnimFrame = random_(0, 11) + 1;
towner[numtowners]._tSelFlag = 1;
towner[numtowners]._tSelFlag = TRUE;
strcpy(towner[numtowners]._tName, "Cow");

xo = x + cowoffx[dir];
yo = y + cowoffy[dir];
if (!dMonster[x][yo])
if (dMonster[x][yo] == 0)
dMonster[x][yo] = -(numtowners + 1);
if (!dMonster[xo][y])
if (dMonster[xo][y] == 0)
dMonster[xo][y] = -(numtowners + 1);
if (!dMonster[xo][yo])
if (dMonster[xo][yo] == 0)
dMonster[xo][yo] = -(numtowners + 1);

numtowners++;
Expand All @@ -379,7 +379,7 @@ void InitTowners()
boyloadflag = FALSE;
InitSmith();
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();
InitBarOwner();
InitTeller();
Expand All @@ -394,7 +394,7 @@ void FreeTownerGFX()
{
int i;

for (i = 0; i < 16; i++) {
for (i = 0; i < NUM_TOWNERS; i++) {
if (towner[i]._tNData == pCowCels) {
towner[i]._tNData = NULL;
} else if (towner[i]._tNData) {
Expand All @@ -410,7 +410,7 @@ void TownCtrlMsg(int i)
int p;
int dx, dy;

if (towner[i]._tbtcnt) {
if (towner[i]._tbtcnt != 0) {
p = towner[i]._tVar1;
dx = abs(towner[i]._tx - plr[p]._px);
dy = abs(towner[i]._ty - plr[p]._py);
Expand Down Expand Up @@ -519,7 +519,7 @@ void ProcessTowners()
{
int i, ao;

for (i = 0; i < 16; i++) {
for (i = 0; i < NUM_TOWNERS; i++) {
switch (towner[i]._ttype) {
case TOWN_SMITH:
TownBlackSmith();
Expand Down Expand Up @@ -787,13 +787,13 @@ void TalkToTowner(int p, int t)
RemoveInvItem(p, i);
quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE;
quests[Q_MUSHROOM]._qlog = TRUE;
quests[Q_MUSHROOM]._qvar1 = 2;
quests[Q_MUSHROOM]._qvar1 = QS_TOMEGIVEN;
towner[t]._tbtcnt = 150;
towner[t]._tVar1 = p;
InitQTextMsg(TEXT_MUSH8);
towner[t]._tMsgSaid = TRUE;
} 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) {
RemoveInvItem(p, i);
quests[Q_MUSHROOM]._qvar1 = 5;
Expand Down Expand Up @@ -874,7 +874,7 @@ void TalkToTowner(int p, int t)
RemoveInvItem(p, i);
SpawnQuestItem(IDI_SPECELIX, towner[t]._tx, towner[t]._ty + 1, 0, 0);
InitQTextMsg(TEXT_MUSH4);
quests[Q_MUSHROOM]._qvar1 = 7;
quests[Q_MUSHROOM]._qvar1 = QS_BRAINGIVEN;
Qtalklist[TOWN_HEALER]._qblkm = -1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/towners.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef __TOWNERS_H__
#define __TOWNERS_H__

extern TownerStruct towner[16];
extern TownerStruct towner[NUM_TOWNERS];

int GetActiveTowner(int t);
void SetTownerGPtrs(BYTE *pData, BYTE **pAnim);
Expand Down
2 changes: 1 addition & 1 deletion Source/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void track_repeat_walk(BOOL rep)

sgbIsWalking = rep;
if (rep) {
sgbIsScrolling = 0;
sgbIsScrolling = FALSE;
sgdwLastWalk = GetTickCount() - 50;
NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy);
} else if (sgbIsScrolling) {
Expand Down
48 changes: 26 additions & 22 deletions Source/trigs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,46 @@ void InitTownTriggers()
{
int i;

trigs[0]._tx = 25;
trigs[0]._ty = 29;
trigs[0]._tmsg = WM_DIABNEXTLVL;
numtrigs = 0;

trigs[numtrigs]._tx = 25;
trigs[numtrigs]._ty = 29;
trigs[numtrigs]._tmsg = WM_DIABNEXTLVL;
numtrigs++;

numtrigs = 1;

#ifndef SPAWN
if (gbMaxPlayers == MAX_PLRS) {
for (i = 0; i < sizeof(townwarps) / sizeof(townwarps[0]); i++) {
townwarps[i] = TRUE;
}
trigs[1]._tx = 49;
trigs[1]._ty = 21;
trigs[1]._tmsg = WM_DIABTOWNWARP;
trigs[1]._tlvl = 5;
trigs[2]._tx = 17;
trigs[2]._ty = 69;
trigs[2]._tmsg = WM_DIABTOWNWARP;
trigs[2]._tlvl = 9;
trigs[3]._tx = 41;
trigs[3]._ty = 80;
trigs[3]._tmsg = WM_DIABTOWNWARP;
trigs[3]._tlvl = 13;
numtrigs = 4;
trigs[numtrigs]._tx = 49;
trigs[numtrigs]._ty = 21;
trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[numtrigs]._tlvl = 5;
numtrigs++;
trigs[numtrigs]._tx = 17;
trigs[numtrigs]._ty = 69;
trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[numtrigs]._tlvl = 9;
numtrigs++;
trigs[numtrigs]._tx = 41;
trigs[numtrigs]._ty = 80;
trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[numtrigs]._tlvl = 13;
numtrigs++;
} else {
#endif
for (i = 0; i < MAX_PLRS - 1; i++) {
townwarps[i] = FALSE;
}
#ifndef SPAWN
if (plr[myplr].pTownWarps & 1) {
trigs[1]._tx = 49;
trigs[1]._ty = 21;
trigs[1]._tmsg = WM_DIABTOWNWARP;
trigs[1]._tlvl = 5;
numtrigs = 2;
trigs[numtrigs]._tx = 49;
trigs[numtrigs]._ty = 21;
trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[numtrigs]._tlvl = 5;
numtrigs++;
townwarps[0] = TRUE;
}
if (plr[myplr].pTownWarps & 2) {
Expand Down
2 changes: 2 additions & 0 deletions defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
#define VOLUME_MIN -1600
#define VOLUME_MAX 0

#define NUM_TOWNERS 16

// todo: enums
#define NUMLEVELS 17
#define SMITH_ITEMS 20
Expand Down

0 comments on commit 7e45f8b

Please sign in to comment.