From 989ec0bafb938c9a4fd5ca63bb9b5f351aeebafe Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Wed, 25 Jan 2023 12:56:30 +0100 Subject: [PATCH] Simplified toggle behavior for button inputs, and added an option to toggle texturing with the circle button. --- display.c | 1 + display.h | 1 + input.c | 39 ++++++++++++++------------------------- world.c | 2 +- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/display.c b/display.c index 9253ac2..5763d40 100644 --- a/display.c +++ b/display.c @@ -45,6 +45,7 @@ u_long *curOT; VECTOR aspect_scale = { SCREENWIDTH * ONE / 320, ONE, ONE }; u_short polyCount; +u_char enableTexturing = 1; void display_init() { diff --git a/display.h b/display.h index 44d097a..809fb92 100644 --- a/display.h +++ b/display.h @@ -11,6 +11,7 @@ extern MATRIX vp_matrix; extern u_long *curOT; extern u_short polyCount; +extern u_char enableTexturing; void display_init(); void display_reset(int mode, u_char interlaced, u_char widescreen, int *outScreenHeight); diff --git a/input.c b/input.c index d1a1268..fb8423b 100644 --- a/input.c +++ b/input.c @@ -6,15 +6,14 @@ #include static u_char padBuffer[2][34]; +static u_short prevButtons = 0xFFFF; static const int moveSpeed = 1024; static const short rotSpeed = 1024; static const char deadZone = 0x30; static u_char dispmode = 0; -static u_char dispmode_held = 0; static u_char widescreen = 0; -static u_char widescreen_held = 0; void input_init() { @@ -96,34 +95,22 @@ void input_process() // Look up cam_rot.vx += rotInterval; } - if (!(buttons & PAD_SELECT)) + if (!(buttons & PAD_SELECT) && (prevButtons & PAD_SELECT)) { // Switch display mode - if (!dispmode_held) - { - dispmode_held = 1; - //dispmode = (dispmode + 1) & 0x3; - //display_reset(!!(dispmode & 2), !!(dispmode & 1), widescreen, NULL); - display_reset(!GetVideoMode(), 0, widescreen, NULL); - } + //dispmode = (dispmode + 1) & 0x3; + //display_reset(!!(dispmode & 2), !!(dispmode & 1), widescreen, NULL); + display_reset(!GetVideoMode(), 0, widescreen, NULL); } - else + if (!(buttons & PAD_START) && (prevButtons & PAD_START)) { - dispmode_held = 0; - } - if (!(buttons & PAD_START)) - { - if (!widescreen_held) - { - widescreen_held = 1; - widescreen = !widescreen; - display_reset(GetVideoMode(), 0, widescreen, NULL); - } - } - else - { - widescreen_held = 0; + widescreen = !widescreen; + display_reset(GetVideoMode(), 0, widescreen, NULL); } + if (!(buttons & PAD_CIRCLE) && (prevButtons & PAD_CIRCLE)) + { + enableTexturing = !enableTexturing; + } // Check for analog controller u_char padType = padBuffer[0][1] >> 4; @@ -153,4 +140,6 @@ void input_process() // Look up/down cam_rot.vx -= (rightJoyY * rotInterval) >> 7; } + + prevButtons = buttons; } diff --git a/world.c b/world.c index edb1f38..6e3aea9 100644 --- a/world.c +++ b/world.c @@ -304,7 +304,7 @@ static void world_drawface(const world_t *world, const ps1bsp_face_t *face) if ((dot >= 0) ^ face->side) return; - if (0) + if (!enableTexturing) { // Draw untextured, vertex colored polygons SVECTOR *vecs = (SVECTOR*)(scratchpad + 256);