From ec324e02f2dcc7f3ce16b6af84879118047f6093 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Sun, 9 Nov 2025 19:19:36 -0600 Subject: [PATCH] Fix PSP Deadzones --- CMakeLists.txt | 4 ++-- src/input/input.c | 10 +++++----- src/rpg/entity/entity.c | 20 +++++++------------- src/rpg/entity/entitytype.h | 2 +- src/time/time.h | 2 +- src/ui/uidebug.c | 2 +- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc6eb2..9a43a4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) if(NOT DEFINED DUSK_TARGET_SYSTEM) - set(DUSK_TARGET_SYSTEM "linux") - # set(DUSK_TARGET_SYSTEM "psp") + #set(DUSK_TARGET_SYSTEM "linux") + set(DUSK_TARGET_SYSTEM "psp") endif() # Prep cache diff --git a/src/input/input.c b/src/input/input.c index 2c9340f..ca499d8 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -23,7 +23,7 @@ void inputInit(void) { INPUT.actions[i].currentValue = 0.0f; } - INPUT.deadzone = 0.1f; + INPUT.deadzone = 0.2f; // Setup Default Binds #if INPUT_SDL2 == 1 @@ -52,10 +52,10 @@ void inputInit(void) { inputBind(inputButtonGetByName("right"), INPUT_ACTION_RIGHT); inputBind(inputButtonGetByName("circle"), INPUT_ACTION_CANCEL); inputBind(inputButtonGetByName("cross"), INPUT_ACTION_ACCEPT); - // inputBind(inputButtonGetByName("lstick_negative_y"), INPUT_ACTION_UP); - // inputBind(inputButtonGetByName("lstick_positive_y"), INPUT_ACTION_DOWN); - // inputBind(inputButtonGetByName("lstick_negative_x"), INPUT_ACTION_LEFT); - // inputBind(inputButtonGetByName("lstick_positive_x"), INPUT_ACTION_RIGHT); + inputBind(inputButtonGetByName("lstick_negative_y"), INPUT_ACTION_UP); + inputBind(inputButtonGetByName("lstick_positive_y"), INPUT_ACTION_DOWN); + inputBind(inputButtonGetByName("lstick_negative_x"), INPUT_ACTION_LEFT); + inputBind(inputButtonGetByName("lstick_positive_x"), INPUT_ACTION_RIGHT); #endif #endif #endif diff --git a/src/rpg/entity/entity.c b/src/rpg/entity/entity.c index d808321..859e7ee 100644 --- a/src/rpg/entity/entity.c +++ b/src/rpg/entity/entity.c @@ -81,21 +81,15 @@ void entityWalk(entity_t *entity, const entitydir_t direction) { // TODO: Map bounds in way? // Entity in way? - entity_t *start = ENTITIES; + entity_t *other = ENTITIES; do { - if( - start == entity || - entity->type == ENTITY_TYPE_NULL || - start->position.x != newX || - start->position.y != newY || - start->position.z != entity->position.z - ) { - start++; - continue; - } - + if(other == entity) continue; + if(other->type == ENTITY_TYPE_NULL) continue; + if(other->position.x != newX) continue; + if(other->position.y != newY) continue; + if(other->position.z != entity->position.z) continue; return;// Blocked - } while(start < &ENTITIES[ENTITY_COUNT]); + } while(++other, other < &ENTITIES[ENTITY_COUNT]); // Move. entity->position.x = newX; diff --git a/src/rpg/entity/entitytype.h b/src/rpg/entity/entitytype.h index a556ba0..6ed82d3 100644 --- a/src/rpg/entity/entitytype.h +++ b/src/rpg/entity/entitytype.h @@ -10,7 +10,7 @@ #include "npc.h" typedef enum { - ENTITY_TYPE_NULL, + ENTITY_TYPE_NULL = 0, ENTITY_TYPE_PLAYER, ENTITY_TYPE_NPC, diff --git a/src/time/time.h b/src/time/time.h index a27de2e..e95ae54 100644 --- a/src/time/time.h +++ b/src/time/time.h @@ -8,7 +8,7 @@ #pragma once #include "dusk.h" -#define TIME_STEP (1.0f / 144.0f) // 60 Ticks per second. +#define TIME_STEP (1.0f / 60.0f) // 60 Ticks per second (what we are aiming for) #ifndef TIME_FIXED #define TIME_FIXED 0 diff --git a/src/ui/uidebug.c b/src/ui/uidebug.c index 6073ad2..76f061e 100644 --- a/src/ui/uidebug.c +++ b/src/ui/uidebug.c @@ -77,7 +77,7 @@ void uiDebugRender(const tileset_t *tileset, texture_t *texture) { snprintf( buffer, sizeof(buffer), - "Player: (%d, %d) Dir:%d Anim:%d", + "%d,%d/%d/%d", player->position.x, player->position.y, (int32_t)player->direction,