Browse Source

Add debug lighting, add cmd line note (#61)

pull/4/head
galaxyhaxz 8 years ago committed by GitHub
parent
commit
d03c56e844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Makefile
  2. 5
      Source/diablo.cpp
  3. 25
      Source/lighting.cpp
  4. 3
      Source/lighting.h
  5. 2
      Support/debug.md
  6. 5
      types.h

2
Makefile

@ -50,6 +50,6 @@ storm.dll:
# $(error Please copy storm.dll (version 1.09[b]) here)
clean:
@$(RM) -v $(OBJS) $(OBJS:.o=.d) $(PKWARE_OBJS) $(PKWARE_OBJS:.o=d) diabres.o storm.lib diabloui.lib
@$(RM) -v $(OBJS) $(OBJS:.o=.d) $(PKWARE_OBJS) $(PKWARE_OBJS:.o=d) diabres.o storm.lib diabloui.lib devilution.exe
.PHONY: clean all

5
Source/diablo.cpp

@ -1742,6 +1742,11 @@ LABEL_27:
NetSendCmdString(1 << myplr, tempstr);
}
return;
case 'L':
case 'l':
if ( debug_mode_key_inverted_v )
ToggleLighting();
return;
case 'M':
NextDebugMonster();
return;

25
Source/lighting.cpp

@ -1391,6 +1391,31 @@ void __cdecl MakeLightTable()
// 525728: using guessed type int light4flag;
// 5BB1ED: using guessed type char leveltype;
#ifdef _DEBUG
void __cdecl ToggleLighting()
{
int i;
lightflag ^= 1;
if ( lightflag )
{
memset(dTransVal, 0, 0x3100u);
}
else
{
memcpy(dTransVal, dTransVal2, 0x3100u);
for(i = 0; i < 4; i++)
{
if ( plr[i].plractive )
{
if ( currlevel == plr[i].plrlevel )
DoLighting(plr[i].WorldX, plr[i].WorldY, plr[i]._pLightRad, -1);
}
}
}
}
#endif
void __cdecl InitLightMax()
{
lightmax = light4flag == 0 ? 15 : 3;

3
Source/lighting.h

@ -24,6 +24,9 @@ void __fastcall DoVision(int nXPos, int nYPos, int nRadius, unsigned char doauto
void __cdecl FreeLightTable();
void __cdecl InitLightTable();
void __cdecl MakeLightTable();
#ifdef _DEBUG
void __cdecl ToggleLighting();
#endif
void __cdecl InitLightMax();
void __cdecl InitLighting();
int __fastcall AddLight(int x, int y, int r);

2
Support/debug.md

@ -39,7 +39,7 @@ In-game hotkeys
- `d` -> print debug player info
- `D` -> switch current debug player
- `e` -> display "EFlag"
- `l`/`L` -> toggle lighting in dungeon [NOT YET IMPLEMENTED]
- `l`/`L` -> toggle lighting in dungeon
- `m` -> print debug monster info
- `M` -> switch current debug monster
- `r`/`R` -> display game seeds

5
types.h

@ -45,7 +45,10 @@
// If defined, use copy protection [Default -> Defined]
//#define COPYPROT
// If defined, don't reload for debuggers [Default -> Undefined]
//#define DEBUGGER
// Note that with patch 1.03 the command line was hosed, this is required to pass arguments to the game
#ifdef _DEBUG
#define DEBUGGER
#endif
// If defined, don't fry the CPU [Default -> Undefined]
#define SLEEP

Loading…
Cancel
Save