Mapster32: add "movement by one" debugging functionality via a.m32.

If m32script gamevar "move_by_one" is nonzero, the some keys move the
"player arrow" by increments of 1:
- Without SHIFT: LEFT/RIGHT absolute x, DOWN/UP absolute y, A/Z absolute z.
- With SHIFT: DOWN/UP (unbounded!) horiz, LEFT/RIGHT angle.

This can be useful to debug renderer bugs that show a high sensitivity to the
exact location ("are transient in space").

git-svn-id: https://svn.eduke32.com/eduke32@3509 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-02-19 20:35:14 +00:00
parent b4ae8c4238
commit f6a577ff68
4 changed files with 58 additions and 4 deletions

View file

@ -39,6 +39,7 @@
extern int32_t horiz;
extern vec3_t pos;
extern int16_t ang, cursectnum;
extern int32_t g_doHardcodedMovement;
extern int8_t m32_clipping; // 0: none, 1: only white walls, 2: like game

View file

@ -50,7 +50,8 @@ uint8_t buildkeys[NUMBUILDKEYS] =
vec3_t pos;
int32_t horiz = 100;
int16_t ang, cursectnum;
int32_t hvel, vel, svel, angvel;
static int32_t hvel, vel, svel, angvel;
int32_t g_doHardcodedMovement;
static int32_t mousexsurp = 0, mouseysurp = 0;
@ -10195,8 +10196,11 @@ void showspritedata(int16_t spritenum, int16_t small)
#undef DOPRINT
// gets called once per totalclock increment since last call
void keytimerstuff(void)
static void keytimerstuff(void)
{
if (!g_doHardcodedMovement)
return;
if (DOWN_BK(STRAFE) == 0)
{
if (DOWN_BK(TURNLEFT)) angvel = max(angvel-pk_turnaccel, -128);

View file

@ -38,6 +38,8 @@ gamevar use_notebook_keys 0 0
// only when aimed at (and locked onto) the RESPAWN sprite in 3D mode.
gamevar showrespawn_always 0 0
gamevar move_by_one 0 0
// see end of file for more user settings and examples
////////// END USER SETTINGS //////////
@ -424,12 +426,45 @@ defstate fiddlewithlights
}
ends
defstate do_move_by_one
ifeithershift
{
ifhitkey KEY_UP sub horiz 1
ifhitkey KEY_DOWN add horiz 1
ifhitkey KEY_LEFT sub ang 1
ifhitkey KEY_RIGHT add ang 1
and ang 2047
}
else
{
// absolute x/y/z navigation
ifhitkey KEY_LEFT sub posx 1
ifhitkey KEY_RIGHT add posx 1
ifhitkey KEY_DOWN sub posy 1
ifhitkey KEY_UP add posy 1
ifhitkey KEY_A sub posz 1
ifhitkey KEY_Z add posz 1
}
ends
defstate check_move_by_one
ifn move_by_one 0
set hardcoded_movement 0
else
set hardcoded_movement 1
ends
// forward refs
defstate userkeys_3d ends
defstate userdrawlabel ends
onevent EVENT_PREKEYS3D
// state testkeyavail
state check_move_by_one
ifn move_by_one 0
state do_move_by_one
state fiddlewithlights
state userkeys_3d
endevent
@ -500,6 +535,10 @@ ends
onevent EVENT_PREKEYS2D
state check_move_by_one
ifn move_by_one 0
state do_move_by_one
ifvare do_batch_extension 1
set do_batch_extension 2
else ifvare do_batch_extension 2
@ -1442,8 +1481,17 @@ ends
gamevar scrshot 0 1
/*
onevent EVENT_DRAW3DSCREEN
ifn move_by_one 0
{
qsprintf TQUOTE "x,y,z = %d, %d, %d" posx posy posz
printext256 TQUOTE 30 30 -15 0 0
qsprintf TQUOTE "horiz,ang = %d, %d" horiz ang
printext256 TQUOTE 30 40 -15 0 0
}
/*
ifge searchwall 0, ifl searchwall MAXWALLS
{
// Which wall is considered targeted?
@ -1453,8 +1501,8 @@ onevent EVENT_DRAW3DSCREEN
qsprintf TQUOTE "y panning = %d" wall[searchwall].ypanning
printext256 TQUOTE 30 40 -15 0 0
}
endevent
*/
endevent
// convenience rebindings for notebooks:
// Alt-F11 --> SCROLL LOCK (set first position)

View file

@ -576,6 +576,7 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("ang",(intptr_t)&ang, GAMEVAR_SHORTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("horiz",(intptr_t)&horiz, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("cursectnum",(intptr_t)&cursectnum, GAMEVAR_READONLY | GAMEVAR_SHORTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("hardcoded_movement",(intptr_t)&g_doHardcodedMovement, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("searchx",(intptr_t)&searchx, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("searchy",(intptr_t)&searchy, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);