Browse Source

Simplified toggle behavior for button inputs, and added an option to toggle texturing with the circle button.

unrollquadloop
Nico de Poel 3 years ago
parent
commit
989ec0bafb
  1. 1
      display.c
  2. 1
      display.h
  3. 39
      input.c
  4. 2
      world.c

1
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()
{

1
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);

39
input.c

@ -6,15 +6,14 @@
#include <psxpad.h>
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;
}

2
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);

Loading…
Cancel
Save