From 7c071924adbf925a496cd8827eeb045ba2272e60 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 6 Jul 2019 05:13:01 +0200 Subject: [PATCH] Format recently cleaned code --- Source/drlg_l2.cpp | 1048 +++++++++++++++++++++---------------------- Source/drlg_l2.h | 244 +++++----- Source/drlg_l3.h | 2 +- Source/drlg_l4.cpp | 64 ++- Source/drlg_l4.h | 32 +- Source/dx.cpp | 28 +- Source/dx.h | 10 +- Source/gendung.cpp | 75 ++-- Source/gendung.h | 44 +- Source/gmenu.cpp | 4 +- Source/gmenu.h | 18 +- Source/init.cpp | 9 +- Source/inv.cpp | 20 +- Source/inv.h | 2 +- Source/items.cpp | 15 +- Source/items.h | 14 +- Source/logging.cpp | 15 +- Source/logging.h | 14 +- Source/minitext.cpp | 22 +- Source/minitext.h | 8 +- Source/missiles.cpp | 233 +++++----- Source/missiles.h | 6 +- Source/mpqapi.cpp | 4 +- Source/mpqapi.h | 4 +- Source/msg.cpp | 47 +- Source/multi.cpp | 21 +- Source/multi.h | 8 +- Source/quests.cpp | 84 ++-- Source/quests.h | 18 +- 29 files changed, 984 insertions(+), 1129 deletions(-) diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index ad4e00c08..6777ed5d6 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -1,134 +1,134 @@ #include "diablo.h" int nSx1; -int nSx2; // weak +int nSx2; int nSy1; -int nSy2; // weak +int nSy2; int nRoomCnt; -unsigned char predungeon[DMAXX][DMAXX]; +BYTE predungeon[DMAXX][DMAXY]; ROOMNODE RoomList[81]; HALLNODE *pHallList; -int Area_Min = 2; // weak -int Room_Max = 10; // weak -int Room_Min = 4; // weak +int Area_Min = 2; +int Room_Max = 10; +int Room_Min = 4; int Dir_Xadd[5] = { 0, 0, 1, 0, -1 }; int Dir_Yadd[5] = { 0, -1, 0, 1, 0 }; ShadowStruct SPATSL2[2] = { { 6u, 3u, 0u, 3u, 48u, 0u, 50u }, { 9u, 3u, 0u, 3u, 48u, 0u, 50u } }; //short word_48489A = 0; // weak -unsigned char BTYPESL2[161] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char BSTYPESL2[161] = { 0, 1, 2, 3, 0, 0, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 6, 2, 2, 2, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char VARCH1[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH2[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH3[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH4[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH5[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH6[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH7[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH8[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH9[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 7, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH10[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 8, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH11[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 6, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH12[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 9, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH13[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 14, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH14[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 13, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH15[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 16, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH16[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 15, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH17[] = { 2, 3, 2, 7, 3, 4, 0, 7, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH18[] = { 2, 3, 2, 7, 3, 4, 0, 8, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH19[] = { 2, 3, 2, 7, 3, 4, 0, 6, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH20[] = { 2, 3, 2, 7, 3, 4, 0, 9, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH21[] = { 2, 3, 2, 7, 3, 4, 0, 14, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH22[] = { 2, 3, 2, 7, 3, 4, 0, 13, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH23[] = { 2, 3, 2, 7, 3, 4, 0, 16, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH24[] = { 2, 3, 2, 7, 3, 4, 0, 15, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH25[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH26[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH27[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH28[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH29[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH30[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH31[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH32[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH33[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 7, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH34[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 8, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH35[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 6, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH36[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 9, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH37[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 14, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH38[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 13, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH39[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 16, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH40[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 15, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char HARCH1[] = { 3, 2, 3, 3, 0, 2, 5, 9, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH2[] = { 3, 2, 3, 3, 0, 2, 5, 6, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH3[] = { 3, 2, 3, 3, 0, 2, 5, 8, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH4[] = { 3, 2, 3, 3, 0, 2, 5, 7, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH5[] = { 3, 2, 3, 3, 0, 2, 5, 15, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH6[] = { 3, 2, 3, 3, 0, 2, 5, 16, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH7[] = { 3, 2, 3, 3, 0, 2, 5, 13, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH8[] = { 3, 2, 3, 3, 0, 2, 5, 14, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH9[] = { 3, 2, 3, 3, 0, 8, 5, 9, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH10[] = { 3, 2, 3, 3, 0, 8, 5, 6, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH11[] = { 3, 2, 3, 3, 0, 8, 5, 8, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH12[] = { 3, 2, 3, 3, 0, 8, 5, 7, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH13[] = { 3, 2, 3, 3, 0, 8, 5, 15, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH14[] = { 3, 2, 3, 3, 0, 8, 5, 16, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH15[] = { 3, 2, 3, 3, 0, 8, 5, 13, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH16[] = { 3, 2, 3, 3, 0, 8, 5, 14, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH17[] = { 3, 2, 1, 3, 0, 8, 5, 9, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH18[] = { 3, 2, 1, 3, 0, 8, 5, 6, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH19[] = { 3, 2, 1, 3, 0, 8, 5, 8, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH20[] = { 3, 2, 1, 3, 0, 8, 5, 7, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH21[] = { 3, 2, 1, 3, 0, 8, 5, 15, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH22[] = { 3, 2, 1, 3, 0, 8, 5, 16, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH23[] = { 3, 2, 1, 3, 0, 8, 5, 13, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH24[] = { 3, 2, 1, 3, 0, 8, 5, 14, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH25[] = { 3, 2, 3, 3, 0, 5, 2, 9, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH26[] = { 3, 2, 3, 3, 0, 5, 2, 6, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH27[] = { 3, 2, 3, 3, 0, 5, 2, 8, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH28[] = { 3, 2, 3, 3, 0, 5, 2, 7, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH29[] = { 3, 2, 3, 3, 0, 5, 2, 15, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH30[] = { 3, 2, 3, 3, 0, 5, 2, 16, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH31[] = { 3, 2, 3, 3, 0, 5, 2, 13, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH32[] = { 3, 2, 3, 3, 0, 5, 2, 14, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH33[] = { 3, 2, 1, 3, 0, 9, 5, 9, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH34[] = { 3, 2, 1, 3, 0, 9, 5, 6, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH35[] = { 3, 2, 1, 3, 0, 9, 5, 8, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH36[] = { 3, 2, 1, 3, 0, 9, 5, 7, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH37[] = { 3, 2, 1, 3, 0, 9, 5, 15, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH38[] = { 3, 2, 1, 3, 0, 9, 5, 16, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH39[] = { 3, 2, 1, 3, 0, 9, 5, 13, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH40[] = { 3, 2, 1, 3, 0, 9, 5, 14, 140, 46, 0, 40, 45, 0 }; -unsigned char USTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 72, 77, 0, 0, 76, 0, 0, 0, 0, 0, 0 }; -unsigned char DSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 48, 71, 0, 0, 50, 78, 0, 0, 0, 0, 0 }; -unsigned char WARPSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 158, 160, 0, 0, 159, 0, 0, 0, 0, 0, 0 }; -unsigned char CRUSHCOL[] = { 3, 3, 3, 1, 3, 2, 6, 3, 3, 3, 3, 0, 0, 0, 0, 83, 0, 0, 0, 0 }; -unsigned char BIG1[] = { 2, 2, 3, 3, 3, 3, 113, 0, 112, 0 }; -unsigned char BIG2[] = { 2, 2, 3, 3, 3, 3, 114, 115, 0, 0 }; -unsigned char BIG3[] = { 1, 2, 1, 1, 117, 116 }; -unsigned char BIG4[] = { 2, 1, 2, 2, 118, 119 }; -unsigned char BIG5[] = { 2, 2, 3, 3, 3, 3, 120, 122, 121, 123 }; -unsigned char BIG6[] = { 1, 2, 1, 1, 125, 124 }; -unsigned char BIG7[] = { 2, 1, 2, 2, 126, 127 }; -unsigned char BIG8[] = { 2, 2, 3, 3, 3, 3, 128, 130, 129, 131 }; -unsigned char BIG9[] = { 2, 2, 1, 3, 1, 3, 133, 135, 132, 134 }; -unsigned char BIG10[] = { 2, 2, 2, 2, 3, 3, 136, 137, 3, 3 }; -unsigned char RUINS1[] = { 1, 1, 1, 80 }; -unsigned char RUINS2[] = { 1, 1, 1, 81 }; -unsigned char RUINS3[] = { 1, 1, 1, 82 }; -unsigned char RUINS4[] = { 1, 1, 2, 84 }; -unsigned char RUINS5[] = { 1, 1, 2, 85 }; -unsigned char RUINS6[] = { 1, 1, 2, 86 }; -unsigned char RUINS7[] = { 1, 1, 8, 87 }; -unsigned char PANCREAS1[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char PANCREAS2[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char CTRDOOR1[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 9, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR2[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 8, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR3[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 6, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR4[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 7, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR5[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 15, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR6[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 13, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR7[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 16, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR8[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 14, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE BTYPESL2[161] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +BYTE BSTYPESL2[161] = { 0, 1, 2, 3, 0, 0, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 6, 2, 2, 2, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +BYTE VARCH1[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH2[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH3[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH4[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH5[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH6[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH7[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH8[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH9[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 7, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH10[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 8, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH11[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 6, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH12[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 9, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH13[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 14, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH14[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 13, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH15[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 16, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH16[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 15, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH17[] = { 2, 3, 2, 7, 3, 4, 0, 7, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH18[] = { 2, 3, 2, 7, 3, 4, 0, 8, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH19[] = { 2, 3, 2, 7, 3, 4, 0, 6, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH20[] = { 2, 3, 2, 7, 3, 4, 0, 9, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH21[] = { 2, 3, 2, 7, 3, 4, 0, 14, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH22[] = { 2, 3, 2, 7, 3, 4, 0, 13, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH23[] = { 2, 3, 2, 7, 3, 4, 0, 16, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH24[] = { 2, 3, 2, 7, 3, 4, 0, 15, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH25[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH26[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH27[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH28[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH29[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH30[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH31[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH32[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH33[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 7, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH34[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 8, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH35[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 6, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH36[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 9, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH37[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 14, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH38[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 13, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH39[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 16, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH40[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 15, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE HARCH1[] = { 3, 2, 3, 3, 0, 2, 5, 9, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH2[] = { 3, 2, 3, 3, 0, 2, 5, 6, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH3[] = { 3, 2, 3, 3, 0, 2, 5, 8, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH4[] = { 3, 2, 3, 3, 0, 2, 5, 7, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH5[] = { 3, 2, 3, 3, 0, 2, 5, 15, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH6[] = { 3, 2, 3, 3, 0, 2, 5, 16, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH7[] = { 3, 2, 3, 3, 0, 2, 5, 13, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH8[] = { 3, 2, 3, 3, 0, 2, 5, 14, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH9[] = { 3, 2, 3, 3, 0, 8, 5, 9, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH10[] = { 3, 2, 3, 3, 0, 8, 5, 6, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH11[] = { 3, 2, 3, 3, 0, 8, 5, 8, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH12[] = { 3, 2, 3, 3, 0, 8, 5, 7, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH13[] = { 3, 2, 3, 3, 0, 8, 5, 15, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH14[] = { 3, 2, 3, 3, 0, 8, 5, 16, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH15[] = { 3, 2, 3, 3, 0, 8, 5, 13, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH16[] = { 3, 2, 3, 3, 0, 8, 5, 14, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH17[] = { 3, 2, 1, 3, 0, 8, 5, 9, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH18[] = { 3, 2, 1, 3, 0, 8, 5, 6, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH19[] = { 3, 2, 1, 3, 0, 8, 5, 8, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH20[] = { 3, 2, 1, 3, 0, 8, 5, 7, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH21[] = { 3, 2, 1, 3, 0, 8, 5, 15, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH22[] = { 3, 2, 1, 3, 0, 8, 5, 16, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH23[] = { 3, 2, 1, 3, 0, 8, 5, 13, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH24[] = { 3, 2, 1, 3, 0, 8, 5, 14, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH25[] = { 3, 2, 3, 3, 0, 5, 2, 9, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH26[] = { 3, 2, 3, 3, 0, 5, 2, 6, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH27[] = { 3, 2, 3, 3, 0, 5, 2, 8, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH28[] = { 3, 2, 3, 3, 0, 5, 2, 7, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH29[] = { 3, 2, 3, 3, 0, 5, 2, 15, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH30[] = { 3, 2, 3, 3, 0, 5, 2, 16, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH31[] = { 3, 2, 3, 3, 0, 5, 2, 13, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH32[] = { 3, 2, 3, 3, 0, 5, 2, 14, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH33[] = { 3, 2, 1, 3, 0, 9, 5, 9, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH34[] = { 3, 2, 1, 3, 0, 9, 5, 6, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH35[] = { 3, 2, 1, 3, 0, 9, 5, 8, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH36[] = { 3, 2, 1, 3, 0, 9, 5, 7, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH37[] = { 3, 2, 1, 3, 0, 9, 5, 15, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH38[] = { 3, 2, 1, 3, 0, 9, 5, 16, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH39[] = { 3, 2, 1, 3, 0, 9, 5, 13, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH40[] = { 3, 2, 1, 3, 0, 9, 5, 14, 140, 46, 0, 40, 45, 0 }; +BYTE USTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 72, 77, 0, 0, 76, 0, 0, 0, 0, 0, 0 }; +BYTE DSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 48, 71, 0, 0, 50, 78, 0, 0, 0, 0, 0 }; +BYTE WARPSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 158, 160, 0, 0, 159, 0, 0, 0, 0, 0, 0 }; +BYTE CRUSHCOL[] = { 3, 3, 3, 1, 3, 2, 6, 3, 3, 3, 3, 0, 0, 0, 0, 83, 0, 0, 0, 0 }; +BYTE BIG1[] = { 2, 2, 3, 3, 3, 3, 113, 0, 112, 0 }; +BYTE BIG2[] = { 2, 2, 3, 3, 3, 3, 114, 115, 0, 0 }; +BYTE BIG3[] = { 1, 2, 1, 1, 117, 116 }; +BYTE BIG4[] = { 2, 1, 2, 2, 118, 119 }; +BYTE BIG5[] = { 2, 2, 3, 3, 3, 3, 120, 122, 121, 123 }; +BYTE BIG6[] = { 1, 2, 1, 1, 125, 124 }; +BYTE BIG7[] = { 2, 1, 2, 2, 126, 127 }; +BYTE BIG8[] = { 2, 2, 3, 3, 3, 3, 128, 130, 129, 131 }; +BYTE BIG9[] = { 2, 2, 1, 3, 1, 3, 133, 135, 132, 134 }; +BYTE BIG10[] = { 2, 2, 2, 2, 3, 3, 136, 137, 3, 3 }; +BYTE RUINS1[] = { 1, 1, 1, 80 }; +BYTE RUINS2[] = { 1, 1, 1, 81 }; +BYTE RUINS3[] = { 1, 1, 1, 82 }; +BYTE RUINS4[] = { 1, 1, 2, 84 }; +BYTE RUINS5[] = { 1, 1, 2, 85 }; +BYTE RUINS6[] = { 1, 1, 2, 86 }; +BYTE RUINS7[] = { 1, 1, 8, 87 }; +BYTE PANCREAS1[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 0 }; +BYTE PANCREAS2[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0 }; +BYTE CTRDOOR1[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 9, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR2[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 8, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR3[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 6, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR4[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 7, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR5[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 15, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR6[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 13, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR7[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 16, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR8[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 14, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; int Patterns[100][10] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 }, { 0, 0, 0, 0, 2, 0, 0, 0, 0, 3 }, @@ -236,8 +236,8 @@ void InitDungeon() { int i, j; - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { predungeon[i][j] = 32; dflags[i][j] = 0; } @@ -249,61 +249,61 @@ void L2LockoutFix() int i, j; BOOL doorok; - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { - if(dungeon[i][j] == 4 && dungeon[i - 1][j] != 3) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] == 4 && dungeon[i - 1][j] != 3) { dungeon[i][j] = 1; } - if(dungeon[i][j] == 5 && dungeon[i][j - 1] != 3) { + if (dungeon[i][j] == 5 && dungeon[i][j - 1] != 3) { dungeon[i][j] = 2; } } } - for(j = 1; j < DMAXY - 1; j++) { - for(i = 1; i < DMAXX - 1; i++) { - if(dflags[i][j] & 0x80) { + for (j = 1; j < DMAXY - 1; j++) { + for (i = 1; i < DMAXX - 1; i++) { + if (dflags[i][j] & 0x80) { continue; } - if((dungeon[i][j] == 2 || dungeon[i][j] == 5) && dungeon[i][j - 1] == 3 && dungeon[i][j + 1] == 3) { + if ((dungeon[i][j] == 2 || dungeon[i][j] == 5) && dungeon[i][j - 1] == 3 && dungeon[i][j + 1] == 3) { doorok = FALSE; - while(1) { - if(dungeon[i][j] != 2 && dungeon[i][j] != 5) { + while (1) { + if (dungeon[i][j] != 2 && dungeon[i][j] != 5) { break; } - if(dungeon[i][j - 1] != 3 || dungeon[i][j + 1] != 3) { + if (dungeon[i][j - 1] != 3 || dungeon[i][j + 1] != 3) { break; } - if(dungeon[i][j] == 5) { + if (dungeon[i][j] == 5) { doorok = TRUE; } i++; } - if(!doorok && !(dflags[i - 1][j] & 0x80)) { + if (!doorok && !(dflags[i - 1][j] & 0x80)) { dungeon[i - 1][j] = 5; } } } } - for(j = 1; j < DMAXX - 1; j++) { /* check: might be flipped */ - for(i = 1; i < DMAXY - 1; i++) { - if(dflags[j][i] & 0x80) { + for (j = 1; j < DMAXX - 1; j++) { /* check: might be flipped */ + for (i = 1; i < DMAXY - 1; i++) { + if (dflags[j][i] & 0x80) { continue; } - if((dungeon[j][i] == 1 || dungeon[j][i] == 4) && dungeon[j - 1][i] == 3 && dungeon[j + 1][i] == 3) { + if ((dungeon[j][i] == 1 || dungeon[j][i] == 4) && dungeon[j - 1][i] == 3 && dungeon[j + 1][i] == 3) { doorok = FALSE; - while(1) { - if(dungeon[j][i] != 1 && dungeon[j][i] != 4) { + while (1) { + if (dungeon[j][i] != 1 && dungeon[j][i] != 4) { break; } - if(dungeon[j - 1][i] != 3 || dungeon[j + 1][i] != 3) { + if (dungeon[j - 1][i] != 3 || dungeon[j + 1][i] != 3) { break; } - if(dungeon[j][i] == 4) { + if (dungeon[j][i] == 4) { doorok = TRUE; } i++; } - if(!doorok && !(dflags[j][i - 1] & 0x80)) { + if (!doorok && !(dflags[j][i - 1] & 0x80)) { dungeon[j][i - 1] = 4; } } @@ -315,12 +315,12 @@ void L2DoorFix() { int i, j; - for(j = 1; j < 40; j++) { - for(i = 1; i < 40; i++) { - if(dungeon[i][j] == 4 && dungeon[i][j - 1] == 3) { + for (j = 1; j < 40; j++) { + for (i = 1; i < 40; i++) { + if (dungeon[i][j] == 4 && dungeon[i][j - 1] == 3) { dungeon[i][j] = 7; } - if(dungeon[i][j] == 5 && dungeon[i - 1][j] == 3) { + if (dungeon[i][j] == 5 && dungeon[i - 1][j] == 3) { dungeon[i][j] = 9; } } @@ -551,16 +551,16 @@ void LoadPreL2Dungeon(char *sFileName, int vx, int vy) mem_free_dbg(pLevelMap); } -void CreateL2Dungeon(unsigned int rseed, int entry) +void CreateL2Dungeon(int rseed, int entry) { - if(gbMaxPlayers == 1) { - if(currlevel == 7 && !quests[8]._qactive) { + if (gbMaxPlayers == 1) { + if (currlevel == 7 && !quests[8]._qactive) { currlevel = 6; CreateL2Dungeon(glSeedTbl[6], 4); currlevel = 7; } - if(currlevel == 8) { - if(!quests[8]._qactive) { + if (currlevel == 8) { + if (!quests[8]._qactive) { currlevel = 6; CreateL2Dungeon(glSeedTbl[6], 4); currlevel = 8; @@ -568,7 +568,6 @@ void CreateL2Dungeon(unsigned int rseed, int entry) currlevel = 7; CreateL2Dungeon(glSeedTbl[7], 4); currlevel = 8; - } } } @@ -589,28 +588,22 @@ void CreateL2Dungeon(unsigned int rseed, int entry) DRLG_InitL2Vals(); DRLG_SetPC(); } -// 5CF328: using guessed type int dmaxx; -// 5CF32C: using guessed type int dmaxy; -// 5D2458: using guessed type int dminx; -// 5D245C: using guessed type int dminy; -// 679660: using guessed type char gbMaxPlayers; void DRLG_LoadL2SP() { setloadflag_2 = 0; - if(QuestStatus(QTYPE_BLIND)) { + if (QuestStatus(QTYPE_BLIND)) { pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Blind2.DUN", 0); setloadflag_2 = 1; - } else if(QuestStatus(QTYPE_BLOOD)) { + } else if (QuestStatus(QTYPE_BLOOD)) { pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Blood1.DUN", 0); setloadflag_2 = 1; - } else if(QuestStatus(QTYPE_BONE)) { + } else if (QuestStatus(QTYPE_BONE)) { pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Bonestr2.DUN", 0); setloadflag_2 = 1; } } -// 5B50D8: using guessed type int setloadflag_2; void DRLG_FreeL2SP() { @@ -623,42 +616,42 @@ void DRLG_L2(int entry) BOOL doneflag; doneflag = FALSE; - while(!doneflag) { + while (!doneflag) { nRoomCnt = 0; InitDungeon(); DRLG_InitTrans(); - if(!CreateDungeon()) { + if (!CreateDungeon()) { continue; } L2TileFix(); - if(setloadflag_2) { + if (setloadflag_2) { DRLG_L2SetRoom(nSx1, nSy1); } DRLG_L2FloodTVal(); DRLG_L2TransFix(); - if(entry == 0) { + if (entry == 0) { doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 1, 0); - if(doneflag) { + if (doneflag) { doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 0, 1); - if(doneflag && currlevel == 5) { + if (doneflag && currlevel == 5) { doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 0, 6); } } ViewY -= 2; - } else if(entry == 1) { + } else if (entry == 1) { doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag) { + if (doneflag) { doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 1, 1); - if(doneflag && currlevel == 5) { + if (doneflag && currlevel == 5) { doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 0, 6); } } ViewX--; } else { doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag) { + if (doneflag) { doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 0, 1); - if(doneflag && currlevel == 5) { + if (doneflag && currlevel == 5) { doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 1, 6); } } @@ -782,8 +775,8 @@ void DRLG_L2(int entry) DRLG_L2Subs(); DRLG_L2Shadows(); - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { pdungeon[i][j] = dungeon[i][j]; } } @@ -791,9 +784,8 @@ void DRLG_L2(int entry) DRLG_Init_Globals(); DRLG_CheckQuests(nSx1, nSy1); } -// 5B50D8: using guessed type int setloadflag_2; -BOOL DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) +BOOL DRLG_L2PlaceMiniSet(BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) { int sx, sy, sw, sh, xx, yy, i, ii, numt, bailcnt; BOOL found; @@ -801,61 +793,61 @@ BOOL DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tmax, int cx, int sw = miniset[0]; sh = miniset[1]; - if(tmax - tmin == 0) { + if (tmax - tmin == 0) { numt = 1; } else { numt = random(0, tmax - tmin) + tmin; } - for(i = 0; i < numt; i++) { + for (i = 0; i < numt; i++) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; - for(bailcnt = 0; !found && bailcnt < 200; bailcnt++) { + for (bailcnt = 0; !found && bailcnt < 200; bailcnt++) { found = TRUE; - if(sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { + if (sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { found = FALSE; } - if(cx != -1 && sx >= cx - sw && sx <= cx + 12) { + if (cx != -1 && sx >= cx - sw && sx <= cx + 12) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; } - if(cy != -1 && sy >= cy - sh && sy <= cy + 12) { + if (cy != -1 && sy >= cy - sh && sy <= cy + 12) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; } ii = 2; - for(yy = 0; yy < sh && found == TRUE; yy++) { - for(xx = 0; xx < sw && found == TRUE; xx++) { - if(miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { + for (yy = 0; yy < sh && found == TRUE; yy++) { + for (xx = 0; xx < sw && found == TRUE; xx++) { + if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = FALSE; } - if(dflags[xx + sx][yy + sy] != 0) { + if (dflags[xx + sx][yy + sy] != 0) { found = FALSE; } ii++; } } - if(!found) { + if (!found) { sx++; - if(sx == 40 - sw) { + if (sx == 40 - sw) { sx = 0; sy++; - if(sy == 40 - sh) { + if (sy == 40 - sh) { sy = 0; } } } } - if(bailcnt >= 200) { + if (bailcnt >= 200) { return FALSE; } ii = sw * sh + 2; - for(yy = 0; yy < sh; yy++) { - for(xx = 0; xx < sw; xx++) { - if(miniset[ii] != 0) { + for (yy = 0; yy < sh; yy++) { + for (xx = 0; xx < sw; xx++) { + if (miniset[ii] != 0) { dungeon[xx + sx][yy + sy] = miniset[ii]; } ii++; @@ -863,27 +855,23 @@ BOOL DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tmax, int cx, int } } - if(setview == TRUE) { + if (setview == TRUE) { ViewX = 2 * sx + 21; ViewY = 2 * sy + 22; } - if(ldir == 0) { + if (ldir == 0) { LvlViewX = 2 * sx + 21; LvlViewY = 2 * sy + 22; } - if(ldir == 6) { + if (ldir == 6) { LvlViewX = 2 * sx + 21; LvlViewY = 2 * sy + 22; } return TRUE; } -// 5276CC: using guessed type int nSx2; -// 5276D4: using guessed type int nSy2; -// 5CF320: using guessed type int LvlViewY; -// 5CF324: using guessed type int LvlViewX; -void DRLG_L2PlaceRndSet(unsigned char *miniset, int rndper) +void DRLG_L2PlaceRndSet(BYTE *miniset, int rndper) { int sx, sy, sw, sh, xx, yy, ii, kk; BOOL found; @@ -891,38 +879,38 @@ void DRLG_L2PlaceRndSet(unsigned char *miniset, int rndper) sw = miniset[0]; sh = miniset[1]; - for(sy = 0; sy < 40 - sh; sy++) { - for(sx = 0; sx < 40 - sw; sx++) { + for (sy = 0; sy < 40 - sh; sy++) { + for (sx = 0; sx < 40 - sw; sx++) { found = TRUE; ii = 2; - if(sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { + if (sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { found = FALSE; } - for(yy = 0; yy < sh && found == TRUE; yy++) { - for(xx = 0; xx < sw && found == TRUE; xx++) { - if(miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { + for (yy = 0; yy < sh && found == TRUE; yy++) { + for (xx = 0; xx < sw && found == TRUE; xx++) { + if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = FALSE; } - if(dflags[xx + sx][yy + sy] != 0) { + if (dflags[xx + sx][yy + sy] != 0) { found = FALSE; } ii++; } } kk = sw * sh + 2; - if(found == TRUE) { - for(yy = sy - sh; yy < sy + 2 * sh && found == TRUE; yy++) { - for(xx = sx - sw; xx < sx + 2 * sw; xx++) { - if(dungeon[xx][yy] == miniset[kk]) { + if (found == TRUE) { + for (yy = sy - sh; yy < sy + 2 * sh && found == TRUE; yy++) { + for (xx = sx - sw; xx < sx + 2 * sw; xx++) { + if (dungeon[xx][yy] == miniset[kk]) { found = FALSE; } } } } - if(found == TRUE && random(0, 100) < rndper) { - for(yy = 0; yy < sh; yy++) { - for(xx = 0; xx < sw; xx++) { - if(miniset[kk] != 0) { + if (found == TRUE && random(0, 100) < rndper) { + for (yy = 0; yy < sh; yy++) { + for (xx = 0; xx < sw; xx++) { + if (miniset[kk] != 0) { dungeon[xx + sx][yy + sy] = miniset[kk]; } kk++; @@ -932,39 +920,37 @@ void DRLG_L2PlaceRndSet(unsigned char *miniset, int rndper) } } } -// 5276CC: using guessed type int nSx2; -// 5276D4: using guessed type int nSy2; void DRLG_L2Subs() { int x, y, i, j, k, rv; - unsigned char c; + BYTE c; - for(y = 0; y < 40; y++) { - for(x = 0; x < 40; x++) { - if((x < nSx1 || x > nSx2) && (y < nSy1 || y > nSy2) && random(0, 4) == 0) { + for (y = 0; y < 40; y++) { + for (x = 0; x < 40; x++) { + if ((x < nSx1 || x > nSx2) && (y < nSy1 || y > nSy2) && random(0, 4) == 0) { c = BTYPESL2[dungeon[x][y]]; - if(c != 0) { + if (c != 0) { rv = random(0, 16); k = -1; - while(rv >= 0) { + while (rv >= 0) { k++; - if(k == sizeof(BTYPESL2)) { + if (k == sizeof(BTYPESL2)) { k = 0; } - if(c == BTYPESL2[k]) { + if (c == BTYPESL2[k]) { rv--; } } - for(j = y - 2; j < y + 2; j++) { - for(i = x - 2; i < x + 2; i++) { - if(dungeon[i][j] == k) { + for (j = y - 2; j < y + 2; j++) { + for (i = x - 2; i < x + 2; i++) { + if (dungeon[i][j] == k) { j = y + 3; i = x + 2; } } } - if(j < y + 3) { + if (j < y + 3) { dungeon[x][y] = k; } } @@ -972,41 +958,39 @@ void DRLG_L2Subs() } } } -// 5276CC: using guessed type int nSx2; -// 5276D4: using guessed type int nSy2; void DRLG_L2Shadows() { int x, y, i; BOOL patflag; - unsigned char sd[2][2]; + BYTE sd[2][2]; - for(y = 1; y < 40; y++) { - for(x = 1; x < 40; x++) { + for (y = 1; y < 40; y++) { + for (x = 1; x < 40; x++) { sd[0][0] = BSTYPESL2[dungeon[x][y]]; sd[1][0] = BSTYPESL2[dungeon[x - 1][y]]; sd[0][1] = BSTYPESL2[dungeon[x][y - 1]]; sd[1][1] = BSTYPESL2[dungeon[x - 1][y - 1]]; - for(i = 0; i < 2; i++) { - if(SPATSL2[i].strig == sd[0][0]) { + for (i = 0; i < 2; i++) { + if (SPATSL2[i].strig == sd[0][0]) { patflag = TRUE; - if(SPATSL2[i].s1 != 0 && SPATSL2[i].s1 != sd[1][1]) { + if (SPATSL2[i].s1 != 0 && SPATSL2[i].s1 != sd[1][1]) { patflag = FALSE; } - if(SPATSL2[i].s2 != 0 && SPATSL2[i].s2 != sd[0][1]) { + if (SPATSL2[i].s2 != 0 && SPATSL2[i].s2 != sd[0][1]) { patflag = FALSE; } - if(SPATSL2[i].s3 != 0 && SPATSL2[i].s3 != sd[1][0]) { + if (SPATSL2[i].s3 != 0 && SPATSL2[i].s3 != sd[1][0]) { patflag = FALSE; } - if(patflag == TRUE) { - if(SPATSL2[i].nv1 != 0) { + if (patflag == TRUE) { + if (SPATSL2[i].nv1 != 0) { dungeon[x - 1][y - 1] = SPATSL2[i].nv1; } - if(SPATSL2[i].nv2 != 0) { + if (SPATSL2[i].nv2 != 0) { dungeon[x][y - 1] = SPATSL2[i].nv2; } - if(SPATSL2[i].nv3 != 0) { + if (SPATSL2[i].nv3 != 0) { dungeon[x - 1][y] = SPATSL2[i].nv3; } } @@ -1015,26 +999,25 @@ void DRLG_L2Shadows() } } } -// 48489A: using guessed type short word_48489A; void DRLG_L2SetRoom(int rx1, int ry1) { int rw, rh, i, j; - unsigned char *sp; + BYTE *sp; - rw = (unsigned char)pSetPiece_2[0]; - rh = (unsigned char)pSetPiece_2[2]; + rw = (BYTE)pSetPiece_2[0]; + rh = (BYTE)pSetPiece_2[2]; setpc_x = rx1; setpc_y = ry1; setpc_w = rw; setpc_h = rh; - sp = (unsigned char *)&pSetPiece_2[4]; + sp = (BYTE *)&pSetPiece_2[4]; - for(j = 0; j < rh; j++) { - for(i = 0; i < rw; i++) { - if(*sp != 0) { + for (j = 0; j < rh; j++) { + for (i = 0; i < rw; i++) { + if (*sp != 0) { dungeon[i + rx1][j + ry1] = *sp; dflags[i + rx1][j + ry1] |= 0x80; } else { @@ -1044,28 +1027,26 @@ void DRLG_L2SetRoom(int rx1, int ry1) } } } -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void L2TileFix() { int i, j; - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 1 && dungeon[i][j + 1] == 3) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 1 && dungeon[i][j + 1] == 3) { dungeon[i][j + 1] = 1; } - if(dungeon[i][j] == 3 && dungeon[i][j + 1] == 1) { + if (dungeon[i][j] == 3 && dungeon[i][j + 1] == 1) { dungeon[i][j + 1] = 3; } - if(dungeon[i][j] == 3 && dungeon[i + 1][j] == 7) { + if (dungeon[i][j] == 3 && dungeon[i + 1][j] == 7) { dungeon[i + 1][j] = 3; } - if(dungeon[i][j] == 2 && dungeon[i + 1][j] == 3) { + if (dungeon[i][j] == 2 && dungeon[i + 1][j] == 3) { dungeon[i + 1][j] = 2; } - if(dungeon[i][j] == 11 && dungeon[i + 1][j] == 14) { + if (dungeon[i][j] == 11 && dungeon[i + 1][j] == 14) { dungeon[i + 1][j] = 16; } } @@ -1081,23 +1062,23 @@ BOOL CreateDungeon() ForceH = 0; ForceHW = FALSE; - switch(currlevel) { + switch (currlevel) { case 5: - if(quests[QTYPE_BLOOD]._qactive) { + if (quests[QTYPE_BLOOD]._qactive) { ForceHW = TRUE; ForceH = 20; ForceW = 14; } break; case 6: - if(quests[QTYPE_BONE]._qactive) { + if (quests[QTYPE_BONE]._qactive) { ForceHW = TRUE; ForceW = 10; ForceH = 10; } break; case 7: - if(quests[QTYPE_BLIND]._qactive) { + if (quests[QTYPE_BLIND]._qactive) { ForceHW = TRUE; ForceW = 15; ForceH = 15; @@ -1109,61 +1090,61 @@ BOOL CreateDungeon() CreateRoom(2, 2, 39, 39, 0, 0, ForceHW, ForceH, ForceW); - while(pHallList != NULL) { + while (pHallList != NULL) { GetHall(&nHx1, &nHy1, &nHx2, &nHy2, &nHd); ConnectHall(nHx1, nHy1, nHx2, nHy2, nHd); } - for(j = 0; j <= DMAXY; j++) { /// BUGFIX: change '<=' to '<' - for(i = 0; i <= DMAXX; i++) { /// BUGFIX: change '<=' to '<' - if(predungeon[i][j] == 67) { + for (j = 0; j <= DMAXY; j++) { /// BUGFIX: change '<=' to '<' + for (i = 0; i <= DMAXX; i++) { /// BUGFIX: change '<=' to '<' + if (predungeon[i][j] == 67) { predungeon[i][j] = 35; } - if(predungeon[i][j] == 66) { + if (predungeon[i][j] == 66) { predungeon[i][j] = 35; } - if(predungeon[i][j] == 69) { + if (predungeon[i][j] == 69) { predungeon[i][j] = 35; } - if(predungeon[i][j] == 65) { + if (predungeon[i][j] == 65) { predungeon[i][j] = 35; } - if(predungeon[i][j] == 44) { + if (predungeon[i][j] == 44) { predungeon[i][j] = 46; - if(predungeon[i - 1][j - 1] == 32) { + if (predungeon[i - 1][j - 1] == 32) { predungeon[i - 1][j - 1] = 35; } - if(predungeon[i - 1][j] == 32) { + if (predungeon[i - 1][j] == 32) { predungeon[i - 1][j] = 35; } - if(predungeon[i - 1][1 + j] == 32) { + if (predungeon[i - 1][1 + j] == 32) { predungeon[i - 1][1 + j] = 35; } - if(predungeon[i + 1][j - 1] == 32) { + if (predungeon[i + 1][j - 1] == 32) { predungeon[i + 1][j - 1] = 35; } - if(predungeon[i + 1][j] == 32) { + if (predungeon[i + 1][j] == 32) { predungeon[i + 1][j] = 35; } - if(predungeon[i + 1][1 + j] == 32) { + if (predungeon[i + 1][1 + j] == 32) { predungeon[i + 1][1 + j] = 35; } - if(predungeon[i][j - 1] == 32) { + if (predungeon[i][j - 1] == 32) { predungeon[i][j - 1] = 35; } - if(predungeon[i][j + 1] == 32) { + if (predungeon[i][j + 1] == 32) { predungeon[i][j + 1] = 35; } } } } - if(!DL2_FillVoids()) { + if (!DL2_FillVoids()) { return FALSE; } - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { DoPatternCheck(i, j); } } @@ -1175,32 +1156,32 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL { int nAw, nAh, nRw, nRh, nRx1, nRy1, nRx2, nRy2, nHw, nHh, nHx1, nHy1, nHx2, nHy2, nRid; - if(nRoomCnt >= 80) { + if (nRoomCnt >= 80) { return; } nAw = nX2 - nX1; nAh = nY2 - nY1; - if(nAw < Area_Min || nAh < Area_Min) { + if (nAw < Area_Min || nAh < Area_Min) { return; } - if(nAw > Room_Max) { + if (nAw > Room_Max) { nRw = random(0, Room_Max - Room_Min) + Room_Min; - } else if(nAw > Room_Min) { + } else if (nAw > Room_Min) { nRw = random(0, nAw - Room_Min) + Room_Min; } else { nRw = nAw; } - if(nAh > Room_Max) { + if (nAh > Room_Max) { nRh = random(0, Room_Max - Room_Min) + Room_Min; - } else if(nAh > Room_Min) { + } else if (nAh > Room_Min) { nRh = random(0, nAh - Room_Min) + Room_Min; } else { nRh = nAh; } - if(ForceHW == TRUE) { + if (ForceHW == TRUE) { nRw = nW; nRh = nH; } @@ -1209,42 +1190,42 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL nRy1 = random(0, nY2 - nY1) + nY1; nRx2 = nRw + nRx1; nRy2 = nRh + nRy1; - if(nRx2 > nX2) { + if (nRx2 > nX2) { nRx2 = nX2; nRx1 = nX2 - nRw; } - if(nRy2 > nY2) { + if (nRy2 > nY2) { nRy2 = nY2; nRy1 = nY2 - nRh; } - if(nRx1 >= 38) { + if (nRx1 >= 38) { nRx1 = 38; } - if(nRy1 >= 38) { + if (nRy1 >= 38) { nRy1 = 38; } - if(nRx1 <= 1) { + if (nRx1 <= 1) { nRx1 = 1; } - if(nRy1 <= 1) { + if (nRy1 <= 1) { nRy1 = 1; } - if(nRx2 >= 38) { + if (nRx2 >= 38) { nRx2 = 38; } - if(nRy2 >= 38) { + if (nRy2 >= 38) { nRy2 = 38; } - if(nRx2 <= 1) { + if (nRx2 <= 1) { nRx2 = 1; } - if(nRy2 <= 1) { + if (nRy2 <= 1) { nRy2 = 1; } DefineRoom(nRx1, nRy1, nRx2, nRy2, ForceHW); - if(ForceHW == TRUE) { + if (ForceHW == TRUE) { nSx1 = nRx1 + 2; nSy1 = nRy1 + 2; nSx2 = nRx2; @@ -1254,29 +1235,29 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL nRid = nRoomCnt; RoomList[nRid].nRoomDest = nRDest; - if(nRDest != 0) { - if(nHDir == 1) { + if (nRDest != 0) { + if (nHDir == 1) { nHx1 = random(0, nRx2 - nRx1 - 2) + nRx1 + 1; nHy1 = nRy1; nHw = RoomList[nRDest].nRoomx2 - RoomList[nRDest].nRoomx1 - 2; nHx2 = random(0, nHw) + RoomList[nRDest].nRoomx1 + 1; nHy2 = RoomList[nRDest].nRoomy2; } - if(nHDir == 3) { + if (nHDir == 3) { nHx1 = random(0, nRx2 - nRx1 - 2) + nRx1 + 1; nHy1 = nRy2; nHw = RoomList[nRDest].nRoomx2 - RoomList[nRDest].nRoomx1 - 2; nHx2 = random(0, nHw) + RoomList[nRDest].nRoomx1 + 1; nHy2 = RoomList[nRDest].nRoomy1; } - if(nHDir == 2) { + if (nHDir == 2) { nHx1 = nRx2; nHy1 = random(0, nRy2 - nRy1 - 2) + nRy1 + 1; nHx2 = RoomList[nRDest].nRoomx1; nHh = RoomList[nRDest].nRoomy2 - RoomList[nRDest].nRoomy1 - 2; nHy2 = random(0, nHh) + RoomList[nRDest].nRoomy1 + 1; } - if(nHDir == 4) { + if (nHDir == 4) { nHx1 = nRx1; nHy1 = random(0, nRy2 - nRy1 - 2) + nRy1 + 1; nHx2 = RoomList[nRDest].nRoomx2; @@ -1286,7 +1267,7 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL AddHall(nHx1, nHy1, nHx2, nHy2, nHDir); } - if(nRh > nRw) { + if (nRh > nRw) { CreateRoom(nX1 + 2, nY1 + 2, nRx1 - 2, nRy2 - 2, nRid, 2, 0, 0, 0); CreateRoom(nRx2 + 2, nRy1 + 2, nX2 - 2, nY2 - 2, nRid, 4, 0, 0, 0); CreateRoom(nX1 + 2, nRy2 + 2, nRx2 - 2, nY2 - 2, nRid, 1, 0, 0, 0); @@ -1298,11 +1279,6 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL CreateRoom(nRx2 + 2, nY1 + 2, nX2 - 2, nRy2 - 2, nRid, 4, 0, 0, 0); } } -// 484858: using guessed type int Area_Min; -// 48485C: using guessed type int Room_Max; -// 484860: using guessed type int Room_Min; -// 5276CC: using guessed type int nSx2; -// 5276D4: using guessed type int nSy2; void DefineRoom(int nX1, int nY1, int nX2, int nY2, BOOL ForceHW) { @@ -1319,23 +1295,23 @@ void DefineRoom(int nX1, int nY1, int nX2, int nY2, BOOL ForceHW) RoomList[nRoomCnt].nRoomy1 = nY1; RoomList[nRoomCnt].nRoomy2 = nY2; - if(ForceHW == TRUE) { - for(i = nX1; i < nX2; i++) { - while(i < nY2) { + if (ForceHW == TRUE) { + for (i = nX1; i < nX2; i++) { + while (i < nY2) { dflags[i][nY1] |= 0x80; i++; } } } - for(i = nX1 + 1; i <= nX2 - 1; i++) { + for (i = nX1 + 1; i <= nX2 - 1; i++) { predungeon[i][nY1] = 35; predungeon[i][nY2] = 35; } nY2--; - for(j = nY1 + 1; j <= nY2; j++) { + for (j = nY1 + 1; j <= nY2; j++) { predungeon[nX1][j] = 35; predungeon[nX2][j] = 35; - for(i = nX1 + 1; i < nX2; i++) { + for (i = nX1 + 1; i < nX2; i++) { predungeon[i][j] = 46; } } @@ -1345,7 +1321,7 @@ void AddHall(int nX1, int nY1, int nX2, int nY2, int nHd) { HALLNODE *p1, *p2; - if(pHallList == NULL) { + if (pHallList == NULL) { pHallList = (HALLNODE *)DiabloAllocPtr(sizeof(*pHallList)); pHallList->nHallx1 = nX1; pHallList->nHally1 = nY1; @@ -1362,7 +1338,7 @@ void AddHall(int nX1, int nY1, int nX2, int nY2, int nHd) p1->nHalldir = nHd; p1->pNext = NULL; p2 = pHallList; - while(p2->pNext != NULL) { + while (p2->pNext != NULL) { p2 = p2->pNext; } p2->pNext = p1; @@ -1403,46 +1379,46 @@ void ConnectHall(int nX1, int nY1, int nX2, int nY2, int nHd) predungeon[nX2][nY2] = 44; fInroom = FALSE; - while(!fDoneflag) { - if(nX1 >= 38 && nCurrd == 2) { + while (!fDoneflag) { + if (nX1 >= 38 && nCurrd == 2) { nCurrd = 4; } - if(nY1 >= 38 && nCurrd == 3) { + if (nY1 >= 38 && nCurrd == 3) { nCurrd = 1; } - if(nX1 <= 1 && nCurrd == 4) { + if (nX1 <= 1 && nCurrd == 4) { nCurrd = 2; } - if(nY1 <= 1 && nCurrd == 1) { + if (nY1 <= 1 && nCurrd == 1) { nCurrd = 3; } - if(predungeon[nX1][nY1] == 67 && (nCurrd == 1 || nCurrd == 4)) { + if (predungeon[nX1][nY1] == 67 && (nCurrd == 1 || nCurrd == 4)) { nCurrd = 2; } - if(predungeon[nX1][nY1] == 66 && (nCurrd == 1 || nCurrd == 2)) { + if (predungeon[nX1][nY1] == 66 && (nCurrd == 1 || nCurrd == 2)) { nCurrd = 3; } - if(predungeon[nX1][nY1] == 69 && (nCurrd == 4 || nCurrd == 3)) { + if (predungeon[nX1][nY1] == 69 && (nCurrd == 4 || nCurrd == 3)) { nCurrd = 1; } - if(predungeon[nX1][nY1] == 65 && (nCurrd == 2 || nCurrd == 3)) { + if (predungeon[nX1][nY1] == 65 && (nCurrd == 2 || nCurrd == 3)) { nCurrd = 4; } nX1 += Dir_Xadd[nCurrd]; nY1 += Dir_Yadd[nCurrd]; - if(predungeon[nX1][nY1] == 32) { - if(fInroom) { + if (predungeon[nX1][nY1] == 32) { + if (fInroom) { CreateDoorType(nX1 - Dir_Xadd[nCurrd], nY1 - Dir_Yadd[nCurrd]); } else { - if(fMinusFlag < 50) { - if(nCurrd != 1 && nCurrd != 3) { + if (fMinusFlag < 50) { + if (nCurrd != 1 && nCurrd != 3) { PlaceHallExt(nX1, nY1 - 1); } else { PlaceHallExt(nX1 - 1, nY1); } } - if(fPlusFlag < 50) { - if(nCurrd != 1 && nCurrd != 3) { + if (fPlusFlag < 50) { + if (nCurrd != 1 && nCurrd != 3) { PlaceHallExt(nX1, nY1 + 1); } else { PlaceHallExt(nX1 + 1, nY1); @@ -1452,22 +1428,22 @@ void ConnectHall(int nX1, int nY1, int nX2, int nY2, int nHd) predungeon[nX1][nY1] = 44; fInroom = FALSE; } else { - if(!fInroom && predungeon[nX1][nY1] == 35) { + if (!fInroom && predungeon[nX1][nY1] == 35) { CreateDoorType(nX1, nY1); } - if(predungeon[nX1][nY1] != 44) { + if (predungeon[nX1][nY1] != 44) { fInroom = TRUE; } } nDx = abs(nX2 - nX1); nDy = abs(nY2 - nY1); - if(nDx > nDy) { + if (nDx > nDy) { nRp = 2 * nDx; - if(nRp > 30) { + if (nRp > 30) { nRp = 30; } - if(random(0, 100) < nRp) { - if(nX2 <= nX1 || nX1 >= 40) { + if (random(0, 100) < nRp) { + if (nX2 <= nX1 || nX1 >= 40) { nCurrd = 4; } else { nCurrd = 2; @@ -1475,60 +1451,60 @@ void ConnectHall(int nX1, int nY1, int nX2, int nY2, int nHd) } } else { nRp = 5 * nDy; - if(nRp > 80) { + if (nRp > 80) { nRp = 80; } - if(random(0, 100) < nRp) { - if(nY2 <= nY1 || nY1 >= 40) { + if (random(0, 100) < nRp) { + if (nY2 <= nY1 || nY1 >= 40) { nCurrd = 1; } else { nCurrd = 3; } } } - if(nDy < 10 && nX1 == nX2 && (nCurrd == 2 || nCurrd == 4)) { - if(nY2 <= nY1 || nY1 >= 40) { + if (nDy < 10 && nX1 == nX2 && (nCurrd == 2 || nCurrd == 4)) { + if (nY2 <= nY1 || nY1 >= 40) { nCurrd = 1; } else { nCurrd = 3; } } - if(nDx < 10 && nY1 == nY2 && (nCurrd == 1 || nCurrd == 3)) { - if(nX2 <= nX1 || nX1 >= 40) { + if (nDx < 10 && nY1 == nY2 && (nCurrd == 1 || nCurrd == 3)) { + if (nX2 <= nX1 || nX1 >= 40) { nCurrd = 4; } else { nCurrd = 2; } } - if(nDy == 1 && nDx > 1 && (nCurrd == 1 || nCurrd == 3)) { - if(nX2 <= nX1 || nX1 >= 40) { + if (nDy == 1 && nDx > 1 && (nCurrd == 1 || nCurrd == 3)) { + if (nX2 <= nX1 || nX1 >= 40) { nCurrd = 4; } else { nCurrd = 2; } } - if(nDx == 1 && nDy > 1 && (nCurrd == 2 || nCurrd == 4)) { - if(nY2 <= nY1 || nX1 >= 40) { + if (nDx == 1 && nDy > 1 && (nCurrd == 2 || nCurrd == 4)) { + if (nY2 <= nY1 || nX1 >= 40) { nCurrd = 1; } else { nCurrd = 3; } } - if(nDx == 0 && predungeon[nX1][nY1] != 32 && (nCurrd == 2 || nCurrd == 4)) { - if(nX2 <= nOrigX1 || nX1 >= 40) { + if (nDx == 0 && predungeon[nX1][nY1] != 32 && (nCurrd == 2 || nCurrd == 4)) { + if (nX2 <= nOrigX1 || nX1 >= 40) { nCurrd = 1; } else { nCurrd = 3; } } - if(nDy == 0 && predungeon[nX1][nY1] != 32 && (nCurrd == 1 || nCurrd == 3)) { - if(nY2 <= nOrigY1 || nY1 >= 40) { + if (nDy == 0 && predungeon[nX1][nY1] != 32 && (nCurrd == 1 || nCurrd == 3)) { + if (nY2 <= nOrigY1 || nY1 >= 40) { nCurrd = 4; } else { nCurrd = 2; } } - if(nX1 == nX2 && nY1 == nY2) { + if (nX1 == nX2 && nY1 == nY2) { fDoneflag = TRUE; } } @@ -1540,30 +1516,30 @@ void CreateDoorType(int nX, int nY) fDoneflag = FALSE; - if(predungeon[nX - 1][nY] == 68) { + if (predungeon[nX - 1][nY] == 68) { fDoneflag = TRUE; } - if(predungeon[nX + 1][nY] == 68) { + if (predungeon[nX + 1][nY] == 68) { fDoneflag = TRUE; } - if(predungeon[nX][nY - 1] == 68) { + if (predungeon[nX][nY - 1] == 68) { fDoneflag = TRUE; } - if(predungeon[nX][nY + 1] == 68) { + if (predungeon[nX][nY + 1] == 68) { fDoneflag = TRUE; } - if(predungeon[nX][nY] == 66 || predungeon[nX][nY] == 67 || predungeon[nX][nY] == 65 || predungeon[nX][nY] == 69) { + if (predungeon[nX][nY] == 66 || predungeon[nX][nY] == 67 || predungeon[nX][nY] == 65 || predungeon[nX][nY] == 69) { fDoneflag = TRUE; } - if(!fDoneflag) { + if (!fDoneflag) { predungeon[nX][nY] = 68; } } void PlaceHallExt(int nX, int nY) { - if(predungeon[nX][nY] == 32) { + if (predungeon[nX][nY] == 32) { predungeon[nX][nY] = 44; } } @@ -1572,58 +1548,58 @@ void DoPatternCheck(int i, int j) { int k, l, x, y, nOk; - for(k = 0; Patterns[k][4] != 255; k++) { + for (k = 0; Patterns[k][4] != 255; k++) { x = i - 1; y = j - 1; nOk = 254; - for(l = 0; l < 9 && nOk == 254; l++) { + for (l = 0; l < 9 && nOk == 254; l++) { nOk = 255; - if(l == 3 || l == 6) { + if (l == 3 || l == 6) { y++; x = i - 1; } - if(x >= 0 && x < 40 && y >= 0 && y < 40) { - switch(Patterns[k][l]) { + if (x >= 0 && x < 40 && y >= 0 && y < 40) { + switch (Patterns[k][l]) { case 0: nOk = 254; break; case 1: - if(predungeon[x][y] == 35) { + if (predungeon[x][y] == 35) { nOk = 254; } break; case 2: - if(predungeon[x][y] == 46) { + if (predungeon[x][y] == 46) { nOk = 254; } break; case 4: - if(predungeon[x][y] == 32) { + if (predungeon[x][y] == 32) { nOk = 254; } break; case 3: - if(predungeon[x][y] == 68) { + if (predungeon[x][y] == 68) { nOk = 254; } break; case 5: - if(predungeon[x][y] == 68 || predungeon[x][y] == 46) { + if (predungeon[x][y] == 68 || predungeon[x][y] == 46) { nOk = 254; } break; case 6: - if(predungeon[x][y] == 68 || predungeon[x][y] == 35) { + if (predungeon[x][y] == 68 || predungeon[x][y] == 35) { nOk = 254; } break; case 7: - if(predungeon[x][y] == 32 || predungeon[x][y] == 46) { + if (predungeon[x][y] == 32 || predungeon[x][y] == 46) { nOk = 254; } break; case 8: - if(predungeon[x][y] == 68 || predungeon[x][y] == 35 || predungeon[x][y] == 46) { + if (predungeon[x][y] == 68 || predungeon[x][y] == 35 || predungeon[x][y] == 46) { nOk = 254; } break; @@ -1633,7 +1609,7 @@ void DoPatternCheck(int i, int j) } x++; } - if(nOk == 254) { + if (nOk == 254) { dungeon[i][j] = Patterns[k][9]; } } @@ -1646,259 +1622,259 @@ BOOL DL2_FillVoids() int to; to = 0; - while(DL2_NumNoChar() > 700 && to < 100) { + while (DL2_NumNoChar() > 700 && to < 100) { xx = random(0, 38) + 1; yy = random(0, 38) + 1; - if(predungeon[xx][yy] != 35) { + if (predungeon[xx][yy] != 35) { continue; } xf1 = xf2 = yf1 = yf2 = FALSE; - if(predungeon[xx - 1][yy] == 32 && predungeon[xx + 1][yy] == 46) { - if(predungeon[xx + 1][yy - 1] == 46 - && predungeon[xx + 1][yy + 1] == 46 - && predungeon[xx - 1][yy - 1] == 32 - && predungeon[xx - 1][yy + 1] == 32) { + if (predungeon[xx - 1][yy] == 32 && predungeon[xx + 1][yy] == 46) { + if (predungeon[xx + 1][yy - 1] == 46 + && predungeon[xx + 1][yy + 1] == 46 + && predungeon[xx - 1][yy - 1] == 32 + && predungeon[xx - 1][yy + 1] == 32) { xf1 = yf1 = yf2 = TRUE; } - } else if(predungeon[xx + 1][yy] == 32 && predungeon[xx - 1][yy] == 46) { - if(predungeon[xx - 1][yy - 1] == 46 - && predungeon[xx - 1][yy + 1] == 46 - && predungeon[xx + 1][yy - 1] == 32 - && predungeon[xx + 1][yy + 1] == 32) { + } else if (predungeon[xx + 1][yy] == 32 && predungeon[xx - 1][yy] == 46) { + if (predungeon[xx - 1][yy - 1] == 46 + && predungeon[xx - 1][yy + 1] == 46 + && predungeon[xx + 1][yy - 1] == 32 + && predungeon[xx + 1][yy + 1] == 32) { xf2 = yf1 = yf2 = TRUE; } - } else if(predungeon[xx][yy - 1] == 32 && predungeon[xx][yy + 1] == 46) { - if(predungeon[xx - 1][yy + 1] == 46 - && predungeon[xx + 1][yy + 1] == 46 - && predungeon[xx - 1][yy - 1] == 32 - && predungeon[xx + 1][yy - 1] == 32) { + } else if (predungeon[xx][yy - 1] == 32 && predungeon[xx][yy + 1] == 46) { + if (predungeon[xx - 1][yy + 1] == 46 + && predungeon[xx + 1][yy + 1] == 46 + && predungeon[xx - 1][yy - 1] == 32 + && predungeon[xx + 1][yy - 1] == 32) { yf1 = xf1 = xf2 = TRUE; } - } else if(predungeon[xx][yy + 1] == 32 && predungeon[xx][yy - 1] == 46) { - if(predungeon[xx - 1][yy - 1] == 46 - && predungeon[xx + 1][yy - 1] == 46 - && predungeon[xx - 1][yy + 1] == 32 - && predungeon[xx + 1][yy + 1] == 32) { + } else if (predungeon[xx][yy + 1] == 32 && predungeon[xx][yy - 1] == 46) { + if (predungeon[xx - 1][yy - 1] == 46 + && predungeon[xx + 1][yy - 1] == 46 + && predungeon[xx - 1][yy + 1] == 32 + && predungeon[xx + 1][yy + 1] == 32) { yf2 = xf1 = xf2 = TRUE; } } - if(DL2_Cont(xf1, yf1, xf2, yf2)) { - if(xf1) { + if (DL2_Cont(xf1, yf1, xf2, yf2)) { + if (xf1) { x1 = xx - 1; } else { x1 = xx; } - if(xf2) { + if (xf2) { x2 = xx + 1; } else { x2 = xx; } - if(yf1) { + if (yf1) { y1 = yy - 1; } else { y1 = yy; } - if(yf2) { + if (yf2) { y2 = yy + 1; } else { y2 = yy; } - if(!xf1) { - while(yf1 || yf2) { - if(y1 == 0) { + if (!xf1) { + while (yf1 || yf2) { + if (y1 == 0) { yf1 = FALSE; } - if(y2 == 39) { + if (y2 == 39) { yf2 = FALSE; } - if(y2 - y1 >= 14) { + if (y2 - y1 >= 14) { yf1 = FALSE; yf2 = FALSE; } - if(yf1) { + if (yf1) { y1--; } - if(yf2) { + if (yf2) { y2++; } - if(predungeon[x2][y1] != 32) { + if (predungeon[x2][y1] != 32) { yf1 = FALSE; } - if(predungeon[x2][y2] != 32) { + if (predungeon[x2][y2] != 32) { yf2 = FALSE; } } y1 += 2; y2 -= 2; - if(y2 - y1 > 5) { - while(xf2) { - if(x2 == 39) { + if (y2 - y1 > 5) { + while (xf2) { + if (x2 == 39) { xf2 = FALSE; } - if(x2 - x1 >= 12) { + if (x2 - x1 >= 12) { xf2 = FALSE; } - for(jj = y1; jj <= y2; jj++) { - if(predungeon[x2][jj] != 32) { + for (jj = y1; jj <= y2; jj++) { + if (predungeon[x2][jj] != 32) { xf2 = FALSE; } } - if(xf2) { + if (xf2) { x2++; } } x2 -= 2; - if(x2 - x1 > 5) { + if (x2 - x1 > 5) { DL2_DrawRoom(x1, y1, x2, y2); DL2_KnockWalls(x1, y1, x2, y2); } } - } else if(!xf2) { - while(yf1 || yf2) { - if(y1 == 0) { + } else if (!xf2) { + while (yf1 || yf2) { + if (y1 == 0) { yf1 = FALSE; } - if(y2 == 39) { + if (y2 == 39) { yf2 = FALSE; } - if(y2 - y1 >= 14) { + if (y2 - y1 >= 14) { yf1 = FALSE; yf2 = FALSE; } - if(yf1) { + if (yf1) { y1--; } - if(yf2) { + if (yf2) { y2++; } - if(predungeon[x1][y1] != 32) { + if (predungeon[x1][y1] != 32) { yf1 = FALSE; } - if(predungeon[x1][y2] != 32) { + if (predungeon[x1][y2] != 32) { yf2 = FALSE; } } y1 += 2; y2 -= 2; - if(y2 - y1 > 5) { - while(xf1) { - if(x1 == 0) { + if (y2 - y1 > 5) { + while (xf1) { + if (x1 == 0) { xf1 = FALSE; } - if(x2 - x1 >= 12) { + if (x2 - x1 >= 12) { xf1 = FALSE; } - for(jj = y1; jj <= y2; jj++) { - if(predungeon[x1][jj] != 32) { + for (jj = y1; jj <= y2; jj++) { + if (predungeon[x1][jj] != 32) { xf1 = FALSE; } } - if(xf1) { + if (xf1) { x1--; } } x1 += 2; - if(x2 - x1 > 5) { + if (x2 - x1 > 5) { DL2_DrawRoom(x1, y1, x2, y2); DL2_KnockWalls(x1, y1, x2, y2); } } - } else if(!yf1) { - while(xf1 || xf2) { - if(x1 == 0) { + } else if (!yf1) { + while (xf1 || xf2) { + if (x1 == 0) { xf1 = FALSE; } - if(x2 == 39) { + if (x2 == 39) { xf2 = FALSE; } - if(x2 - x1 >= 14) { + if (x2 - x1 >= 14) { xf1 = FALSE; xf2 = FALSE; } - if(xf1) { + if (xf1) { x1--; } - if(xf2) { + if (xf2) { x2++; } - if(predungeon[x1][y2] != 32) { + if (predungeon[x1][y2] != 32) { xf1 = FALSE; } - if(predungeon[x2][y2] != 32) { + if (predungeon[x2][y2] != 32) { xf2 = FALSE; } } x1 += 2; x2 -= 2; - if(x2 - x1 > 5) { - while(yf2) { - if(y2 == 39) { + if (x2 - x1 > 5) { + while (yf2) { + if (y2 == 39) { yf2 = FALSE; } - if(y2 - y1 >= 12) { + if (y2 - y1 >= 12) { yf2 = FALSE; } - for(ii = x1; ii <= x2; ii++) { - if(predungeon[ii][y2] != 32) { + for (ii = x1; ii <= x2; ii++) { + if (predungeon[ii][y2] != 32) { yf2 = FALSE; } } - if(yf2) { + if (yf2) { y2++; } } y2 -= 2; - if(y2 - y1 > 5) { + if (y2 - y1 > 5) { DL2_DrawRoom(x1, y1, x2, y2); DL2_KnockWalls(x1, y1, x2, y2); } } - } else if(!yf2) { - while(xf1 || xf2) { - if(x1 == 0) { + } else if (!yf2) { + while (xf1 || xf2) { + if (x1 == 0) { xf1 = FALSE; } - if(x2 == 39) { + if (x2 == 39) { xf2 = FALSE; } - if(x2 - x1 >= 14) { + if (x2 - x1 >= 14) { xf1 = FALSE; xf2 = FALSE; } - if(xf1) { + if (xf1) { x1--; } - if(xf2) { + if (xf2) { x2++; } - if(predungeon[x1][y1] != 32) { + if (predungeon[x1][y1] != 32) { xf1 = FALSE; } - if(predungeon[x2][y1] != 32) { + if (predungeon[x2][y1] != 32) { xf2 = FALSE; } } x1 += 2; x2 -= 2; - if(x2 - x1 > 5) { - while(yf1) { - if(y1 == 0) { + if (x2 - x1 > 5) { + while (yf1) { + if (y1 == 0) { yf1 = FALSE; } - if(y2 - y1 >= 12) { + if (y2 - y1 >= 12) { yf1 = FALSE; } - for(ii = x1; ii <= x2; ii++) { - if(predungeon[ii][y1] != 32) { + for (ii = x1; ii <= x2; ii++) { + if (predungeon[ii][y1] != 32) { yf1 = FALSE; } } - if(yf1) { + if (yf1) { y1--; } } y1 += 2; - if(y2 - y1 > 5) { + if (y2 - y1 > 5) { DL2_DrawRoom(x1, y1, x2, y2); DL2_KnockWalls(x1, y1, x2, y2); } @@ -1913,13 +1889,13 @@ BOOL DL2_FillVoids() BOOL DL2_Cont(BOOL x1f, BOOL y1f, BOOL x2f, BOOL y2f) { - if(x1f && x2f && y1f && y2f) { + if (x1f && x2f && y1f && y2f) { return FALSE; } - if(x1f && x2f && (y1f || y2f)) { + if (x1f && x2f && (y1f || y2f)) { return TRUE; } - if(y1f && y2f && (x1f || x2f)) { + if (y1f && y2f && (x1f || x2f)) { return TRUE; } @@ -1931,9 +1907,9 @@ int DL2_NumNoChar() int t, ii, jj; t = 0; - for(jj = 0; jj < 40; jj++) { - for(ii = 0; ii < 40; ii++) { - if(predungeon[ii][jj] == 32) { + for (jj = 0; jj < 40; jj++) { + for (ii = 0; ii < 40; ii++) { + if (predungeon[ii][jj] == 32) { t++; } } @@ -1946,16 +1922,16 @@ void DL2_DrawRoom(int x1, int y1, int x2, int y2) { int ii, jj; - for(jj = y1; jj <= y2; jj++) { - for(ii = x1; ii <= x2; ii++) { + for (jj = y1; jj <= y2; jj++) { + for (ii = x1; ii <= x2; ii++) { predungeon[ii][jj] = 46; } } - for(jj = y1; jj <= y2; jj++) { + for (jj = y1; jj <= y2; jj++) { predungeon[x1][jj] = 35; predungeon[x2][jj] = 35; } - for(ii = x1; ii <= x2; ii++) { + for (ii = x1; ii <= x2; ii++) { predungeon[ii][y1] = 35; predungeon[ii][y2] = 35; } @@ -1965,31 +1941,31 @@ void DL2_KnockWalls(int x1, int y1, int x2, int y2) { int ii, jj; - for(ii = x1 + 1; ii < x2; ii++) { - if(predungeon[ii][y1 - 1] == 46 && predungeon[ii][y1 + 1] == 46) { + for (ii = x1 + 1; ii < x2; ii++) { + if (predungeon[ii][y1 - 1] == 46 && predungeon[ii][y1 + 1] == 46) { predungeon[ii][y1] = 46; } - if(predungeon[ii][y2 - 1] == 46 && predungeon[ii][y2 + 1] == 46) { + if (predungeon[ii][y2 - 1] == 46 && predungeon[ii][y2 + 1] == 46) { predungeon[ii][y2] = 46; } - if(predungeon[ii][y1 - 1] == 68) { + if (predungeon[ii][y1 - 1] == 68) { predungeon[ii][y1 - 1] = 46; } - if(predungeon[ii][y2 + 1] == 68) { + if (predungeon[ii][y2 + 1] == 68) { predungeon[ii][y2 + 1] = 46; } } - for(jj = y1 + 1; jj < y2; jj++) { - if(predungeon[x1 - 1][jj] == 46 && predungeon[x1 + 1][jj] == 46) { + for (jj = y1 + 1; jj < y2; jj++) { + if (predungeon[x1 - 1][jj] == 46 && predungeon[x1 + 1][jj] == 46) { predungeon[x1][jj] = 46; } - if(predungeon[x2 - 1][jj] == 46 && predungeon[x2 + 1][jj] == 46) { + if (predungeon[x2 - 1][jj] == 46 && predungeon[x2 + 1][jj] == 46) { predungeon[x2][jj] = 46; } - if(predungeon[x1 - 1][jj] == 68) { + if (predungeon[x1 - 1][jj] == 68) { predungeon[x1 - 1][jj] = 46; } - if(predungeon[x2 + 1][jj] == 68) { + if (predungeon[x2 + 1][jj] == 68) { predungeon[x2 + 1][jj] = 46; } } @@ -2000,10 +1976,10 @@ void DRLG_L2FloodTVal() int i, j, xx, yy; yy = 16; - for(j = 0; j < 40; j++) { + for (j = 0; j < 40; j++) { xx = 16; - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 3 && dTransVal[xx][yy] == 0) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 3 && dTransVal[xx][yy] == 0) { DRLG_L2FTVR(i, j, xx, yy, 0); TransVal++; } @@ -2012,37 +1988,36 @@ void DRLG_L2FloodTVal() yy += 2; } } -// 5A5590: using guessed type char TransVal; void DRLG_L2FTVR(int i, int j, int x, int y, int d) { - if(dTransVal[x][y] != 0 || dungeon[i][j] != 3) { - if(d == 1) { + if (dTransVal[x][y] != 0 || dungeon[i][j] != 3) { + if (d == 1) { dTransVal[x][y] = TransVal; dTransVal[x][y + 1] = TransVal; } - if(d == 2) { + if (d == 2) { dTransVal[x + 1][y] = TransVal; dTransVal[x + 1][y + 1] = TransVal; } - if(d == 3) { + if (d == 3) { dTransVal[x][y] = TransVal; dTransVal[x + 1][y] = TransVal; } - if(d == 4) { + if (d == 4) { dTransVal[x][y + 1] = TransVal; dTransVal[x + 1][y + 1] = TransVal; } - if(d == 5) { + if (d == 5) { dTransVal[x + 1][y + 1] = TransVal; } - if(d == 6) { + if (d == 6) { dTransVal[x][y + 1] = TransVal; } - if(d == 7) { + if (d == 7) { dTransVal[x + 1][y] = TransVal; } - if(d == 8) { + if (d == 8) { dTransVal[x][y] = TransVal; } } else { @@ -2060,33 +2035,32 @@ void DRLG_L2FTVR(int i, int j, int x, int y, int d) DRLG_L2FTVR(i + 1, j + 1, x + 2, y + 2, 8); } } -// 5A5590: using guessed type char TransVal; void DRLG_L2TransFix() { int i, j, xx, yy; yy = 16; - for(j = 0; j < 40; j++) { + for (j = 0; j < 40; j++) { xx = 16; - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 14 && dungeon[i][j - 1] == 10) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 14 && dungeon[i][j - 1] == 10) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 15 && dungeon[i + 1][j] == 11) { + if (dungeon[i][j] == 15 && dungeon[i + 1][j] == 11) { dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 10) { + if (dungeon[i][j] == 10) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 11) { + if (dungeon[i][j] == 11) { dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 16) { + if (dungeon[i][j] == 16) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; @@ -2101,24 +2075,24 @@ void L2DirtFix() { int i, j; - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 13 && dungeon[i + 1][j] != 11) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 13 && dungeon[i + 1][j] != 11) { dungeon[i][j] = 146; } - if(dungeon[i][j] == 11 && dungeon[i + 1][j] != 11) { + if (dungeon[i][j] == 11 && dungeon[i + 1][j] != 11) { dungeon[i][j] = 144; } - if(dungeon[i][j] == 15 && dungeon[i + 1][j] != 11) { + if (dungeon[i][j] == 15 && dungeon[i + 1][j] != 11) { dungeon[i][j] = 148; } - if(dungeon[i][j] == 10 && dungeon[i][j + 1] != 10) { + if (dungeon[i][j] == 10 && dungeon[i][j + 1] != 10) { dungeon[i][j] = 143; } - if(dungeon[i][j] == 13 && dungeon[i][j + 1] != 10) { + if (dungeon[i][j] == 13 && dungeon[i][j + 1] != 10) { dungeon[i][j] = 146; } - if(dungeon[i][j] == 14 && dungeon[i][j + 1] != 15) { + if (dungeon[i][j] == 14 && dungeon[i][j + 1] != 15) { dungeon[i][j] = 147; } } @@ -2129,21 +2103,21 @@ void DRLG_InitL2Vals() { int i, j, pc; - for(j = 0; j < 112; j++) { - for(i = 0; i < 112; i++) { - if(dPiece[i][j] == 541) { + for (j = 0; j < 112; j++) { + for (i = 0; i < 112; i++) { + if (dPiece[i][j] == 541) { pc = 5; - } else if(dPiece[i][j] == 178) { + } else if (dPiece[i][j] == 178) { pc = 5; - } else if(dPiece[i][j] == 551) { + } else if (dPiece[i][j] == 551) { pc = 5; - } else if(dPiece[i][j] == 542) { + } else if (dPiece[i][j] == 542) { pc = 6; - } else if(dPiece[i][j] == 553) { + } else if (dPiece[i][j] == 553) { pc = 6; - } else if(dPiece[i][j] == 13) { + } else if (dPiece[i][j] == 13) { pc = 5; - } else if(dPiece[i][j] == 17) { + } else if (dPiece[i][j] == 17) { pc = 6; } else { continue; @@ -2151,12 +2125,12 @@ void DRLG_InitL2Vals() dArch[i][j] = pc; } } - for(j = 0; j < 112; j++) { - for(i = 0; i < 112; i++) { - if(dPiece[i][j] == 132) { + for (j = 0; j < 112; j++) { + for (i = 0; i < 112; i++) { + if (dPiece[i][j] == 132) { dArch[i][j + 1] = 2; dArch[i][j + 2] = 1; - } else if(dPiece[i][j] == 135 || dPiece[i][j] == 139) { + } else if (dPiece[i][j] == 135 || dPiece[i][j] == 139) { dArch[i + 1][j] = 3; dArch[i + 2][j] = 4; } diff --git a/Source/drlg_l2.h b/Source/drlg_l2.h index 7abcefb23..657300547 100644 --- a/Source/drlg_l2.h +++ b/Source/drlg_l2.h @@ -3,11 +3,11 @@ #define __DRLG_L2_H__ extern int nSx1; -extern int nSx2; // weak +extern int nSx2; extern int nSy1; -extern int nSy2; // weak +extern int nSy2; extern int nRoomCnt; -extern unsigned char predungeon[DMAXX][DMAXX]; +extern BYTE predungeon[DMAXX][DMAXY]; extern ROOMNODE RoomList[81]; extern HALLNODE *pHallList; @@ -17,12 +17,12 @@ void L2DoorFix(); void LoadL2Dungeon(char *sFileName, int vx, int vy); void DRLG_L2Pass3(); void LoadPreL2Dungeon(char *sFileName, int vx, int vy); -void CreateL2Dungeon(unsigned int rseed, int entry); +void CreateL2Dungeon(int rseed, int entry); void DRLG_LoadL2SP(); void DRLG_FreeL2SP(); void DRLG_L2(int entry); -BOOL DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir); -void DRLG_L2PlaceRndSet(unsigned char *miniset, int rndper); +BOOL DRLG_L2PlaceMiniSet(BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir); +void DRLG_L2PlaceRndSet(BYTE *miniset, int rndper); void DRLG_L2Subs(); void DRLG_L2Shadows(); void DRLG_L2SetRoom(int rx1, int ry1); @@ -48,126 +48,126 @@ void L2DirtFix(); void DRLG_InitL2Vals(); /* rdata */ -extern int Area_Min; // weak -extern int Room_Max; // weak -extern int Room_Min; // weak +extern int Area_Min; +extern int Room_Max; +extern int Room_Min; extern int Dir_Xadd[5]; extern int Dir_Yadd[5]; extern ShadowStruct SPATSL2[2]; //short word_48489A; -extern unsigned char BTYPESL2[161]; -extern unsigned char BSTYPESL2[161]; -extern unsigned char VARCH1[]; -extern unsigned char VARCH2[]; -extern unsigned char VARCH3[]; -extern unsigned char VARCH4[]; -extern unsigned char VARCH5[]; -extern unsigned char VARCH6[]; -extern unsigned char VARCH7[]; -extern unsigned char VARCH8[]; -extern unsigned char VARCH9[]; -extern unsigned char VARCH10[]; -extern unsigned char VARCH11[]; -extern unsigned char VARCH12[]; -extern unsigned char VARCH13[]; -extern unsigned char VARCH14[]; -extern unsigned char VARCH15[]; -extern unsigned char VARCH16[]; -extern unsigned char VARCH17[]; -extern unsigned char VARCH18[]; -extern unsigned char VARCH19[]; -extern unsigned char VARCH20[]; -extern unsigned char VARCH21[]; -extern unsigned char VARCH22[]; -extern unsigned char VARCH23[]; -extern unsigned char VARCH24[]; -extern unsigned char VARCH25[]; -extern unsigned char VARCH26[]; -extern unsigned char VARCH27[]; -extern unsigned char VARCH28[]; -extern unsigned char VARCH29[]; -extern unsigned char VARCH30[]; -extern unsigned char VARCH31[]; -extern unsigned char VARCH32[]; -extern unsigned char VARCH33[]; -extern unsigned char VARCH34[]; -extern unsigned char VARCH35[]; -extern unsigned char VARCH36[]; -extern unsigned char VARCH37[]; -extern unsigned char VARCH38[]; -extern unsigned char VARCH39[]; -extern unsigned char VARCH40[]; -extern unsigned char HARCH1[]; -extern unsigned char HARCH2[]; -extern unsigned char HARCH3[]; -extern unsigned char HARCH4[]; -extern unsigned char HARCH5[]; -extern unsigned char HARCH6[]; -extern unsigned char HARCH7[]; -extern unsigned char HARCH8[]; -extern unsigned char HARCH9[]; -extern unsigned char HARCH10[]; -extern unsigned char HARCH11[]; -extern unsigned char HARCH12[]; -extern unsigned char HARCH13[]; -extern unsigned char HARCH14[]; -extern unsigned char HARCH15[]; -extern unsigned char HARCH16[]; -extern unsigned char HARCH17[]; -extern unsigned char HARCH18[]; -extern unsigned char HARCH19[]; -extern unsigned char HARCH20[]; -extern unsigned char HARCH21[]; -extern unsigned char HARCH22[]; -extern unsigned char HARCH23[]; -extern unsigned char HARCH24[]; -extern unsigned char HARCH25[]; -extern unsigned char HARCH26[]; -extern unsigned char HARCH27[]; -extern unsigned char HARCH28[]; -extern unsigned char HARCH29[]; -extern unsigned char HARCH30[]; -extern unsigned char HARCH31[]; -extern unsigned char HARCH32[]; -extern unsigned char HARCH33[]; -extern unsigned char HARCH34[]; -extern unsigned char HARCH35[]; -extern unsigned char HARCH36[]; -extern unsigned char HARCH37[]; -extern unsigned char HARCH38[]; -extern unsigned char HARCH39[]; -extern unsigned char HARCH40[]; -extern unsigned char USTAIRS[]; -extern unsigned char DSTAIRS[]; -extern unsigned char WARPSTAIRS[]; -extern unsigned char CRUSHCOL[]; -extern unsigned char BIG1[]; -extern unsigned char BIG2[]; -extern unsigned char BIG3[]; -extern unsigned char BIG4[]; -extern unsigned char BIG5[]; -extern unsigned char BIG6[]; -extern unsigned char BIG7[]; -extern unsigned char BIG8[]; -extern unsigned char BIG9[]; -extern unsigned char BIG10[]; -extern unsigned char RUINS1[]; -extern unsigned char RUINS2[]; -extern unsigned char RUINS3[]; -extern unsigned char RUINS4[]; -extern unsigned char RUINS5[]; -extern unsigned char RUINS6[]; -extern unsigned char RUINS7[]; -extern unsigned char PANCREAS1[]; -extern unsigned char PANCREAS2[]; -extern unsigned char CTRDOOR1[]; -extern unsigned char CTRDOOR2[]; -extern unsigned char CTRDOOR3[]; -extern unsigned char CTRDOOR4[]; -extern unsigned char CTRDOOR5[]; -extern unsigned char CTRDOOR6[]; -extern unsigned char CTRDOOR7[]; -extern unsigned char CTRDOOR8[]; +extern BYTE BTYPESL2[161]; +extern BYTE BSTYPESL2[161]; +extern BYTE VARCH1[]; +extern BYTE VARCH2[]; +extern BYTE VARCH3[]; +extern BYTE VARCH4[]; +extern BYTE VARCH5[]; +extern BYTE VARCH6[]; +extern BYTE VARCH7[]; +extern BYTE VARCH8[]; +extern BYTE VARCH9[]; +extern BYTE VARCH10[]; +extern BYTE VARCH11[]; +extern BYTE VARCH12[]; +extern BYTE VARCH13[]; +extern BYTE VARCH14[]; +extern BYTE VARCH15[]; +extern BYTE VARCH16[]; +extern BYTE VARCH17[]; +extern BYTE VARCH18[]; +extern BYTE VARCH19[]; +extern BYTE VARCH20[]; +extern BYTE VARCH21[]; +extern BYTE VARCH22[]; +extern BYTE VARCH23[]; +extern BYTE VARCH24[]; +extern BYTE VARCH25[]; +extern BYTE VARCH26[]; +extern BYTE VARCH27[]; +extern BYTE VARCH28[]; +extern BYTE VARCH29[]; +extern BYTE VARCH30[]; +extern BYTE VARCH31[]; +extern BYTE VARCH32[]; +extern BYTE VARCH33[]; +extern BYTE VARCH34[]; +extern BYTE VARCH35[]; +extern BYTE VARCH36[]; +extern BYTE VARCH37[]; +extern BYTE VARCH38[]; +extern BYTE VARCH39[]; +extern BYTE VARCH40[]; +extern BYTE HARCH1[]; +extern BYTE HARCH2[]; +extern BYTE HARCH3[]; +extern BYTE HARCH4[]; +extern BYTE HARCH5[]; +extern BYTE HARCH6[]; +extern BYTE HARCH7[]; +extern BYTE HARCH8[]; +extern BYTE HARCH9[]; +extern BYTE HARCH10[]; +extern BYTE HARCH11[]; +extern BYTE HARCH12[]; +extern BYTE HARCH13[]; +extern BYTE HARCH14[]; +extern BYTE HARCH15[]; +extern BYTE HARCH16[]; +extern BYTE HARCH17[]; +extern BYTE HARCH18[]; +extern BYTE HARCH19[]; +extern BYTE HARCH20[]; +extern BYTE HARCH21[]; +extern BYTE HARCH22[]; +extern BYTE HARCH23[]; +extern BYTE HARCH24[]; +extern BYTE HARCH25[]; +extern BYTE HARCH26[]; +extern BYTE HARCH27[]; +extern BYTE HARCH28[]; +extern BYTE HARCH29[]; +extern BYTE HARCH30[]; +extern BYTE HARCH31[]; +extern BYTE HARCH32[]; +extern BYTE HARCH33[]; +extern BYTE HARCH34[]; +extern BYTE HARCH35[]; +extern BYTE HARCH36[]; +extern BYTE HARCH37[]; +extern BYTE HARCH38[]; +extern BYTE HARCH39[]; +extern BYTE HARCH40[]; +extern BYTE USTAIRS[]; +extern BYTE DSTAIRS[]; +extern BYTE WARPSTAIRS[]; +extern BYTE CRUSHCOL[]; +extern BYTE BIG1[]; +extern BYTE BIG2[]; +extern BYTE BIG3[]; +extern BYTE BIG4[]; +extern BYTE BIG5[]; +extern BYTE BIG6[]; +extern BYTE BIG7[]; +extern BYTE BIG8[]; +extern BYTE BIG9[]; +extern BYTE BIG10[]; +extern BYTE RUINS1[]; +extern BYTE RUINS2[]; +extern BYTE RUINS3[]; +extern BYTE RUINS4[]; +extern BYTE RUINS5[]; +extern BYTE RUINS6[]; +extern BYTE RUINS7[]; +extern BYTE PANCREAS1[]; +extern BYTE PANCREAS2[]; +extern BYTE CTRDOOR1[]; +extern BYTE CTRDOOR2[]; +extern BYTE CTRDOOR3[]; +extern BYTE CTRDOOR4[]; +extern BYTE CTRDOOR5[]; +extern BYTE CTRDOOR6[]; +extern BYTE CTRDOOR7[]; +extern BYTE CTRDOOR8[]; extern int Patterns[100][10]; #endif /* __DRLG_L2_H__ */ diff --git a/Source/drlg_l3.h b/Source/drlg_l3.h index 5c5dedf58..47c2feb34 100644 --- a/Source/drlg_l3.h +++ b/Source/drlg_l3.h @@ -14,7 +14,7 @@ void FixL3Warp(); void FixL3HallofHeroes(); void DRLG_L3LockRec(int x, int y); BOOL DRLG_L3Lockout(); -void CreateL3Dungeon( int rseed, int entry); +void CreateL3Dungeon(int rseed, int entry); void DRLG_L3(int entry); void InitL3Dungeon(); BOOL DRLG_L3FillRoom(int x1, int y1, int x2, int y2); diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 0c70aa7a6..a9525e3b8 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1,26 +1,26 @@ #include "diablo.h" -int diabquad1x; // weak -int diabquad1y; // weak -int diabquad3x; // idb -int diabquad3y; // idb -int diabquad2x; // idb -int diabquad2y; // idb -int diabquad4x; // idb -int diabquad4y; // idb +int diabquad1x; +int diabquad1y; +int diabquad3x; +int diabquad3y; +int diabquad2x; +int diabquad2y; +int diabquad4x; +int diabquad4y; BOOL hallok[20]; -int l4holdx; // weak -int l4holdy; // weak -int SP4x1; // idb -int SP4x2; // weak -int SP4y1; // idb -int SP4y2; // weak -unsigned char L4dungeon[80][80]; -unsigned char dung[20][20]; +int l4holdx; +int l4holdy; +int SP4x1; +int SP4x2; +int SP4y1; +int SP4y2; +BYTE L4dungeon[80][80]; +BYTE dung[20][20]; //int dword_52A4DC; // weak -const unsigned char L4ConvTbl[16] = { 30u, 6u, 1u, 6u, 2u, 6u, 6u, 6u, 9u, 6u, 1u, 6u, 2u, 6u, 3u, 6u }; -const unsigned char L4USTAIRS[42] = { +const BYTE L4ConvTbl[16] = { 30u, 6u, 1u, 6u, 2u, 6u, 6u, 6u, 9u, 6u, 1u, 6u, 2u, 6u, 3u, 6u }; +const BYTE L4USTAIRS[42] = { 4u, 5u, 6u, @@ -64,7 +64,7 @@ const unsigned char L4USTAIRS[42] = { 0u, 0u }; -const unsigned char L4TWARP[42] = { +const BYTE L4TWARP[42] = { 4u, 5u, 6u, @@ -108,7 +108,7 @@ const unsigned char L4TWARP[42] = { 0u, 0u }; -const unsigned char L4DSTAIRS[52] = { +const BYTE L4DSTAIRS[52] = { 5u, 5u, 6u, @@ -162,7 +162,7 @@ const unsigned char L4DSTAIRS[52] = { 0u, 0u }; -const unsigned char L4PENTA[52] = { +const BYTE L4PENTA[52] = { 5u, 5u, 6u, @@ -216,7 +216,7 @@ const unsigned char L4PENTA[52] = { 0u, 0u }; -const unsigned char L4PENTA2[52] = { +const BYTE L4PENTA2[52] = { 5u, 5u, 6u, @@ -270,7 +270,7 @@ const unsigned char L4PENTA2[52] = { 0u, 0u }; -const unsigned char L4BTYPES[140] = { +const BYTE L4BTYPES[140] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -299,8 +299,6 @@ void DRLG_LoadL4SP() setloadflag_2 = 1; } } -// 5B50D8: using guessed type int setloadflag_2; -// 679660: using guessed type char gbMaxPlayers; void DRLG_FreeL4SP() { @@ -310,17 +308,17 @@ void DRLG_FreeL4SP() void DRLG_L4SetSPRoom(int rx1, int ry1) { int rw, rh, i, j; - unsigned char *sp; + BYTE *sp; - rw = (unsigned char)pSetPiece_2[0]; - rh = (unsigned char)pSetPiece_2[2]; + rw = (BYTE)pSetPiece_2[0]; + rh = (BYTE)pSetPiece_2[2]; setpc_x = rx1; setpc_y = ry1; setpc_w = rw; setpc_h = rh; - sp = (unsigned char *)&pSetPiece_2[4]; + sp = (BYTE *)&pSetPiece_2[4]; for (j = 0; j < rh; j++) { for (i = 0; i < rw; i++) { @@ -334,8 +332,6 @@ void DRLG_L4SetSPRoom(int rx1, int ry1) } } } -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void L4SaveQuads() { @@ -354,8 +350,6 @@ void L4SaveQuads() y++; } } -// 528A34: using guessed type int l4holdx; -// 528A38: using guessed type int l4holdy; void DRLG_L4SetRoom(BYTE *pSetPiece, int rx1, int ry1) { @@ -475,7 +469,7 @@ void DRLG_L4GeneralFix() } } -void CreateL4Dungeon(unsigned int rseed, int entry) +void CreateL4Dungeon(int rseed, int entry) { SetRndSeed(rseed); @@ -1678,7 +1672,7 @@ BOOL L4checkRoom(int x, int y, int width, int height) return TRUE; } -BOOL DRLG_L4PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) +BOOL DRLG_L4PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) { int sx, sy, sw, sh, xx, yy, i, ii, numt, bailcnt; BOOL found; diff --git a/Source/drlg_l4.h b/Source/drlg_l4.h index 76262ab0d..3277f1f28 100644 --- a/Source/drlg_l4.h +++ b/Source/drlg_l4.h @@ -2,21 +2,21 @@ #ifndef __DRLG_L4_H__ #define __DRLG_L4_H__ -extern int diabquad1x; // weak -extern int diabquad1y; // weak -extern int diabquad3x; // idb -extern int diabquad3y; // idb -extern int diabquad2x; // idb -extern int diabquad2y; // idb -extern int diabquad4x; // idb -extern int diabquad4y; // idb +extern int diabquad1x; +extern int diabquad1y; +extern int diabquad3x; +extern int diabquad3y; +extern int diabquad2x; +extern int diabquad2y; +extern int diabquad4x; +extern int diabquad4y; extern BOOL hallok[20]; -extern int l4holdx; // weak -extern int l4holdy; // weak -extern int SP4x1; // idb -extern int SP4x2; // weak -extern int SP4y1; // idb -extern int SP4y2; // weak +extern int l4holdx; +extern int l4holdy; +extern int SP4x1; +extern int SP4x2; +extern int SP4y1; +extern int SP4y2; extern unsigned char L4dungeon[80][80]; extern unsigned char dung[20][20]; //int dword_52A4DC; // weak @@ -25,13 +25,13 @@ void DRLG_LoadL4SP(); void DRLG_FreeL4SP(); void DRLG_L4SetSPRoom(int rx1, int ry1); void L4SaveQuads(); -void DRLG_L4SetRoom(unsigned char *pSetPiece, int rx1, int ry1); +void DRLG_L4SetRoom(BYTE *pSetPiece, int rx1, int ry1); void DRLG_LoadDiabQuads(BOOL preflag); BOOL IsDURWall(char d); BOOL IsDLLWall(char dd); void L4FixRim(); void DRLG_L4GeneralFix(); -void CreateL4Dungeon(unsigned int rseed, int entry); +void CreateL4Dungeon(int rseed, int entry); void DRLG_L4(int entry); void DRLG_L4Shadows(); void InitL4Dungeon(); diff --git a/Source/dx.cpp b/Source/dx.cpp index 471a69a72..75c6220ed 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -3,7 +3,7 @@ BYTE *sgpBackBuf; LPDIRECTDRAW lpDDInterface; -IDirectDrawPalette *lpDDPalette; // idb +IDirectDrawPalette *lpDDPalette; int sgdwLockCount; BYTE *gpBuffer; IDirectDrawSurface *lpDDSBackBuf; @@ -14,9 +14,9 @@ int locktbl[256]; #ifdef __cplusplus static CCritSect sgMemCrit; #endif -char gbBackBuf; // weak -char gbEmulate; // weak -HMODULE ghDiabMod; // idb +char gbBackBuf; +char gbEmulate; +HMODULE ghDiabMod; void dx_init(HWND hWnd) { @@ -33,11 +33,11 @@ void dx_init(HWND hWnd) ShowWindow(hWnd, SW_SHOWNORMAL); lpGUID = NULL; - if(gbEmulate) { + if (gbEmulate) { lpGUID = (GUID *)DDCREATE_EMULATIONONLY; } hDDVal = dx_DirectDrawCreate(lpGUID, &lpDDInterface, NULL); - if(hDDVal != DD_OK) { + if (hDDVal != DD_OK) { ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 149); } @@ -52,15 +52,15 @@ void dx_init(HWND hWnd) #ifndef _DEBUG fullscreen = TRUE; #endif - if(!fullscreen) { + if (!fullscreen) { #ifdef __cplusplus hDDVal = lpDDInterface->SetCooperativeLevel(hWnd, DDSCL_NORMAL | DDSCL_ALLOWREBOOT); #else hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_NORMAL | DDSCL_ALLOWREBOOT); #endif - if(hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) { + if (hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) { TriggerBreak(); - } else if(hDDVal != DD_OK) { + } else if (hDDVal != DD_OK) { ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Diablo\\Direct\\dx.cpp", 155); } SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); @@ -70,9 +70,9 @@ void dx_init(HWND hWnd) #else hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT | DDSCL_FULLSCREEN); #endif - if(hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) { + if (hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) { TriggerBreak(); - } else if(hDDVal != DD_OK) { + } else if (hDDVal != DD_OK) { ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 170); } #ifdef __cplusplus @@ -80,7 +80,7 @@ void dx_init(HWND hWnd) #else hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP); #endif - if(hDDVal != DD_OK) { + if (hDDVal != DD_OK) { winw = GetSystemMetrics(SM_CXSCREEN); winh = GetSystemMetrics(SM_CYSCREEN); #ifdef __cplusplus @@ -89,7 +89,7 @@ void dx_init(HWND hWnd) hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, winw, winh, SCREEN_BPP); #endif } - if(hDDVal != DD_OK) { + if (hDDVal != DD_OK) { ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 183); } } @@ -101,7 +101,6 @@ void dx_init(HWND hWnd) bSuccess = SDrawManualInitialize(hWnd, lpDDInterface, lpDDSPrimary, NULL, NULL, lpDDSBackBuf, lpDDPalette, NULL); /// ASSERT: assert(bSuccess); } -// 52A549: using guessed type char gbEmulate; void dx_create_back_buffer() { @@ -160,7 +159,6 @@ void dx_create_back_buffer() if (error_code != DD_OK) ErrDlg(IDD_DIALOG1, error_code, "C:\\Src\\Diablo\\Source\\dx.cpp", 96); } -// 52A548: using guessed type char gbBackBuf; void dx_create_primary_surface() { diff --git a/Source/dx.h b/Source/dx.h index bdf3dede1..6ba83e4dd 100644 --- a/Source/dx.h +++ b/Source/dx.h @@ -3,13 +3,13 @@ #define __DX_H__ extern IDirectDraw *lpDDInterface; -extern IDirectDrawPalette *lpDDPalette; // idb +extern IDirectDrawPalette *lpDDPalette; extern BYTE *gpBuffer; extern IDirectDrawSurface *lpDDSBackBuf; extern IDirectDrawSurface *lpDDSPrimary; -extern char gbBackBuf; // weak -extern char gbEmulate; // weak -extern HMODULE ghDiabMod; // idb +extern char gbBackBuf; +extern char gbEmulate; +extern HMODULE ghDiabMod; void dx_init(HWND hWnd); void dx_create_back_buffer(); @@ -25,6 +25,6 @@ void j_dx_reinit(); /* data */ -extern int dx_inf; // weak +extern int dx_inf; #endif /* __DX_H__ */ diff --git a/Source/gendung.cpp b/Source/gendung.cpp index f105ca11d..92ec97156 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -8,7 +8,7 @@ int dMonster[MAXDUNX][MAXDUNY]; BYTE dungeon[DMAXX][DMAXY]; char dObject[MAXDUNX][MAXDUNY]; BYTE *pSpeedCels; -int nlevel_frames; // weak +int nlevel_frames; char pdungeon[DMAXX][DMAXY]; char dDead[MAXDUNX][MAXDUNY]; MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; @@ -18,17 +18,17 @@ int MicroTileLen; char dflags[DMAXX][DMAXY]; int dPiece[MAXDUNX][MAXDUNY]; char dLight[MAXDUNX][MAXDUNY]; -int setloadflag_2; // weak +int setloadflag_2; int tile_defs[MAXTILES]; BYTE *pMegaTiles; BYTE *pLevelPieces; -int gnDifficulty; // idb +int gnDifficulty; char block_lvid[2049]; //char byte_5B78EB; char dTransVal[MAXDUNX][MAXDUNY]; BOOLEAN nTrapTable[2049]; BYTE leveltype; -unsigned char currlevel; // idb +BYTE currlevel; char TransList[256]; BOOLEAN nSolidTable[2049]; int level_frame_count[MAXTILES]; @@ -37,10 +37,10 @@ BYTE *pDungeonCels; int SpeedFrameTbl[128][16]; THEME_LOC themeLoc[MAXTHEMES]; char dPlayer[MAXDUNX][MAXDUNY]; -int dword_5C2FF8; // weak -int dword_5C2FFC; // weak -int scr_pix_width; // weak -int scr_pix_height; // weak +int dword_5C2FF8; +int dword_5C2FFC; +int scr_pix_width; +int scr_pix_height; char dArch[MAXDUNX][MAXDUNY]; char nBlockTable[2049]; BYTE *pSpecialCels; @@ -50,28 +50,28 @@ BYTE setlvlnum; int level_frame_sizes[MAXTILES]; char nMissileTable[2049]; char *pSetPiece_2; -char setlvltype; // weak +char setlvltype; BOOLEAN setlevel; -int LvlViewY; // weak -int LvlViewX; // weak -int dmaxx; // weak -int dmaxy; // weak -int setpc_h; // weak -int setpc_w; // weak -int setpc_x; // idb -int ViewX; // idb -int ViewY; // idb -int setpc_y; // idb +int LvlViewY; +int LvlViewX; +int dmaxx; +int dmaxy; +int setpc_h; +int setpc_w; +int setpc_x; +int ViewX; +int ViewY; +int setpc_y; char dMissile[MAXDUNX][MAXDUNY]; -int dminx; // weak -int dminy; // weak +int dminx; +int dminy; MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; void FillSolidBlockTbls() { - unsigned char bv; - unsigned int dwTiles; - unsigned char *pSBFile, *pTmp; + BYTE bv; + DWORD dwTiles; + BYTE *pSBFile, *pTmp; int i; memset(nBlockTable, 0, sizeof(nBlockTable)); @@ -445,8 +445,6 @@ void MakeSpeedCels() } } } -// 525728: using guessed type int light4flag; -// 53CD4C: using guessed type int nlevel_frames; void SortTiles(int frames) { @@ -553,11 +551,6 @@ void SetDungeonMicros() dword_5C2FFC = 7; } } -// 52569C: using guessed type int zoomflag; -// 5C2FF8: using guessed type int dword_5C2FF8; -// 5C2FFC: using guessed type int dword_5C2FFC; -// 5C3000: using guessed type int scr_pix_width; -// 5C3004: using guessed type int scr_pix_height; void DRLG_InitTrans() { @@ -565,7 +558,6 @@ void DRLG_InitTrans() memset(TransList, 0, sizeof(TransList)); TransVal = 1; } -// 5A5590: using guessed type char TransVal; void DRLG_MRectTrans(int x1, int y1, int x2, int y2) { @@ -584,7 +576,6 @@ void DRLG_MRectTrans(int x1, int y1, int x2, int y2) TransVal++; } -// 5A5590: using guessed type char TransVal; void DRLG_RectTrans(int x1, int y1, int x2, int y2) { @@ -597,17 +588,16 @@ void DRLG_RectTrans(int x1, int y1, int x2, int y2) } TransVal++; } -// 5A5590: using guessed type char TransVal; void DRLG_CopyTrans(int sx, int sy, int dx, int dy) { dTransVal[dx][dy] = dTransVal[sx][sy]; } -void DRLG_ListTrans(int num, unsigned char *List) +void DRLG_ListTrans(int num, BYTE *List) { int i; - unsigned char x1, x2, y1, y2; + BYTE x1, x2, y1, y2; for (i = 0; i < num; i++) { x1 = *List++; @@ -618,10 +608,10 @@ void DRLG_ListTrans(int num, unsigned char *List) } } -void DRLG_AreaTrans(int num, unsigned char *List) +void DRLG_AreaTrans(int num, BYTE *List) { int i; - unsigned char x1, x2, y1, y2; + BYTE x1, x2, y1, y2; for (i = 0; i < num; i++) { x1 = *List++; @@ -633,7 +623,6 @@ void DRLG_AreaTrans(int num, unsigned char *List) } ++TransVal; } -// 5A5590: using guessed type char TransVal; void DRLG_InitSetPC() { @@ -642,8 +631,6 @@ void DRLG_InitSetPC() setpc_w = 0; setpc_h = 0; } -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void DRLG_SetPC() { @@ -660,8 +647,6 @@ void DRLG_SetPC() } } } -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void Make_SetPC(int x, int y, int w, int h) { @@ -762,8 +747,6 @@ BOOL DRLG_WillThemeRoomFit(int floor, int x, int y, int minSize, int maxSize, in *height = ySmallest - 2; return TRUE; } -// 41965B: using guessed type int var_6C[20]; -// 41965B: using guessed type int var_BC[20]; void DRLG_CreateThemeRoom(int themeIndex) { @@ -969,5 +952,3 @@ void InitLevels() setlevel = 0; } } -// 52572C: using guessed type int leveldebug; -// 5CF31D: using guessed type char setlevel; diff --git a/Source/gendung.h b/Source/gendung.h index e2c4afe9f..ff7d8948f 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -10,27 +10,27 @@ extern int dMonster[MAXDUNX][MAXDUNY]; extern BYTE dungeon[DMAXX][DMAXY]; extern char dObject[MAXDUNX][MAXDUNY]; extern BYTE *pSpeedCels; -extern int nlevel_frames; // weak +extern int nlevel_frames; extern char pdungeon[DMAXX][DMAXY]; extern char dDead[MAXDUNX][MAXDUNY]; extern MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; extern char dPreLight[MAXDUNX][MAXDUNY]; -extern char TransVal; // weak +extern char TransVal; extern int MicroTileLen; extern char dflags[DMAXX][DMAXY]; extern int dPiece[MAXDUNX][MAXDUNY]; extern char dLight[MAXDUNX][MAXDUNY]; -extern int setloadflag_2; // weak +extern int setloadflag_2; extern int tile_defs[MAXTILES]; extern BYTE *pMegaTiles; extern BYTE *pLevelPieces; -extern int gnDifficulty; // idb +extern int gnDifficulty; extern char block_lvid[2049]; //char byte_5B78EB; extern char dTransVal[MAXDUNX][MAXDUNY]; extern BOOLEAN nTrapTable[2049]; extern BYTE leveltype; -extern unsigned char currlevel; // idb +extern unsigned char currlevel; extern char TransList[256]; extern BOOLEAN nSolidTable[2049]; extern int level_frame_count[MAXTILES]; @@ -39,10 +39,10 @@ extern BYTE *pDungeonCels; extern int SpeedFrameTbl[128][16]; extern THEME_LOC themeLoc[MAXTHEMES]; extern char dPlayer[MAXDUNX][MAXDUNY]; -extern int dword_5C2FF8; // weak -extern int dword_5C2FFC; // weak -extern int scr_pix_width; // weak -extern int scr_pix_height; // weak +extern int dword_5C2FF8; +extern int dword_5C2FFC; +extern int scr_pix_width; +extern int scr_pix_height; extern char dArch[MAXDUNX][MAXDUNY]; extern char nBlockTable[2049]; extern BYTE *pSpecialCels; @@ -52,21 +52,21 @@ extern BYTE setlvlnum; extern int level_frame_sizes[MAXTILES]; extern char nMissileTable[2049]; extern char *pSetPiece_2; -extern char setlvltype; // weak +extern char setlvltype; extern BOOLEAN setlevel; -extern int LvlViewY; // weak -extern int LvlViewX; // weak -extern int dmaxx; // weak -extern int dmaxy; // weak -extern int setpc_h; // weak -extern int setpc_w; // weak -extern int setpc_x; // idb -extern int ViewX; // idb -extern int ViewY; // idb -extern int setpc_y; // idb +extern int LvlViewY; +extern int LvlViewX; +extern int dmaxx; +extern int dmaxy; +extern int setpc_h; +extern int setpc_w; +extern int setpc_x; +extern int ViewX; +extern int ViewY; +extern int setpc_y; extern char dMissile[MAXDUNX][MAXDUNY]; -extern int dminx; // weak -extern int dminy; // weak +extern int dminx; +extern int dminy; extern MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; void FillSolidBlockTbls(); diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 1c1f6c26e..7bde72a7b 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -13,7 +13,7 @@ BYTE *option_cel; BYTE *sgpLogo; int sgCurrentMenuIdx; -const unsigned char lfontframe[127] = { +const BYTE lfontframe[127] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -28,7 +28,7 @@ const unsigned char lfontframe[127] = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 20, 0, 21, 0 }; -const unsigned char lfontkern[56] = { +const BYTE lfontkern[56] = { 18, 33, 21, 26, 28, 19, 19, 26, 25, 11, 12, 25, 19, 34, 28, 32, 20, 32, 28, 20, 28, 36, 35, 46, 33, 33, 24, 11, 23, 22, diff --git a/Source/gmenu.h b/Source/gmenu.h index 4a0c2ca44..c4ac6da3f 100644 --- a/Source/gmenu.h +++ b/Source/gmenu.h @@ -3,22 +3,22 @@ #define __GMENU_H__ extern BYTE *optbar_cel; -extern BOOLEAN mouseNavigation; // weak +extern BOOLEAN mouseNavigation; extern BYTE *PentSpin_cel; extern BYTE *BigTGold_cel; -extern int dword_634474; // weak -extern char byte_634478; // weak -extern void(*dword_63447C)(TMenuItem *); -extern TMenuItem *sgpCurrentMenu; // idb +extern int dword_634474; +extern char byte_634478; +extern void (*dword_63447C)(TMenuItem *); +extern TMenuItem *sgpCurrentMenu; extern BYTE *option_cel; -extern int sgCurrentMenuIdx; // weak +extern int sgCurrentMenuIdx; void gmenu_draw_pause(); void gmenu_print_text(int x, int y, char *pszStr); void FreeGMenu(); void gmenu_init_menu(); BOOL gmenu_exception(); -void gmenu_call_proc(TMenuItem *pItem, void(*gmFunc)(TMenuItem *)); +void gmenu_call_proc(TMenuItem *pItem, void (*gmFunc)(TMenuItem *)); void gmenu_up_down(BOOL isDown); void gmenu_draw(); void gmenu_draw_menu_item(TMenuItem *pItem, int a2); @@ -36,7 +36,7 @@ void gmenu_slider_steps(TMenuItem *pItem, int dwTicks); /* rdata */ -extern const unsigned char lfontframe[127]; -extern const unsigned char lfontkern[56]; +extern const BYTE lfontframe[127]; +extern const BYTE lfontkern[56]; #endif /* __GMENU_H__ */ diff --git a/Source/init.cpp b/Source/init.cpp index b1aab02b7..50e9afa02 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -3,7 +3,7 @@ #include "../DiabloUI/diabloui.h" _SNETVERSIONDATA fileinfo; -int gbActive; // weak +int gbActive; char diablo_exe_path[MAX_PATH]; HANDLE unused_mpq; char patch_rt_mpq_path[MAX_PATH]; @@ -11,7 +11,7 @@ WNDPROC CurrentProc; HANDLE diabdat_mpq; char diabdat_mpq_path[MAX_PATH]; HANDLE patch_rt_mpq; -BOOL killed_mom_parent; // weak +BOOL killed_mom_parent; BOOLEAN screensaver_enabled_prev; /* data */ @@ -67,7 +67,6 @@ void init_run_office_from_start_menu() init_run_office(szPath); } } -// 634CA0: using guessed type int killed_mom_parent; void init_run_office(char *dir) { @@ -189,7 +188,6 @@ void init_kill_mom_parent() killed_mom_parent = TRUE; } } -// 634CA0: using guessed type int killed_mom_parent; HWND init_find_mom_parent() { @@ -415,7 +413,6 @@ LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) return DefWindowProc(hWnd, Msg, wParam, lParam); } -// 52571C: using guessed type int drawpanflag; void init_activate_window(HWND hWnd, BOOL bActive) { @@ -437,8 +434,6 @@ void init_activate_window(HWND hWnd, BOOL bActive) ResetPal(); } } -// 52571C: using guessed type int drawpanflag; -// 634980: using guessed type int gbActive; LRESULT __stdcall WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { diff --git a/Source/inv.cpp b/Source/inv.cpp index 8cd52e66f..b089a7346 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -86,7 +86,7 @@ const InvXY InvRect[73] = { /* data */ -int AP2x2Tbl[10] = { 8, 28, 6, 26, 4, 24, 2, 22, 0, 20 }; // weak +int AP2x2Tbl[10] = { 8, 28, 6, 26, 4, 24, 2, 22, 0, 20 }; void FreeInvGFX() { @@ -407,10 +407,6 @@ void DrawInv() } } } -// 4B8CB8: using guessed type char pcursinvitem; -// 69BEF8: using guessed type int light_table_index; -// 69CF94: using guessed type int cel_transparency_active; -// 41B8C4: using guessed type int var_A0[40]; void DrawInvBelt() { @@ -455,8 +451,6 @@ void DrawInvBelt() } } } -// 4B8960: using guessed type int talkflag; -// 4B8CB8: using guessed type char pcursinvitem; BOOL AutoPlace(int pnum, int ii, int sx, int sy, BOOL saveflag) { @@ -1464,7 +1458,6 @@ void CheckQuestItem(int pnum) } } } -// 52A554: using guessed type int sfxdelay; void InvGetItem(int pnum, int ii) { @@ -1497,7 +1490,6 @@ void InvGetItem(int pnum, int ii) SetCursor_(plr[pnum].HoldItem._iCurs + CURSOR_FIRSTITEM); } } -// 4B8CC0: using guessed type char pcursitem; void AutoGetItem(int pnum, int ii) { @@ -1628,7 +1620,6 @@ void AutoGetItem(int pnum, int ii) plr[pnum].HoldItem._itype = ITYPE_NONE; } } -// 48E9A8: using guessed type int AP2x2Tbl[10]; int FindGetItem(int indx, WORD ci, int iseed) { @@ -1991,7 +1982,6 @@ char CheckInvHLight() return rv; } -// 4B883C: using guessed type int infoclr; void RemoveScroll(int pnum) { @@ -2081,8 +2071,6 @@ void StartGoldDrop() if (talkflag) control_reset_talk(); } -// 4B8960: using guessed type int talkflag; -// 4B8CB8: using guessed type char pcursinvitem; BOOL UseInvItem(int pnum, int cii) { @@ -2181,9 +2169,6 @@ BOOL UseInvItem(int pnum, int cii) return TRUE; } -// 4B8960: using guessed type int talkflag; -// 52A554: using guessed type int sfxdelay; -// 6AA705: using guessed type char stextflag; void DoTelekinesis() { @@ -2195,8 +2180,6 @@ void DoTelekinesis() NetSendCmdParam1(TRUE, CMD_KNOCKBACK, pcursmonst); SetCursor_(CURSOR_HAND); } -// 4B8CC0: using guessed type char pcursitem; -// 4B8CC1: using guessed type char pcursobj; int CalculateGold(int pnum) { @@ -2216,7 +2199,6 @@ int CalculateGold(int pnum) return gold; } -// 52571C: using guessed type int drawpanflag; BOOL DropItemBeforeTrig() { diff --git a/Source/inv.h b/Source/inv.h index 1c79e9b12..e6cb91851 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -48,6 +48,6 @@ BOOL DropItemBeforeTrig(); /* data */ -extern int AP2x2Tbl[10]; // weak +extern int AP2x2Tbl[10]; #endif /* __INV_H__ */ diff --git a/Source/items.cpp b/Source/items.cpp index b2e82f42c..daf14d382 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -7,14 +7,14 @@ ItemStruct curruitem; ItemGetRecordStruct itemrecord[MAXITEMS]; ItemStruct item[MAXITEMS + 1]; BOOL itemhold[3][3]; -unsigned char *itemanims[35]; +BYTE *itemanims[35]; BOOL UniqueItemFlag[128]; int numitems; int gnNumGetRecords; /* data */ -unsigned char ItemCAnimTbl[169] = { +BYTE ItemCAnimTbl[169] = { 20, 16, 16, 16, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 21, 21, 25, 12, 28, 28, 28, 0, 0, 0, 32, 0, 0, 0, 24, @@ -70,7 +70,7 @@ char *ItemDropStrs[35] = { "Fanvil", "FLazStaf" }; -unsigned char ItemAnimLs[35] = { +BYTE ItemAnimLs[35] = { 15u, 13u, 16u, @@ -181,7 +181,7 @@ int ItemInvSnds[35] = { IS_IANVL, IS_ISTAF }; -int idoppely = 16; // weak +int idoppely = 16; int premiumlvladd[6] = { -1, -1, 0, 0, 1, 2 }; void InitItemGFX() @@ -1733,7 +1733,6 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood) if (preidx != -1 || sufidx != -1) CalcItemValue(i); } -// 4215EF: using guessed type int var_494[256]; void GetItemBonus(int i, int idata, int minlvl, int maxlvl, int onlygood) { @@ -2218,7 +2217,7 @@ void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL send } } -void RecreateItem(int ii, int idx, unsigned short ic, int iseed, int ivalue) +void RecreateItem(int ii, int idx, WORD ic, int iseed, int ivalue) { int uper, onlygood, recreate, pregen; @@ -2263,7 +2262,7 @@ void RecreateItem(int ii, int idx, unsigned short ic, int iseed, int ivalue) } } -void RecreateEar(int ii, unsigned short ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff) +void RecreateEar(int ii, WORD ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff) { SetPlrHandItem(&item[ii], IDI_EAR); tempstr[0] = (ic >> 8) & 0x7F; @@ -3863,7 +3862,7 @@ void RecreateHealerItem(int ii, int idx, int lvl, int iseed) item[ii]._iIdentified = TRUE; } -void RecreateTownItem(int ii, int idx, unsigned short icreateinfo, int iseed, int ivalue) +void RecreateTownItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue) { if (icreateinfo & 0x400) RecreateSmithItem(ii, idx, icreateinfo & 0x3F, iseed); diff --git a/Source/items.h b/Source/items.h index 5010cd9a8..0822c8ff0 100644 --- a/Source/items.h +++ b/Source/items.h @@ -9,7 +9,7 @@ extern ItemStruct curruitem; extern ItemGetRecordStruct itemrecord[MAXITEMS]; extern ItemStruct item[MAXITEMS + 1]; extern BOOL itemhold[3][3]; -extern unsigned char *itemanims[35]; +extern BYTE *itemanims[35]; extern BOOL UniqueItemFlag[128]; extern int numitems; extern int gnNumGetRecords; @@ -62,8 +62,8 @@ void CreateRndItem(int x, int y, BOOL onlygood, BOOL sendmsg, int delta); void SetupAllUseful(int ii, int iseed, int lvl); void CreateRndUseful(int pnum, int x, int y, BOOL sendmsg); void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL sendmsg, int delta); -void RecreateItem(int ii, int idx, unsigned short ic, int iseed, int ivalue); -void RecreateEar(int ii, unsigned short ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff); +void RecreateItem(int ii, int idx, WORD ic, int iseed, int ivalue); +void RecreateEar(int ii, WORD ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff); void SpawnQuestItem(int itemid, int x, int y, int randarea, int selflag); void SpawnRock(); void RespawnItem(int i, BOOL FlipFlag); @@ -115,7 +115,7 @@ void RecreatePremiumItem(int ii, int idx, int lvl, int iseed); void RecreateBoyItem(int ii, int idx, int lvl, int iseed); void RecreateWitchItem(int ii, int idx, int lvl, int iseed); void RecreateHealerItem(int ii, int idx, int lvl, int iseed); -void RecreateTownItem(int ii, int idx, unsigned short icreateinfo, int iseed, int ivalue); +void RecreateTownItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue); void RecalcStoreStats(); int ItemNoFlippy(); void CreateSpellBook(int x, int y, int ispell, BOOL sendmsg, int delta); @@ -128,12 +128,12 @@ void PutItemRecord(int nSeed, WORD wCI, int nIndex); /* data */ -extern unsigned char ItemCAnimTbl[169]; +extern BYTE ItemCAnimTbl[169]; extern char *ItemDropStrs[35]; -extern unsigned char ItemAnimLs[35]; +extern BYTE ItemAnimLs[35]; extern int ItemDropSnds[35]; extern int ItemInvSnds[35]; -extern int idoppely; // weak +extern int idoppely; extern int premiumlvladd[6]; #endif /* __ITEMS_H__ */ diff --git a/Source/logging.cpp b/Source/logging.cpp index 335d095de..1cbb94abb 100644 --- a/Source/logging.cpp +++ b/Source/logging.cpp @@ -4,10 +4,10 @@ #ifdef __cplusplus static CCritSect sgMemCrit; #endif -CHAR FileName[MAX_PATH]; // idb +CHAR FileName[MAX_PATH]; char log_buffer[388]; -LPCVOID lpAddress; // idb -DWORD nNumberOfBytesToWrite; // idb +LPCVOID lpAddress; +DWORD nNumberOfBytesToWrite; /* data */ @@ -93,7 +93,6 @@ HANDLE log_create() log_not_created = FALSE; return fh; } -// 4947D4: using guessed type int log_not_created; void log_get_version(VS_FIXEDFILEINFO *file_info) { @@ -155,10 +154,10 @@ void __cdecl log_printf(const char *pszFmt, ...) void log_dump_computer_info() { - char Buffer[64]; // [esp+0h] [ebp-88h] - VS_FIXEDFILEINFO file_info; // [esp+40h] [ebp-48h] - SYSTEMTIME SystemTime; // [esp+74h] [ebp-14h] - DWORD pcbBuffer; // [esp+84h] [ebp-4h] + char Buffer[64]; + VS_FIXEDFILEINFO file_info; + SYSTEMTIME SystemTime; + DWORD pcbBuffer; GetLocalTime(&SystemTime); pcbBuffer = 64; diff --git a/Source/logging.h b/Source/logging.h index de6289aea..e562eb84f 100644 --- a/Source/logging.h +++ b/Source/logging.h @@ -2,24 +2,24 @@ #ifndef __LOGGING_H__ #define __LOGGING_H__ -extern CHAR FileName[MAX_PATH]; // idb +extern CHAR FileName[MAX_PATH]; extern char log_buffer[388]; -extern LPCVOID lpAddress; // idb -extern DWORD nNumberOfBytesToWrite; // idb +extern LPCVOID lpAddress; +extern DWORD nNumberOfBytesToWrite; void __cdecl log_flush(BOOL force_close); -HANDLE log_create(); // should be HANDLE +HANDLE log_create(); void log_get_version(VS_FIXEDFILEINFO *file_info); void __cdecl log_printf(const char *pszFmt, ...); // LogMessage void log_dump_computer_info(); /* rdata */ -extern const int log_inf; // weak +extern const int log_inf; /* data */ -extern int log_not_created; // weak -extern HANDLE log_file; // idb +extern int log_not_created; +extern HANDLE log_file; #endif /* __LOGGING_H__ */ diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 23a44ee32..e2c6db6ec 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -1,11 +1,11 @@ #include "diablo.h" -int qtexty; // weak +int qtexty; char *qtextptr; -int qtextSpd; // weak -char qtextflag; // weak -int scrolltexty; // weak -int sgLastScroll; // weak +int qtextSpd; +char qtextflag; +int scrolltexty; +int sgLastScroll; void *pMedTextCels; void *pTextBoxCels; @@ -49,7 +49,6 @@ void InitQuestText() pTextBoxCels = LoadFileInMem("Data\\TextBox.CEL", 0); qtextflag = FALSE; } -// 646D00: using guessed type char qtextflag; void InitQTextMsg(int m) { @@ -64,11 +63,6 @@ void InitQTextMsg(int m) } PlaySFX(alltext[m].sfxnr); } -// 646CF4: using guessed type int qtexty; -// 646CFC: using guessed type int qtextSpd; -// 646D00: using guessed type char qtextflag; -// 646D04: using guessed type int scrolltexty; -// 646D08: using guessed type int sgLastScroll; void DrawQTextBack() { @@ -289,9 +283,3 @@ void DrawQText() } } } -// 646CF4: using guessed type int qtexty; -// 646CFC: using guessed type int qtextSpd; -// 646D00: using guessed type char qtextflag; -// 646D04: using guessed type int scrolltexty; -// 646D08: using guessed type int sgLastScroll; -// 428202: using guessed type char qstr[128]; diff --git a/Source/minitext.h b/Source/minitext.h index 0e1499814..e83883d3e 100644 --- a/Source/minitext.h +++ b/Source/minitext.h @@ -2,11 +2,11 @@ #ifndef __MINITEXT_H__ #define __MINITEXT_H__ -extern int qtexty; // weak +extern int qtexty; extern char *qtextptr; -extern int qtextSpd; // weak -extern char qtextflag; // weak -extern int scrolltexty; // weak +extern int qtextSpd; +extern char qtextflag; +extern int scrolltexty; extern void *pMedTextCels; extern void *pTextBoxCels; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 296b4a960..d3beb9a6e 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -3,11 +3,11 @@ int missileactive[MAXMISSILES]; int missileavail[MAXMISSILES]; MissileStruct missile[MAXMISSILES]; -int nummissiles; // idb +int nummissiles; int ManashieldFlag; ChainStruct chain[MAXMISSILES]; -int MissilePreFlag; // weak -int numchains; // weak +int MissilePreFlag; +int numchains; int XDirAdd[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; int YDirAdd[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; @@ -20,30 +20,30 @@ void GetDamageAmt(int i, int *mind, int *maxd) /// ASSERT: assert((DWORD)i < 64); sl = plr[myplr]._pSplLvl[i] + plr[myplr]._pISplLvlAdd; - switch(i) { + switch (i) { case SPL_FIREBOLT: *mind = (plr[myplr]._pMagic >> 3) + sl + 1; *maxd = (plr[myplr]._pMagic >> 3) + sl + 10; break; case SPL_HEAL: /// BUGFIX: healing calculation is unused *mind = plr[myplr]._pLevel + sl + 1; - if(plr[myplr]._pClass == PC_WARRIOR) { + if (plr[myplr]._pClass == PC_WARRIOR) { *mind *= 2; } - if(plr[myplr]._pClass == PC_ROGUE) { + if (plr[myplr]._pClass == PC_ROGUE) { *mind += *mind >> 1; } *maxd = 10; - for(k = 0; k < plr[myplr]._pLevel; k++) { + for (k = 0; k < plr[myplr]._pLevel; k++) { *maxd += 4; } - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += 6; } - if(plr[myplr]._pClass == PC_WARRIOR) { + if (plr[myplr]._pClass == PC_WARRIOR) { *maxd *= 2; } - if(plr[myplr]._pClass == PC_ROGUE) { + if (plr[myplr]._pClass == PC_ROGUE) { *maxd += *maxd >> 1; } *mind = -1; @@ -55,7 +55,7 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_FLASH: *mind = plr[myplr]._pLevel; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } *mind += *mind >> 1; @@ -88,21 +88,21 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_FIREBALL: *mind = 2 * plr[myplr]._pLevel + 4; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } *maxd = 2 * plr[myplr]._pLevel + 40; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += *maxd >> 3; } break; case SPL_GUARDIAN: *mind = (plr[myplr]._pLevel >> 1) + 1; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } *maxd = (plr[myplr]._pLevel >> 1) + 10; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += *maxd >> 3; } break; @@ -116,12 +116,12 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_NOVA: *mind = (plr[myplr]._pLevel + 5) >> 1; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } *mind *= 5; *maxd = (plr[myplr]._pLevel + 30) >> 1; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += *maxd >> 3; } *maxd *= 5; @@ -137,22 +137,22 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_APOCA: *mind = 0; - for(k = 0; k < plr[myplr]._pLevel; k++) { + for (k = 0; k < plr[myplr]._pLevel; k++) { *mind += 1; } *maxd = 0; - for(k = 0; k < plr[myplr]._pLevel; k++) { + for (k = 0; k < plr[myplr]._pLevel; k++) { *maxd += 6; } break; case SPL_ELEMENT: *mind = 2 * plr[myplr]._pLevel + 4; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } /// BUGFIX: add here '*mind >>= 1;' *maxd = 2 * plr[myplr]._pLevel + 40; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += *maxd >> 3; } /// BUGFIX: add here '*maxd >>= 1;' @@ -167,23 +167,23 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_HEALOTHER: /// BUGFIX: healing calculation is unused *mind = plr[myplr]._pLevel + sl + 1; - if(plr[myplr]._pClass == PC_WARRIOR) { + if (plr[myplr]._pClass == PC_WARRIOR) { *mind *= 2; } - if(plr[myplr]._pClass == PC_ROGUE) { + if (plr[myplr]._pClass == PC_ROGUE) { *mind += *mind >> 1; } *maxd = 10; - for(k = 0; k < plr[myplr]._pLevel; k++) { + for (k = 0; k < plr[myplr]._pLevel; k++) { *maxd += 4; } - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += 6; } - if(plr[myplr]._pClass == PC_WARRIOR) { + if (plr[myplr]._pClass == PC_WARRIOR) { *maxd *= 2; } - if(plr[myplr]._pClass == PC_ROGUE) { + if (plr[myplr]._pClass == PC_ROGUE) { *maxd += *maxd >> 1; } *mind = -1; @@ -223,7 +223,7 @@ int FindClosest(int sx, int sy, int rad) for (i = 1; i < rad; i++) { cr = CrawlNum[i] + 2; - for (j = (unsigned char)CrawlTable[CrawlNum[i]]; j > 0; j--) { + for (j = (BYTE)CrawlTable[CrawlNum[i]]; j > 0; j--) { tx = sx + CrawlTable[cr - 1]; ty = sy + CrawlTable[cr]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { @@ -254,7 +254,7 @@ int GetSpellLevel(int id, int sn) int GetDirection8(int x1, int y1, int x2, int y2) { - unsigned char Dirs[16][16] = { + BYTE Dirs[16][16] = { { 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -274,9 +274,9 @@ int GetDirection8(int x1, int y1, int x2, int y2) }; int mx, my, md; ALIGN_BY_1 BYTE urtoll[] = { 3, 4, 5 }, - ultolr[] = { 3, 2, 1 }, - lrtoul[] = { 7, 6, 5 }, - lltour[] = { 7, 0, 1 }; + ultolr[] = { 3, 2, 1 }, + lrtoul[] = { 7, 6, 5 }, + lltour[] = { 7, 0, 1 }; mx = abs(x2 - x1); if (mx > 15) @@ -393,7 +393,6 @@ void PutMissile(int i) MissilePreFlag = 1; } } -// 64CCD4: using guessed type int MissilePreFlag; void GetMissilePos(int i) { @@ -803,7 +802,7 @@ BOOL PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, BOOLEA if (plr[pnum]._pHitPoints >> 6 <= 0) { SyncPlrKill(pnum, earflag); - } else{ + } else { if (plr[pnum]._pClass == PC_WARRIOR) { PlaySfxLoc(PS_WARR69, plr[pnum].WorldX, plr[pnum].WorldY); } else if (plr[pnum]._pClass == PC_ROGUE) { @@ -812,15 +811,15 @@ BOOL PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, BOOLEA PlaySfxLoc(PS_MAGE69, plr[pnum].WorldX, plr[pnum].WorldY); } drawhpflag = TRUE; - } + } } else { if (blk < blkper) { if (m != -1) { tac = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, monster[m]._mx, monster[m]._my); - } else { + } else { tac = plr[pnum]._pdir; - } - StartPlrBlock(pnum, tac); + } + StartPlrBlock(pnum, tac); } else { if (pnum == myplr) { plr[pnum]._pHitPoints -= dam; @@ -1207,7 +1206,6 @@ void InitMissiles() } } } -// 64CCD8: using guessed type int numchains; void AddLArrow(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -1316,7 +1314,6 @@ void AddRndTeleport(int mi, int sx, int sy, int dx, int dy, int midir, char mien } } } -// 5CF31D: using guessed type char setlevel; void AddFirebolt(int mi, int sx, int sy, int dx, int dy, int midir, char micaster, int id, int dam) { @@ -1382,7 +1379,7 @@ void AddTeleport(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy for (i = 0; i < 6; i++) { k = CrawlNum[i]; pn = k + 2; - for (j = (unsigned char)CrawlTable[k]; j > 0; j--) { + for (j = (BYTE)CrawlTable[k]; j > 0; j--) { tx = dx + CrawlTable[pn - 1]; ty = dy + CrawlTable[pn]; if (0 < tx && tx < MAXDUNX && 0 < ty && ty < MAXDUNY) { @@ -1570,11 +1567,11 @@ void AddTown(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, in missile[mi]._miDelFlag = TRUE; for (j = 0; j < 6; j++) { k = CrawlNum[j] + 2; - for (i = (unsigned char)CrawlTable[CrawlNum[j]]; i > 0; i--) { + for (i = (BYTE)CrawlTable[CrawlNum[j]]; i > 0; i--) { tx = dx + CrawlTable[k - 1]; ty = dy + CrawlTable[k]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { - if (!(dObject[tx][ty] | dPlayer[tx][ty] | dMissile[tx][ty] | nSolidTable[dPiece[tx][ty]] | (unsigned char)nMissileTable[dPiece[tx][ty]])) { + if (!(dObject[tx][ty] | dPlayer[tx][ty] | dMissile[tx][ty] | nSolidTable[dPiece[tx][ty]] | (BYTE)nMissileTable[dPiece[tx][ty]])) { if (!CheckIfTrig(tx, ty)) { missile[mi]._miDelFlag = FALSE; missile[mi]._mix = tx; @@ -1614,7 +1611,6 @@ void AddTown(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, in } } } -// 5CF31D: using guessed type char setlevel; void AddFlash(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -1701,13 +1697,13 @@ void AddGuardian(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy for (i = 0; i < 6; i++) { pn = CrawlNum[i]; k = pn + 2; - for (j = (unsigned char)CrawlTable[pn]; j > 0; j--) { + for (j = (BYTE)CrawlTable[pn]; j > 0; j--) { tx = dx + CrawlTable[k - 1]; ty = dy + CrawlTable[k]; pn = dPiece[tx][ty]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { if (LineClear(sx, sy, tx, ty)) { - if (!(dMonster[tx][ty] | dObject[tx][ty] | dMissile[tx][ty] | nSolidTable[pn] | (unsigned char)nMissileTable[pn])) { + if (!(dMonster[tx][ty] | dObject[tx][ty] | dMissile[tx][ty] | nSolidTable[pn] | (BYTE)nMissileTable[pn])) { missile[mi]._miDelFlag = FALSE; missile[mi]._mix = tx; missile[mi]._miy = ty; @@ -1914,7 +1910,7 @@ void AddStone(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, i for (i = 0; i < 6; i++) { k = CrawlNum[i]; l = k + 2; - for (j = (unsigned char)CrawlTable[k]; j > 0; j--) { + for (j = (BYTE)CrawlTable[k]; j > 0; j--) { tx = dx + CrawlTable[l - 1]; ty = dy + CrawlTable[l]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { @@ -2103,7 +2099,6 @@ void AddIdentify(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy SetCursor_(CURSOR_IDENTIFY); } } -// 4B8968: using guessed type int sbookflag; void AddFirewallC(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -2114,7 +2109,7 @@ void AddFirewallC(int mi, int sx, int sy, int dx, int dy, int midir, char mienem for (i = 0; i < 6; i++) { k = CrawlNum[i]; pn = k + 2; - for (j = (unsigned char)CrawlTable[k]; j > 0; j--) { + for (j = (BYTE)CrawlTable[k]; j > 0; j--) { tx = dx + CrawlTable[pn - 1]; ty = dy + CrawlTable[pn]; if (0 < tx && tx < MAXDUNX && 0 < ty && ty < MAXDUNY) { @@ -2200,7 +2195,6 @@ void AddRepair(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, SetCursor_(CURSOR_REPAIR); } } -// 4B8968: using guessed type int sbookflag; void AddRecharge(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -2214,7 +2208,6 @@ void AddRecharge(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy SetCursor_(CURSOR_RECHARGE); } } -// 4B8968: using guessed type int sbookflag; void AddDisarm(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -2291,11 +2284,11 @@ void AddFlamec(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, void AddCbolt(int mi, int sx, int sy, int dx, int dy, int midir, char micaster, int id, int dam) { if (micaster == 0) { - if (id != -1) - missile[mi]._mirnd = random(63, 15) + 1; - else - missile[mi]._mirnd = random(63, 15) + 1; - missile[mi]._midam = random(68, plr[id]._pMagic >> 2) + 1; + if (id != -1) + missile[mi]._mirnd = random(63, 15) + 1; + else + missile[mi]._mirnd = random(63, 15) + 1; + missile[mi]._midam = random(68, plr[id]._pMagic >> 2) + 1; } else { missile[mi]._mirnd = random(63, 15) + 1; missile[mi]._midam = 15; @@ -2304,11 +2297,11 @@ void AddCbolt(int mi, int sx, int sy, int dx, int dy, int midir, char micaster, if (sx == dx && sy == dy) { dx += XDirAdd[midir]; dy += YDirAdd[midir]; - } + } missile[mi]._miAnimFrame = random(63, 8) + 1; - missile[mi]._mlid = AddLight(sx, sy, 5); - + missile[mi]._mlid = AddLight(sx, sy, 5); + GetMissileVel(mi, sx, sy, dx, dy, 8); missile[mi]._miVar1 = 5; missile[mi]._miVar2 = midir; @@ -2420,7 +2413,6 @@ void AddDiabApoca(int mi, int sx, int sy, int dx, int dy, int midir, char mienem } missile[mi]._miDelFlag = TRUE; } -// 679660: using guessed type char gbMaxPlayers; int AddMissile(int sx, int sy, int dx, int dy, int midir, int mitype, char micaster, int id, int midam, int spllvl) { @@ -2521,7 +2513,7 @@ void MI_Golem(int i) for (l = 0; l < 6; l++) { k = CrawlNum[l]; tid = k + 2; - for (m = (unsigned char)CrawlTable[k]; m > 0; m--) { + for (m = (BYTE)CrawlTable[k]; m > 0; m--) { tx = missile[i]._miVar4 + CrawlTable[tid - 1]; ty = missile[i]._miVar5 + CrawlTable[tid]; if (0 < tx && tx < MAXDUNX && 0 < ty && ty < MAXDUNY) { @@ -2883,12 +2875,12 @@ void MI_Fireball(int i) } if (missile[i]._miyvel > 0 && (TransList[dTransVal[mx + 1][my]] && nSolidTable[dPiece[mx + 1][my]] - || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { + || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { missile[i]._miyoff -= 32; } if (missile[i]._mixvel > 0 && (TransList[dTransVal[mx][my + 1]] && nSolidTable[dPiece[mx][my + 1]] - || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { + || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { missile[i]._mixoff -= 32; } missile[i]._mimfnum = 0; @@ -2912,8 +2904,8 @@ void MI_Lightctrl(int i) missile[i]._mirange--; p = missile[i]._misource; - if(p != -1) { - if(missile[i]._micaster == 0) { + if (p != -1) { + if (missile[i]._micaster == 0) { dam = (random(79, 2) + random(79, plr[p]._pLevel) + 2) << 6; } else { dam = 2 * (monster[p].mMinDamage + random(80, monster[p].mMaxDamage - monster[p].mMinDamage + 1)); @@ -2933,61 +2925,61 @@ void MI_Lightctrl(int i) 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) { + 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) { + } 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) { + 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); + 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); + 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); + mx, + my, + missile[i]._misx, + missile[i]._misy, + i, + MIS_LIGHTNING, + missile[i]._micaster, + missile[i]._misource, + dam, + missile[i]._mispllvl); } missile[i]._miVar1 = missile[i]._mix; missile[i]._miVar2 = missile[i]._miy; } } - if(missile[i]._mirange == 0 || mx <= 0 || my <= 0 || mx >= MAXDUNX || my > MAXDUNY) { + if (missile[i]._mirange == 0 || mx <= 0 || my <= 0 || mx >= MAXDUNX || my > MAXDUNY) { missile[i]._miDelFlag = TRUE; } } @@ -3244,42 +3236,42 @@ void MI_Guardian(int i) sy1 = 0; missile[i]._mirange--; - if(missile[i]._miVar2 > 0) { + if (missile[i]._miVar2 > 0) { missile[i]._miVar2--; } - if(missile[i]._mirange == missile[i]._miVar1 || missile[i]._mimfnum == MFILE_GUARD && missile[i]._miVar2 == 0) { + if (missile[i]._mirange == missile[i]._miVar1 || missile[i]._mimfnum == MFILE_GUARD && missile[i]._miVar2 == 0) { SetMissDir(i, 1); } - if(!(missile[i]._mirange % 16)) { + if (!(missile[i]._mirange % 16)) { ex = 0; - for(j = 0; j < 23 && ex != -1; j++) { - for(k = 10; k >= 0 && ex != -1 && (vCrawlTable[j][k] != 0 || vCrawlTable[j][k + 1] != 0); k -= 2) { - if(sx1 == vCrawlTable[j][k] && sy1 == vCrawlTable[j][k + 1]) { + for (j = 0; j < 23 && ex != -1; j++) { + for (k = 10; k >= 0 && ex != -1 && (vCrawlTable[j][k] != 0 || vCrawlTable[j][k + 1] != 0); k -= 2) { + if (sx1 == vCrawlTable[j][k] && sy1 == vCrawlTable[j][k + 1]) { continue; } sx = missile[i]._mix + vCrawlTable[j][k]; sy = missile[i]._miy + vCrawlTable[j][k + 1]; ex = Sentfire(i, sx, sy); - if(ex == -1) { + if (ex == -1) { break; } sx = missile[i]._mix - vCrawlTable[j][k]; sy = missile[i]._miy - vCrawlTable[j][k + 1]; ex = Sentfire(i, sx, sy); - if(ex == -1) { + if (ex == -1) { break; } sx = missile[i]._mix + vCrawlTable[j][k]; sy = missile[i]._miy - vCrawlTable[j][k + 1]; ex = Sentfire(i, sx, sy); - if(ex == -1) { + if (ex == -1) { break; } sx = missile[i]._mix - vCrawlTable[j][k]; sy = missile[i]._miy + vCrawlTable[j][k + 1]; ex = Sentfire(i, sx, sy); - if(ex == -1) { + if (ex == -1) { break; } sx1 = vCrawlTable[j][k]; @@ -3288,7 +3280,7 @@ void MI_Guardian(int i) } } - if(missile[i]._mirange == 14) { + if (missile[i]._mirange == 14) { SetMissDir(i, 0); missile[i]._miAnimFrame = 15; missile[i]._miAnimAdd = -1; @@ -3296,13 +3288,13 @@ void MI_Guardian(int i) missile[i]._miVar3 += missile[i]._miAnimAdd; - if(missile[i]._miVar3 > 15) { + if (missile[i]._miVar3 > 15) { missile[i]._miVar3 = 15; - } else if(missile[i]._miVar3 > 0) { + } else if (missile[i]._miVar3 > 0) { ChangeLight(missile[i]._mlid, missile[i]._mix, missile[i]._miy, missile[i]._miVar3); } - if(missile[i]._mirange == 0) { + if (missile[i]._mirange == 0) { missile[i]._miDelFlag = TRUE; AddUnLight(missile[i]._mlid); } @@ -3326,7 +3318,7 @@ void MI_Chain(int i) for (m = 1; m < rad; m++) { k = CrawlNum[m]; l = k + 2; - for (n = (unsigned char)CrawlTable[k]; n > 0; n--) { + for (n = (BYTE)CrawlTable[k]; n > 0; n--) { tx = sx + CrawlTable[l - 1]; ty = sy + CrawlTable[l]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY && dMonster[tx][ty] > 0) { @@ -4080,7 +4072,6 @@ void ProcessMissiles() } } } -// 64CCD4: using guessed type int MissilePreFlag; void missiles_process_charge() { diff --git a/Source/missiles.h b/Source/missiles.h index f63f3b682..466bae271 100644 --- a/Source/missiles.h +++ b/Source/missiles.h @@ -5,11 +5,11 @@ extern int missileactive[MAXMISSILES]; extern int missileavail[MAXMISSILES]; extern MissileStruct missile[MAXMISSILES]; -extern int nummissiles; // idb +extern int nummissiles; extern int ManashieldFlag; extern ChainStruct chain[MAXMISSILES]; -extern int MissilePreFlag; // weak -extern int numchains; // weak +extern int MissilePreFlag; +extern int numchains; void GetDamageAmt(int i, int *mind, int *maxd); BOOL CheckBlock(int fx, int fy, int tx, int ty); diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 4c37d4f1a..1e8660c42 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -6,7 +6,7 @@ char mpq_buf[4096]; _HASHENTRY *sgpHashTbl; BOOL save_archive_modified; _BLOCKENTRY *sgpBlockTbl; -BOOLEAN save_archive_open; // weak +BOOLEAN save_archive_open; //note: 32872 = 32768 + 104 (sizeof(_FILEHEADER)) @@ -120,7 +120,7 @@ BOOLEAN mpqapi_reg_store_modification_time(char *pbData, DWORD dwLen) } while (i); } - return SRegSaveData("Diablo", "Video Player ", 0, (unsigned char *)pbData, dwLen); + return SRegSaveData("Diablo", "Video Player ", 0, (BYTE *)pbData, dwLen); } void mpqapi_remove_hash_entry(const char *pszName) diff --git a/Source/mpqapi.h b/Source/mpqapi.h index c1451b360..9afe8fe96 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -3,8 +3,8 @@ #define __MPQAPI_H__ extern char mpq_buf[4096]; -extern BOOL save_archive_modified; // weak -extern BOOLEAN save_archive_open; // weak +extern BOOL save_archive_modified; +extern BOOLEAN save_archive_open; BOOL mpqapi_set_hidden(const char *pszArchive, BOOL hidden); void mpqapi_store_creation_time(const char *pszArchive, DWORD dwChar); diff --git a/Source/msg.cpp b/Source/msg.cpp index 2ab4634e2..1d6a2454f 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -48,7 +48,6 @@ void msg_send_packet(int pnum, const void *packet, DWORD dwSize) memcpy((char *)&packeta[1] - packeta->dwSpaceLeft, packet, dwSize); sgpCurrPkt->dwSpaceLeft -= dwSize; } -// 65AB24: using guessed type int sgnCurrMegaPlayer; TMegaPkt *msg_get_next_packet() { @@ -98,11 +97,6 @@ BOOL msg_wait_resync() return TRUE; } -// 65AB18: using guessed type int sgdwOwnerWait; -// 65AB24: using guessed type int sgnCurrMegaPlayer; -// 67618D: using guessed type char sgbDeltaChunks; -// 676194: using guessed type char gbBufferMsgs; -// 67862D: using guessed type char gbGameDestroyed; void msg_free_packets() { @@ -145,10 +139,6 @@ int msg_wait_for_turns() } return 100 * sgbDeltaChunks / 21; } -// 65AB18: using guessed type int sgdwOwnerWait; -// 67618D: using guessed type char sgbDeltaChunks; -// 67862D: using guessed type char gbGameDestroyed; -// 6796E4: using guessed type char gbDeltaSender; void msg_process_net_packets() { @@ -159,8 +149,6 @@ void msg_process_net_packets() msg_free_packets(); } } -// 676194: using guessed type char gbBufferMsgs; -// 679660: using guessed type char gbMaxPlayers; void msg_pre_packet() { @@ -313,7 +301,6 @@ void delta_init() memset(sgLocals, 0, sizeof(sgLocals)); deltaload = FALSE; } -// 676190: using guessed type int deltaload; void delta_kill_monster(int mi, BYTE x, BYTE y, BYTE bLevel) { @@ -328,7 +315,6 @@ void delta_kill_monster(int mi, BYTE x, BYTE y, BYTE bLevel) pD->_mhitpoints = 0; } } -// 679660: using guessed type char gbMaxPlayers; void delta_monster_hp(int mi, int hp, BYTE bLevel) { @@ -341,7 +327,6 @@ void delta_monster_hp(int mi, int hp, BYTE bLevel) pD->_mhitpoints = hp; } } -// 679660: using guessed type char gbMaxPlayers; void delta_sync_monster(const TSyncMonster *pSync, BYTE bLevel) { @@ -363,7 +348,6 @@ void delta_sync_monster(const TSyncMonster *pSync, BYTE bLevel) pD->_menemy = pSync->_menemy; } } -// 679660: using guessed type char gbMaxPlayers; void delta_sync_golem(TCmdGolem *pG, int pnum, BYTE bLevel) { @@ -380,7 +364,6 @@ void delta_sync_golem(TCmdGolem *pG, int pnum, BYTE bLevel) pD->_mhitpoints = pG->_mhitpoints; } } -// 679660: using guessed type char gbMaxPlayers; void delta_leave_sync(BYTE bLevel) { @@ -409,8 +392,6 @@ void delta_leave_sync(BYTE bLevel) } } } -// 43C17D: could not find valid save-restore pair for edi -// 679660: using guessed type char gbMaxPlayers; BOOL delta_portal_inited(int i) { @@ -431,7 +412,7 @@ void DeltaAddItem(int ii) return; } pD = sgLevels[currlevel].item; - for (i = 0; i < MAXITEMS; i++,pD++) { + for (i = 0; i < MAXITEMS; i++, pD++) { if (pD->bCmd != 0xFF && pD->wIndx == item[ii].IDidx && pD->wCI == item[ii]._iCreateInfo @@ -475,7 +456,6 @@ void DeltaSaveLevel() delta_leave_sync(currlevel); } } -// 679660: using guessed type char gbMaxPlayers; void DeltaLoadLevel() { @@ -626,7 +606,6 @@ void DeltaLoadLevel() } deltaload = FALSE; } -// 679660: using guessed type char gbMaxPlayers; void NetSendCmd(BOOL bHiPri, BYTE bCmd) { @@ -1159,9 +1138,6 @@ int ParseCmd(int pnum, TCmd *pCmd) return On_DLEVEL(pnum, pCmd); } -// 66E4A9: using guessed type char sbLastCmd; -// 67618D: using guessed type char sgbDeltaChunks; -// 6796E4: using guessed type char gbDeltaSender; int On_DLEVEL(int pnum, TCmd *pCmd) { @@ -1169,30 +1145,30 @@ int On_DLEVEL(int pnum, TCmd *pCmd) p = (TCmdPlrInfoHdr *)pCmd; - if(gbDeltaSender != pnum) { - if(p->bCmd == CMD_DLEVEL_END) { + if (gbDeltaSender != pnum) { + if (p->bCmd == CMD_DLEVEL_END) { gbDeltaSender = pnum; sgbRecvCmd = CMD_DLEVEL_END; - } else if(p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { + } else if (p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { gbDeltaSender = pnum; sgbRecvCmd = CMD_DLEVEL_END; } else { return p->wBytes + sizeof(*p); } } - if(sgbRecvCmd == CMD_DLEVEL_END) { - if(p->bCmd == CMD_DLEVEL_END) { + if (sgbRecvCmd == CMD_DLEVEL_END) { + if (p->bCmd == CMD_DLEVEL_END) { sgbDeltaChunks = 20; return p->wBytes + sizeof(*p); - } else if(p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { + } else if (p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { sgdwRecvOffset = 0; sgbRecvCmd = p->bCmd; } else { return p->wBytes + sizeof(*p); } - } else if(sgbRecvCmd != p->bCmd) { + } else if (sgbRecvCmd != p->bCmd) { DeltaImportData(sgbRecvCmd, sgdwRecvOffset); - if(p->bCmd == CMD_DLEVEL_END) { + if (p->bCmd == CMD_DLEVEL_END) { sgbDeltaChunks = 20; sgbRecvCmd = CMD_DLEVEL_END; return p->wBytes + sizeof(*p); @@ -1231,7 +1207,6 @@ void DeltaImportData(BYTE cmd, DWORD recv_offset) sgbDeltaChunks++; sgbDeltaChanged = TRUE; } -// 67618D: using guessed type char sgbDeltaChunks; BYTE *DeltaImportItem(BYTE *src, TCmdPItem *dst) { @@ -1444,7 +1419,6 @@ BOOL i_own_level(int nReqLevel) return i == myplr; } -// 676194: using guessed type char gbBufferMsgs; int On_GETITEM(TCmdGItem *pCmd, int pnum) { @@ -1530,7 +1504,6 @@ BOOL delta_get_item(TCmdGItem *pI, BYTE bLevel) } return result; } -// 679660: using guessed type char gbMaxPlayers; int On_GOTOAGETITEM(TCmdLocParam1 *pCmd, int pnum) { @@ -1665,7 +1638,6 @@ void check_update_plr(int pnum) if (gbMaxPlayers != 1 && pnum == myplr) pfile_update(1); } -// 679660: using guessed type char gbMaxPlayers; int On_SYNCPUTITEM(TCmdPItem *pCmd, int pnum) { @@ -2142,7 +2114,6 @@ void delta_sync_object(int oi, BYTE bCmd, BYTE bLevel) sgLevels[bLevel].object[oi].bCmd = bCmd; } } -// 679660: using guessed type char gbMaxPlayers; int On_CLOSEDOOR(TCmdParam1 *pCmd, int pnum) { diff --git a/Source/multi.cpp b/Source/multi.cpp index fe75af292..9d27a104f 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -2,7 +2,7 @@ #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" -BOOLEAN gbSomebodyWonGameKludge; // weak +BOOLEAN gbSomebodyWonGameKludge; #ifdef _DEBUG DWORD gdwHistTicks; #endif @@ -12,22 +12,22 @@ WORD sgwPackPlrOffsetTbl[MAX_PLRS]; PkPlayerStruct netplr[MAX_PLRS]; BOOLEAN sgbPlayerTurnBitTbl[MAX_PLRS]; BOOLEAN sgbPlayerLeftGameTbl[MAX_PLRS]; -int sgbSentThisCycle; // idb +int sgbSentThisCycle; BOOL gbShouldValidatePackage; -BYTE gbActivePlayers; // weak +BYTE gbActivePlayers; BOOLEAN gbGameDestroyed; BOOLEAN sgbSendDeltaTbl[MAX_PLRS]; _gamedata sgGameInitInfo; -char byte_678640; // weak -int sglTimeoutStart; // weak +char byte_678640; +int sglTimeoutStart; int sgdwPlayerLeftReasonTbl[MAX_PLRS]; TBuffer sgLoPriBuf; -unsigned int sgdwGameLoops; // idb +unsigned int sgdwGameLoops; BYTE gbMaxPlayers; BOOLEAN sgbTimeout; char szPlayerName[128]; BYTE gbDeltaSender; -BOOL sgbNetInited; // weak +BOOL sgbNetInited; int player_state[MAX_PLRS]; const int event_types[3] = { @@ -151,7 +151,6 @@ void NetSendHiPri(BYTE *pbMsg, BYTE bLen) nthread_terminate_game("SNetSendMessage"); } } -// 679760: using guessed type int gdwNormalMsgSize; BYTE *multi_recv_packet(TBuffer *packet, BYTE *body, int *size) { @@ -425,9 +424,6 @@ void multi_begin_timeout() multi_check_drop_player(); } } -// 67862D: using guessed type char gbGameDestroyed; -// 678644: using guessed type int sglTimeoutStart; -// 679661: using guessed type char sgbTimeout; void multi_check_drop_player() { @@ -510,8 +506,6 @@ void multi_process_network_packets() if (SErrGetLastError() != STORM_ERROR_NO_MESSAGES_WAITING) nthread_terminate_game("SNetReceiveMsg"); } -// 676194: using guessed type char gbBufferMsgs; -// 676198: using guessed type int pkt_counter; void multi_handle_all_packets(int pnum, BYTE *pData, int nSize) { @@ -572,7 +566,6 @@ void multi_send_zero_packet(DWORD pnum, char a2, void *pbSrc, DWORD dwLen) v5 += *(WORD *)&pkt.body[3]; } } -// 67975C: using guessed type int gdwLargestMsgSize; void NetClose() { diff --git a/Source/multi.h b/Source/multi.h index be7aad6e6..8ea04f36a 100644 --- a/Source/multi.h +++ b/Source/multi.h @@ -2,17 +2,17 @@ #ifndef __MULTI_H__ #define __MULTI_H__ -extern BOOLEAN gbSomebodyWonGameKludge; // weak +extern BOOLEAN gbSomebodyWonGameKludge; extern char szPlayerDescript[128]; extern WORD sgwPackPlrOffsetTbl[MAX_PLRS]; extern PkPlayerStruct netplr[MAX_PLRS]; extern BOOL gbShouldValidatePackage; extern BYTE gbActivePlayers; -extern BOOLEAN gbGameDestroyed; // weak -extern char byte_678640; // weak +extern BOOLEAN gbGameDestroyed; +extern char byte_678640; extern BYTE gbMaxPlayers; extern char szPlayerName[128]; -extern BYTE gbDeltaSender; // weak +extern BYTE gbDeltaSender; extern int player_state[MAX_PLRS]; #ifdef _DEBUG diff --git a/Source/quests.cpp b/Source/quests.cpp index bcbaa13a2..6b0ac0590 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -1,18 +1,18 @@ #include "diablo.h" -int qtopline; // idb +int qtopline; BOOL questlog; BYTE *pQLogCel; QuestStruct quests[MAXQUESTS]; -int qline; // weak +int qline; int qlist[MAXQUESTS]; -int numqlines; // weak -int WaterDone; // idb -int ReturnLvlY; // idb -int ReturnLvlX; // idb -int ReturnLvlT; // idb -int ALLQUESTS; // idb -int ReturnLvl; // idb +int numqlines; +int WaterDone; +int ReturnLvlY; +int ReturnLvlX; +int ReturnLvlT; +int ALLQUESTS; +int ReturnLvl; QuestData questlist[MAXQUESTS] = { // clang-format off @@ -128,65 +128,65 @@ void CheckQuests() { int i, rportx, rporty; - if(QuestStatus(QTYPE_VB) && gbMaxPlayers != 1 && quests[QTYPE_VB]._qvar1 == 2) { + if (QuestStatus(QTYPE_VB) && gbMaxPlayers != 1 && quests[QTYPE_VB]._qvar1 == 2) { AddObject(OBJ_ALTBOY, 2 * setpc_x + 20, 2 * setpc_y + 22); quests[QTYPE_VB]._qvar1 = 3; NetSendCmdQuest(TRUE, QTYPE_VB); } - if(gbMaxPlayers != 1) { + if (gbMaxPlayers != 1) { return; } - if(currlevel == quests[QTYPE_VB]._qlevel - && !setlevel - && quests[QTYPE_VB]._qvar1 >= 2 - && (quests[QTYPE_VB]._qactive == 2 || quests[QTYPE_VB]._qactive == 3) - && (quests[QTYPE_VB]._qvar2 == 0 || quests[QTYPE_VB]._qvar2 == 2)) { + if (currlevel == quests[QTYPE_VB]._qlevel + && !setlevel + && quests[QTYPE_VB]._qvar1 >= 2 + && (quests[QTYPE_VB]._qactive == 2 || quests[QTYPE_VB]._qactive == 3) + && (quests[QTYPE_VB]._qvar2 == 0 || quests[QTYPE_VB]._qvar2 == 2)) { quests[QTYPE_VB]._qtx = 2 * quests[QTYPE_VB]._qtx + 16; quests[QTYPE_VB]._qty = 2 * quests[QTYPE_VB]._qty + 16; rportx = quests[QTYPE_VB]._qtx; rporty = quests[QTYPE_VB]._qty; AddMissile(rportx, rporty, rportx, rporty, 0, MIS_RPORTAL, 0, myplr, 0, 0); quests[QTYPE_VB]._qvar2 = 1; - if(quests[QTYPE_VB]._qactive == 2) { + if (quests[QTYPE_VB]._qactive == 2) { quests[QTYPE_VB]._qvar1 = 3; } } - if(quests[QTYPE_VB]._qactive == 3 - && setlevel - && setlvlnum == SL_VILEBETRAYER - && quests[QTYPE_VB]._qvar2 == 4) { + if (quests[QTYPE_VB]._qactive == 3 + && setlevel + && setlvlnum == SL_VILEBETRAYER + && quests[QTYPE_VB]._qvar2 == 4) { rportx = 35; rporty = 32; AddMissile(rportx, rporty, rportx, rporty, 0, MIS_RPORTAL, 0, myplr, 0, 0); quests[QTYPE_VB]._qvar2 = 3; } - if(setlevel) { - if(setlvlnum == quests[QTYPE_PW]._qslvl - && quests[QTYPE_PW]._qactive != 1 - && leveltype == quests[QTYPE_PW]._qlvltype - && nummonsters == 4 - && quests[QTYPE_PW]._qactive != 3) { + if (setlevel) { + if (setlvlnum == quests[QTYPE_PW]._qslvl + && quests[QTYPE_PW]._qactive != 1 + && leveltype == quests[QTYPE_PW]._qlvltype + && nummonsters == 4 + && quests[QTYPE_PW]._qactive != 3) { quests[QTYPE_PW]._qactive = 3; PlaySfxLoc(IS_QUESTDN, plr[myplr].WorldX, plr[myplr].WorldY); LoadPalette("Levels\\L3Data\\L3pwater.pal"); WaterDone = 32; } - if(WaterDone > 0) { + if (WaterDone > 0) { palette_update_quest_palette(WaterDone); WaterDone--; } - } else if(plr[myplr]._pmode == PM_STAND) { - for(i = 0; i < MAXQUESTS; i++) { - if(currlevel == quests[i]._qlevel - && quests[i]._qslvl != 0 - && quests[i]._qactive != 0 - && plr[myplr].WorldX == quests[i]._qtx - && plr[myplr].WorldY == quests[i]._qty) { - if(quests[i]._qlvltype != 255) { + } else if (plr[myplr]._pmode == PM_STAND) { + for (i = 0; i < MAXQUESTS; i++) { + if (currlevel == quests[i]._qlevel + && quests[i]._qslvl != 0 + && quests[i]._qactive != 0 + && plr[myplr].WorldX == quests[i]._qtx + && plr[myplr].WorldY == quests[i]._qty) { + if (quests[i]._qlvltype != 255) { setlvltype = quests[i]._qlvltype; } StartNewLvl(myplr, WM_DIABSETLVL, quests[i]._qslvl); @@ -194,11 +194,6 @@ void CheckQuests() } } } -// 5BB1ED: using guessed type char leveltype; -// 5CF31C: using guessed type char setlvltype; -// 5CF31D: using guessed type char setlevel; -// 679660: using guessed type char gbMaxPlayers; -// 69BE90: using guessed type int qline; BOOL ForceQuests() { @@ -683,11 +678,6 @@ void ResyncQuests() quests[QTYPE_VB]._qvar2 = 2; } } -// 5A5590: using guessed type char TransVal; -// 5BB1ED: using guessed type char leveltype; -// 5CF31D: using guessed type char setlevel; -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col) { @@ -718,7 +708,7 @@ void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col) off += fontkern[c] + 1; } if (qline == y) { - CelDecodeOnly(cjustflag ? x + k + 100 : 340 - x, s + 205, pCelBuff, ALLQUESTS, 12); + CelDecodeOnly(cjustflag ? x + k + 100 : 340 - x, s + 205, pCelBuff, ALLQUESTS, 12); } } diff --git a/Source/quests.h b/Source/quests.h index 2c4cbeed7..3d4ee9ccf 100644 --- a/Source/quests.h +++ b/Source/quests.h @@ -2,19 +2,19 @@ #ifndef __QUESTS_H__ #define __QUESTS_H__ -extern int qtopline; // idb +extern int qtopline; extern BOOL questlog; extern BYTE *pQLogCel; extern QuestStruct quests[MAXQUESTS]; -extern int qline; // weak +extern int qline; extern int qlist[MAXQUESTS]; -extern int numqlines; // weak -extern int WaterDone; // idb -extern int ReturnLvlY; // idb -extern int ReturnLvlX; // idb -extern int ReturnLvlT; // idb -extern int ALLQUESTS; // idb -extern int ReturnLvl; // idb +extern int numqlines; +extern int WaterDone; +extern int ReturnLvlY; +extern int ReturnLvlX; +extern int ReturnLvlT; +extern int ALLQUESTS; +extern int ReturnLvl; void InitQuests(); void CheckQuests();