From f6a577ff6843133c5adbaef98f2d326b66a6d060 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Tue, 19 Feb 2013 20:35:14 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/include/editor.h | 1 + polymer/eduke32/build/src/build.c | 8 +++- polymer/eduke32/package/samples/a.m32 | 52 +++++++++++++++++++++++++- polymer/eduke32/source/m32vars.c | 1 + 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 2f3f42313..6652786fc 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -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 diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 86cc86712..65acc241c 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -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); diff --git a/polymer/eduke32/package/samples/a.m32 b/polymer/eduke32/package/samples/a.m32 index 0b721db3f..7d4c7d5ae 100644 --- a/polymer/eduke32/package/samples/a.m32 +++ b/polymer/eduke32/package/samples/a.m32 @@ -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) diff --git a/polymer/eduke32/source/m32vars.c b/polymer/eduke32/source/m32vars.c index 4e88e7b9b..76dae4e6e 100644 --- a/polymer/eduke32/source/m32vars.c +++ b/polymer/eduke32/source/m32vars.c @@ -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);