From a26eaf82f05fbe623689b55d14ed2269bc3d5ae7 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Sun, 25 Jul 2021 20:45:25 +0300 Subject: [PATCH] Update some comments --- src/id91_11/cat_all/cat3d/c3_def.h | 2 +- src/kdreams/kd_play.c | 26 +++++++++++++++----------- src/wolf3d/wl_main.c | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/id91_11/cat_all/cat3d/c3_def.h b/src/id91_11/cat_all/cat3d/c3_def.h index 9a995d57..887f0974 100644 --- a/src/id91_11/cat_all/cat3d/c3_def.h +++ b/src/id91_11/cat_all/cat3d/c3_def.h @@ -518,7 +518,7 @@ extern id0_unsigned_t wallwidth [VIEWWIDTH]; //extern id0_unsigned_t wallseg [VIEWWIDTH]; extern id0_byte_t *wallseg [VIEWWIDTH]; extern id0_unsigned_t wallofs [VIEWWIDTH]; -// REFKEEN - These arrays may actually be larger than VIEWDITH cells long, +// REFKEEN - These arrays may actually be larger than VIEWWIDTH cells long, // and they're used just in C3_ASM.C anyway //extern id0_unsigned_t screenbyte [VIEWWIDTH]; //extern id0_unsigned_t screenbit [VIEWWIDTH]; diff --git a/src/kdreams/kd_play.c b/src/kdreams/kd_play.c index 36a1b691..d7baf191 100644 --- a/src/kdreams/kd_play.c +++ b/src/kdreams/kd_play.c @@ -1073,7 +1073,7 @@ void ClipToWalls (objtype *ob) // while the flower is in one of the s_pooffrom* states. // // If state == NULL then, under DOS (with Borland C++ 2.0), - // then ob->state->pushtofloor is a part of a small Borland C++ string + // ob->state->pushtofloor is a part of a small Borland C++ string. if (!(ob->state) || ob->state->pushtofloor) //if (ob->state->pushtofloor) { @@ -1305,8 +1305,10 @@ id0_int_t DoActor (objtype *ob,id0_int_t tics) state = ob->state; - // REFKEEN: Workaround for vanilla Keen Dreams bug (state may be 0) - // Based on CGA v1.05 but it may be the same in other versions + // REFKEEN: Vanilla Keen Dreams bug emulation (state may be 0). + // + // If state == NULL then, under DOS (with Borland C++ 2.0), + // state->progress is a part of a small Borland C++ string. if (state && state->progress == think) //if (state->progress == think) { @@ -1324,18 +1326,18 @@ id0_int_t DoActor (objtype *ob,id0_int_t tics) newtics = ob->ticcount+tics; - // REFKEEN: Workaround for vanilla Keen Dreams bug (state may be 0) - // FIXME: Hopefully this always works - Magic number is CGA v1.05 specific, - // but it may actually work with other original versions + // REFKEEN: Vanilla Keen Dreams bug emulation (state may be 0) + // Magic number is based on what would occur if there were a + // null-pointer dereference, assuming the value was never overwritten. if ((!state && newtics < 0x2064) || (state && (newtics < state->tictime || state->tictime == 0))) //if (newtics < state->tictime || state->tictime == 0) { ob->ticcount = newtics; - // REFKEEN: Workaround for vanilla Keen Dreams bug (state may be 0) + // REFKEEN: Vanilla Keen Dreams bug (state may be 0) + // state->progress would differ from all compared values with + // the original DOS versions in that case, unless modified. if (!state) - { - return 0; // Both cases appear to be skipped as of CGA v1.05 - } + return 0; if (state->progress == slide || state->progress == slidethink) { if (ob->xdir) @@ -1434,7 +1436,9 @@ void StateMachine (objtype *ob) // // passed through to next state // - // REFKEEN: Workaround for vanilla Keen Dreams CGA v1.05 bug (state may be 0) + // REFKEEN: Vanilla Keen Dreams CGA v1.05 bug fix (state may be 0). + // state->skippable would be true with the original EXEs if state + // was 0, unless modified earlier. if (state && !state->skippable && excesstics >= state->tictime) //if (!state->skippable && excesstics >= state->tictime) excesstics = DoActor(ob,state->tictime-1); diff --git a/src/wolf3d/wl_main.c b/src/wolf3d/wl_main.c index 8f54864a..617bc0eb 100644 --- a/src/wolf3d/wl_main.c +++ b/src/wolf3d/wl_main.c @@ -1461,7 +1461,7 @@ void DoJukebox(void) if (!UPLOAD) { //#ifndef UPLOAD - // REFKEEN: Use second isn't of hundredth of a sec + // REFKEEN: Use second instead of hundredth of a sec int hour, min, sec; BE_Cross_GetLocalTime_UNSAFE(&hour, &min, &sec); start = (sec%3)*6;