Skip to content

Commit

Permalink
Clean up scrollrt.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
AJenbo committed May 1, 2019
1 parent 1fd057a commit d61b3e3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 143 deletions.
46 changes: 23 additions & 23 deletions Source/drlg_l3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ const BYTE L3TITE8[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 52, 0, 0
const BYTE L3TITE9[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 53, 0, 0, 0, 0 };
const BYTE L3TITE10[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 54, 0, 0, 0, 0 };
const BYTE L3TITE11[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 67, 0, 0, 0, 0 };
const BYTE L3TITE12[6] = { 2u, 1u, 9u, 7u, 68u, 0u };
const BYTE L3TITE13[6] = { 1u, 2u, 10u, 7u, 69u, 0u };
const BYTE L3CREV1[6] = { 2u, 1u, 8u, 7u, 84u, 85u };
const BYTE L3CREV2[6] = { 2u, 1u, 8u, 11u, 86u, 87u };
const BYTE L3CREV3[6] = { 1u, 2u, 8u, 10u, 89u, 88u };
const BYTE L3CREV4[6] = { 2u, 1u, 8u, 7u, 90u, 91u };
const BYTE L3CREV5[6] = { 1u, 2u, 8u, 11u, 92u, 93u };
const BYTE L3CREV6[6] = { 1u, 2u, 8u, 10u, 95u, 94u };
const BYTE L3CREV7[6] = { 2u, 1u, 8u, 7u, 96u, 101u };
const BYTE L3CREV8[6] = { 1u, 2u, 2u, 8u, 102u, 97u };
const BYTE L3CREV9[6] = { 2u, 1u, 3u, 8u, 103u, 98u };
const BYTE L3CREV10[6] = { 2u, 1u, 4u, 8u, 104u, 99u };
const BYTE L3CREV11[6] = { 1u, 2u, 6u, 8u, 105u, 100u };
const BYTE L3ISLE1[14] = { 2u, 3u, 5u, 14u, 4u, 9u, 13u, 12u, 7u, 7u, 7u, 7u, 7u, 7u };
const BYTE L3ISLE2[14] = { 3u, 2u, 5u, 2u, 14u, 13u, 10u, 12u, 7u, 7u, 7u, 7u, 7u, 7u };
const BYTE L3ISLE3[14] = { 2u, 3u, 5u, 14u, 4u, 9u, 13u, 12u, 29u, 30u, 25u, 28u, 31u, 32u };
const BYTE L3ISLE4[14] = { 3u, 2u, 5u, 2u, 14u, 13u, 10u, 12u, 29u, 26u, 30u, 31u, 27u, 32u };
const BYTE L3ISLE5[10] = { 2u, 2u, 5u, 14u, 13u, 12u, 7u, 7u, 7u, 7u };
const BYTE L3XTRA1[4] = { 1u, 1u, 7u, 106u };
const BYTE L3XTRA2[4] = { 1u, 1u, 7u, 107u };
const BYTE L3XTRA3[4] = { 1u, 1u, 7u, 108u };
const BYTE L3XTRA4[4] = { 1u, 1u, 9u, 109u };
const BYTE L3XTRA5[4] = { 1u, 1u, 10u, 110u };
const BYTE L3TITE12[6] = { 2, 1, 9, 7, 68, 0 };
const BYTE L3TITE13[6] = { 1, 2, 10, 7, 69, 0 };
const BYTE L3CREV1[6] = { 2, 1, 8, 7, 84, 85 };
const BYTE L3CREV2[6] = { 2, 1, 8, 11, 86, 87 };
const BYTE L3CREV3[6] = { 1, 2, 8, 10, 89, 88 };
const BYTE L3CREV4[6] = { 2, 1, 8, 7, 90, 91 };
const BYTE L3CREV5[6] = { 1, 2, 8, 11, 92, 93 };
const BYTE L3CREV6[6] = { 1, 2, 8, 10, 95, 94 };
const BYTE L3CREV7[6] = { 2, 1, 8, 7, 96, 101 };
const BYTE L3CREV8[6] = { 1, 2, 2, 8, 102, 97 };
const BYTE L3CREV9[6] = { 2, 1, 3, 8, 103, 98 };
const BYTE L3CREV10[6] = { 2, 1, 4, 8, 104, 99 };
const BYTE L3CREV11[6] = { 1, 2, 6, 8, 105, 100 };
const BYTE L3ISLE1[14] = { 2, 3, 5, 14, 4, 9, 13, 12, 7, 7, 7, 7, 7, 7 };
const BYTE L3ISLE2[14] = { 3, 2, 5, 2, 14, 13, 10, 12, 7, 7, 7, 7, 7, 7 };
const BYTE L3ISLE3[14] = { 2, 3, 5, 14, 4, 9, 13, 12, 29, 30, 25, 28, 31, 32 };
const BYTE L3ISLE4[14] = { 3, 2, 5, 2, 14, 13, 10, 12, 29, 26, 30, 31, 27, 32 };
const BYTE L3ISLE5[10] = { 2, 2, 5, 14, 13, 12, 7, 7, 7, 7 };
const BYTE L3XTRA1[4] = { 1, 1, 7, 106 };
const BYTE L3XTRA2[4] = { 1, 1, 7, 107 };
const BYTE L3XTRA3[4] = { 1, 1, 7, 108 };
const BYTE L3XTRA4[4] = { 1, 1, 9, 109 };
const BYTE L3XTRA5[4] = { 1, 1, 10, 110 };
const BYTE L3ANVIL[244] = {
11, 11, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
Expand Down
7 changes: 0 additions & 7 deletions Source/lighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,6 @@ void MakeLightTable()
}
}
}
// 525728: using guessed type int light4flag;

#ifdef _DEBUG
void ToggleLighting_2()
Expand Down Expand Up @@ -1136,7 +1135,6 @@ void ProcessLightList()

dolighting = FALSE;
}
// 642A18: using guessed type int dolighting;

void SavePreLighting()
{
Expand Down Expand Up @@ -1193,7 +1191,6 @@ void ChangeVisionRadius(int id, int r)
}
}
}
// 642A0C: using guessed type int dovision;

void ChangeVisionXY(int id, int x, int y)
{
Expand All @@ -1211,7 +1208,6 @@ void ChangeVisionXY(int id, int x, int y)
}
}
}
// 642A0C: using guessed type int dovision;

void ProcessVisionList()
{
Expand Down Expand Up @@ -1257,8 +1253,6 @@ void ProcessVisionList()

dovision = FALSE;
}
// 5A5590: using guessed type char TransVal;
// 642A0C: using guessed type int dovision;

void lighting_color_cycling()
{
Expand All @@ -1285,4 +1279,3 @@ void lighting_color_cycling()
tbl += 224;
}
}
// 525728: using guessed type int light4flag;
128 changes: 21 additions & 107 deletions Source/scrollrt.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#include "diablo.h"
#include "../3rdParty/Storm/Source/storm.h"

int light_table_index; // weak
int light_table_index;
int PitchTbl[1024];
DWORD sgdwCursWdtOld; // idb
DWORD sgdwCursX; // idb
DWORD sgdwCursY; // idb
unsigned char *gpBufEnd; // weak
DWORD sgdwCursWdtOld;
DWORD sgdwCursX;
DWORD sgdwCursY;
BYTE *gpBufEnd;
DWORD sgdwCursHgt;
DWORD level_cel_block; // weak
DWORD sgdwCursXOld; // idb
DWORD sgdwCursYOld; // idb
char arch_draw_type; // weak
DWORD level_cel_block;
DWORD sgdwCursXOld;
DWORD sgdwCursYOld;
char arch_draw_type;
DDSURFACEDESC DDS_desc;
int cel_transparency_active; // weak
int level_piece_id; // weak
int level_piece_id;
DWORD sgdwCursWdt;
void(*DrawPlrProc)(int, int, int, int, int, BYTE *, int, int, int, int);
BYTE sgSaveBack[8192];
int draw_monster_num; // weak
DWORD sgdwCursHgtOld; // idb
int draw_monster_num;
DWORD sgdwCursHgtOld;

/* data */

Expand Down Expand Up @@ -296,9 +296,6 @@ void DrawPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, int nCel
}
}
}
// 4B8CC2: using guessed type char pcursplr;
// 5CF31D: using guessed type char setlevel;
// 69BEF8: using guessed type int light_table_index;

void DrawClippedPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap)
{
Expand Down Expand Up @@ -372,8 +369,6 @@ void DrawClippedPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, i
}
}
}
// 4B8CC2: using guessed type char pcursplr;
// 69BEF8: using guessed type int light_table_index;

void DrawView(int StartX, int StartY)
{
Expand Down Expand Up @@ -431,12 +426,6 @@ void DrawView(int StartX, int StartY)
DrawLifeFlask();
DrawManaFlask();
}
// 4B8968: using guessed type int sbookflag;
// 4B8C98: using guessed type int spselflag;
// 52569C: using guessed type int zoomflag;
// 525740: using guessed type int PauseMode;
// 52B9F1: using guessed type char msgflag;
// 646D00: using guessed type char qtextflag;

void DrawGame(int x, int y)
{
Expand Down Expand Up @@ -539,13 +528,6 @@ void DrawGame(int x, int y)
sy += 16;
}
}
// 4B8968: using guessed type int sbookflag;
// 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;
// 69CF0C: using guessed type int gpBufEnd;
// 69CF20: using guessed type char arch_draw_type;

void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag)
{
Expand Down Expand Up @@ -695,11 +677,6 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag)
}
}
}
// 69BEF8: using guessed type int light_table_index;
// 69CF14: using guessed type int level_cel_block;
// 69CF20: using guessed type char arch_draw_type;
// 69CF94: using guessed type int cel_transparency_active;
// 69CF98: using guessed type int level_piece_id;

void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, int eflag)
{
Expand Down Expand Up @@ -914,13 +891,6 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy,
Cel2DecodeLightTrans(pBuff, (BYTE *)level_special_cel, bArch, 64, 0, 8);
}
}
// 4B8CC0: using guessed type char pcursitem;
// 525720: using guessed type int visiondebug;
// 642A14: using guessed type char lightmax;
// 64CCD4: using guessed type int MissilePreFlag;
// 69BEF8: using guessed type int light_table_index;
// 69CF94: using guessed type int cel_transparency_active;
// 69EFA4: using guessed type int draw_monster_num;

void DrawClippedMonster(int x, int y, int mx, int my, int m, int CelSkip, int CelCap)
{
Expand Down Expand Up @@ -974,7 +944,6 @@ void DrawClippedMonster(int x, int y, int mx, int my, int m, int CelSkip, int Ce
Cl2DecodeFrm6(mx, my, monster[m]._mAnimData, monster[m]._mAnimFrame, monster[m].MType->width, CelSkip, CelCap);
}
}
// 69BEF8: using guessed type int light_table_index;

void DrawClippedObject(int x, int y, int ox, int oy, BOOL pre, int CelSkip, int CelCap)
{
Expand Down Expand Up @@ -1025,7 +994,6 @@ void DrawClippedObject(int x, int y, int ox, int oy, BOOL pre, int CelSkip, int
else
Cel2DrawHdrOnly(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth, CelSkip, CelCap);
}
// 4B8CC1: using guessed type char pcursobj;

void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int a4, int a5)
{
Expand Down Expand Up @@ -1074,11 +1042,6 @@ void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int a4, int a5)
cel_transparency_active = cta_old;
level_piece_id = lpi_old;
}
// 69BEF8: using guessed type int light_table_index;
// 69CF14: using guessed type int level_cel_block;
// 69CF20: using guessed type char arch_draw_type;
// 69CF94: using guessed type int cel_transparency_active;
// 69CF98: using guessed type int level_piece_id;

void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChunks, int eflag)
{
Expand Down Expand Up @@ -1178,10 +1141,6 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu
}
}
}
// 69BEF8: using guessed type int light_table_index;
// 69CF14: using guessed type int level_cel_block;
// 69CF94: using guessed type int cel_transparency_active;
// 69CF98: using guessed type int level_piece_id;

void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks, int CelSkip, int dx, int dy, int eflag)
{
Expand Down Expand Up @@ -1396,13 +1355,6 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks
Cel2DecodeLightTrans(pBuff, (BYTE *)level_special_cel, bArch, 64, CelSkip, 8);
}
}
// 4B8CC0: using guessed type char pcursitem;
// 525720: using guessed type int visiondebug;
// 642A14: using guessed type char lightmax;
// 64CCD4: using guessed type int MissilePreFlag;
// 69BEF8: using guessed type int light_table_index;
// 69CF94: using guessed type int cel_transparency_active;
// 69EFA4: using guessed type int draw_monster_num;

void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, signed int CelSkip, int sx, int sy)
{
Expand Down Expand Up @@ -1471,10 +1423,6 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s
cel_transparency_active = cta_old;
level_piece_id = lpi_old;
}
// 69BEF8: using guessed type int light_table_index;
// 69CF14: using guessed type int level_cel_block;
// 69CF94: using guessed type int cel_transparency_active;
// 69CF98: using guessed type int level_piece_id;

void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks, int eflag)
{
Expand Down Expand Up @@ -1621,11 +1569,6 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks
}
}
}
// 69BEF8: using guessed type int light_table_index;
// 69CF14: using guessed type int level_cel_block;
// 69CF20: using guessed type char arch_draw_type;
// 69CF94: using guessed type int cel_transparency_active;
// 69CF98: using guessed type int level_piece_id;

void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCap, int dx, int dy, int eflag)
{
Expand Down Expand Up @@ -1826,13 +1769,6 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa
CelDecodeHdrLightTrans(pBuff, (BYTE *)level_special_cel, bArch, 64, 0, CelCap);
}
}
// 4B8CC0: using guessed type char pcursitem;
// 525720: using guessed type int visiondebug;
// 642A14: using guessed type char lightmax;
// 64CCD4: using guessed type int MissilePreFlag;
// 69BEF8: using guessed type int light_table_index;
// 69CF94: using guessed type int cel_transparency_active;
// 69EFA4: using guessed type int draw_monster_num;

void DrawMonster(int x, int y, int mx, int my, int m, int CelSkip, int CelCap)
{
Expand Down Expand Up @@ -1886,7 +1822,6 @@ void DrawMonster(int x, int y, int mx, int my, int m, int CelSkip, int CelCap)
Cl2DecodeLightTbl(mx, my, monster[m]._mAnimData, monster[m]._mAnimFrame, monster[m].MType->width, CelSkip, CelCap);
}
}
// 69BEF8: using guessed type int light_table_index;

void DrawObject(int x, int y, int ox, int oy, BOOL pre, int CelSkip, int CelCap)
{
Expand Down Expand Up @@ -1940,7 +1875,6 @@ void DrawObject(int x, int y, int ox, int oy, BOOL pre, int CelSkip, int CelCap)
CelDrawHdrOnly(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth, CelSkip, CelCap);
}
}
// 4B8CC1: using guessed type char pcursobj;

void scrollrt_draw_e_flag(BYTE *pBuff, int x, int y, int capChunks, int CelCap, int sx, int sy)
{
Expand Down Expand Up @@ -1990,11 +1924,6 @@ void scrollrt_draw_e_flag(BYTE *pBuff, int x, int y, int capChunks, int CelCap,
cel_transparency_active = cta_old;
level_piece_id = lpi_old;
}
// 69BEF8: using guessed type int light_table_index;
// 69CF14: using guessed type int level_cel_block;
// 69CF20: using guessed type char arch_draw_type;
// 69CF94: using guessed type int cel_transparency_active;
// 69CF98: using guessed type int level_piece_id;

void DrawZoom(int x, int y)
{
Expand Down Expand Up @@ -2152,13 +2081,6 @@ void DrawZoom(int x, int y)
}
#endif
}
// 4B8968: using guessed type int sbookflag;
// 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;
// 69CF0C: using guessed type int gpBufEnd;
// 69CF20: using guessed type char arch_draw_type;

void ClearScreenBuffer()
{
Expand Down Expand Up @@ -2304,7 +2226,6 @@ void scrollrt_draw_game_screen(BOOL draw_cursor)
unlock_buf(0);
}
}
// 52571C: using guessed type int drawpanflag;

void scrollrt_draw_cursor_back_buffer()
{
Expand Down Expand Up @@ -2403,8 +2324,6 @@ void scrollrt_draw_cursor_item()
Cel2DrawHdrOnly(mx + 64, my + cursH + 160 - 1, (BYTE *)pCursCels, pcurs, cursW, 0, 8);
}
}
// 4B8C9C: using guessed type int cursH;
// 69CF0C: using guessed type int gpBufEnd;

void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BOOL draw_sbar, BOOL draw_btn)
{
Expand Down Expand Up @@ -2524,24 +2443,21 @@ void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BOOL draw
DrawFPS();
#endif
}
// 634980: using guessed type int gbActive;
// 679660: using guessed type char gbMaxPlayers;

#ifdef _DEBUG
void DrawFPS()
{
DWORD v0; // eax
int v1; // esi
char String[12]; // [esp+8h] [ebp-10h]
HDC hdc; // [esp+14h] [ebp-4h]
DWORD tc, frames;
char String[12];
HDC hdc;

if (frameflag && gbActive) {
++frameend;
v0 = GetTickCount();
v1 = v0 - framestart;
if (v0 - framestart >= 1000) {
framestart = v0;
framerate = 1000 * frameend / v1;
frameend++;
tc = GetTickCount();
frames = tc - framestart;
if (tc - framestart >= 1000) {
framestart = tc;
framerate = 1000 * frameend / frames;
frameend = 0;
}
if (framerate > 99)
Expand Down Expand Up @@ -2725,5 +2641,3 @@ void DrawAndBlit()
drawbtnflag = FALSE;
drawsbarflag = FALSE;
}
// 4B8960: using guessed type int talkflag;
// 52571C: using guessed type int drawpanflag;
Loading

0 comments on commit d61b3e3

Please sign in to comment.