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);
}
int __stdcall mainmenu_select_hero_dialog(
BOOL __stdcall mainmenu_select_hero_dialog(
const _SNETPROGRAMDATA *client_info,
const _SNETPLAYERDATA *user_info,
const _SNETUIDATA *ui_info,
@ -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);
@ -85,7 +85,7 @@ int __stdcall mainmenu_select_hero_dialog(
if (cname && clen)
SStrCopy(cname, gszHero, clen);
return 1;
return TRUE;
}
void mainmenu_loop()
@ -126,7 +126,7 @@ void mainmenu_loop()
done = TRUE;
break;
}
} while (done == FALSE);
} while (!done);
music_stop();
}

2
Source/mainmenu.h

@ -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,

2
Source/portal.cpp

@ -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);

8
Source/themes.cpp

@ -24,7 +24,7 @@ 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,
@ -32,7 +32,7 @@ int trm5x[25] = {
-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,
@ -40,13 +40,13 @@ int trm5y[25] = {
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

52
Source/towners.cpp

@ -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
@ -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[] = {
@ -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++) {
@ -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++) {
@ -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++) {
@ -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++) {
@ -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++) {
@ -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++) {
@ -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++) {
@ -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++) {
@ -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++) {
@ -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++;
@ -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();
@ -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) {
@ -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);
@ -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();
@ -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;
@ -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;
}
}

2
Source/towners.h

@ -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);

2
Source/track.cpp

@ -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) {

48
Source/trigs.cpp

@ -33,30 +33,34 @@ 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++) {
@ -64,11 +68,11 @@ void InitTownTriggers()
}
#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) {

2
defs.h

@ -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

Loading…
Cancel
Save