summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-11-05 17:05:16 +0200
committerSergeanur <s.anureev@yandex.ua>2020-11-05 17:05:16 +0200
commit8224a6a38156ccba7c69b66fab3388463fc727b1 (patch)
treee274d6a8e74d361cc5d5e654f7ca7a1d234f07a8
parent881a3e1091fa1fcf6d8e52e358a614bff32f0201 (diff)
Button icons
-rw-r--r--gamefiles/models/x360btns.txdbin0 -> 126760 bytes
-rw-r--r--src/core/ControllerConfig.cpp569
-rw-r--r--src/core/config.h1
-rw-r--r--src/render/Font.cpp172
-rw-r--r--src/render/Font.h33
5 files changed, 403 insertions, 372 deletions
diff --git a/gamefiles/models/x360btns.txd b/gamefiles/models/x360btns.txd
new file mode 100644
index 00000000..27837c2f
--- /dev/null
+++ b/gamefiles/models/x360btns.txd
Binary files differ
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index dcc294c8..504b832c 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -2316,199 +2316,207 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
return num;
}
-const char *XboxButtons[][MAX_CONTROLLERACTIONS] =
-{
- {
- "B", // PED_FIREWEAPON
- "RT", // PED_CYCLE_WEAPON_RIGHT
- "LT", // PED_CYCLE_WEAPON_LEFT
- nil, // GO_FORWARD
- nil, // GO_BACK
- nil, // GO_LEFT
- nil, // GO_RIGHT
- "X", // PED_SNIPER_ZOOM_IN
- "A", // PED_SNIPER_ZOOM_OUT
- "Y", // VEHICLE_ENTER_EXIT
- "BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
- "X", // PED_JUMPING
- "A", // PED_SPRINT
- "RS", // PED_LOOKBEHIND
-#ifdef BIND_VEHICLE_FIREWEAPON
- "B", // VEHICLE_FIREWEAPON
-#endif
- "A", // VEHICLE_ACCELERATE
- "X", // VEHICLE_BRAKE
- "LB", // VEHICLE_CHANGE_RADIO_STATION
- "LS", // VEHICLE_HORN
- "RS", // TOGGLE_SUBMISSIONS
- "RB", // VEHICLE_HANDBRAKE
- nil, // PED_1RST_PERSON_LOOK_LEFT
- nil, // PED_1RST_PERSON_LOOK_RIGHT
- "LT", // VEHICLE_LOOKLEFT
- "RT", // VEHICLE_LOOKRIGHT
- nil, // VEHICLE_LOOKBEHIND
- nil, // VEHICLE_TURRETLEFT
- nil, // VEHICLE_TURRETRIGHT
- nil, // VEHICLE_TURRETUP
- nil, // VEHICLE_TURRETDOWN
- "LT", // PED_CYCLE_TARGET_LEFT
- "RT", // PED_CYCLE_TARGET_RIGHT
- "LB", // PED_CENTER_CAMERA_BEHIND_PLAYER
- "RB", // PED_LOCK_TARGET
- nil, // NETWORK_TALK
- nil, // PED_1RST_PERSON_LOOK_UP
- nil, // PED_1RST_PERSON_LOOK_DOWN
- nil, // _CONTROLLERACTION_36
- nil, // TOGGLE_DPAD
- nil, // SWITCH_DEBUG_CAM_ON
- nil, // TAKE_SCREEN_SHOT
- nil, // SHOW_MOUSE_POINTER_TOGGLE
- },
- {
- "B", // PED_FIREWEAPON
- "RT", // PED_CYCLE_WEAPON_RIGHT
- "LT", // PED_CYCLE_WEAPON_LEFT
- nil, // GO_FORWARD
- nil, // GO_BACK
- nil, // GO_LEFT
- nil, // GO_RIGHT
- "X", // PED_SNIPER_ZOOM_IN
- "A", // PED_SNIPER_ZOOM_OUT
- "Y", // VEHICLE_ENTER_EXIT
- "BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
- "X", // PED_JUMPING
- "A", // PED_SPRINT
- "RS", // PED_LOOKBEHIND
-#ifdef BIND_VEHICLE_FIREWEAPON
- "B", // VEHICLE_FIREWEAPON
-#endif
- "A", // VEHICLE_ACCELERATE
- "X", // VEHICLE_BRAKE
- "BACK", // VEHICLE_CHANGE_RADIO_STATION
- "LB", // VEHICLE_HORN
- "RS", // TOGGLE_SUBMISSIONS
- "RB", // VEHICLE_HANDBRAKE
- nil, // PED_1RST_PERSON_LOOK_LEFT
- nil, // PED_1RST_PERSON_LOOK_RIGHT
- "LT", // VEHICLE_LOOKLEFT
- "RT", // VEHICLE_LOOKRIGHT
- nil, // VEHICLE_LOOKBEHIND
- nil, // VEHICLE_TURRETLEFT
- nil, // VEHICLE_TURRETRIGHT
- nil, // VEHICLE_TURRETUP
- nil, // VEHICLE_TURRETDOWN
- "LT", // PED_CYCLE_TARGET_LEFT
- "RT", // PED_CYCLE_TARGET_RIGHT
- "LB", // PED_CENTER_CAMERA_BEHIND_PLAYER
- "RB", // PED_LOCK_TARGET
- nil, // NETWORK_TALK
- nil, // PED_1RST_PERSON_LOOK_UP
- nil, // PED_1RST_PERSON_LOOK_DOWN
- nil, // _CONTROLLERACTION_36
- nil, // TOGGLE_DPAD
- nil, // SWITCH_DEBUG_CAM_ON
- nil, // TAKE_SCREEN_SHOT
- nil, // SHOW_MOUSE_POINTER_TOGGLE
- },
- {
- "A", // PED_FIREWEAPON
- "RT", // PED_CYCLE_WEAPON_RIGHT
- "LT", // PED_CYCLE_WEAPON_LEFT
- nil, // GO_FORWARD
- nil, // GO_BACK
- nil, // GO_LEFT
- nil, // GO_RIGHT
- "Y", // PED_SNIPER_ZOOM_IN
- "X", // PED_SNIPER_ZOOM_OUT
- "LB", // VEHICLE_ENTER_EXIT
- "BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
- "X", // PED_JUMPING
- "B", // PED_SPRINT
- "RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
- "B", // VEHICLE_FIREWEAPON
+#define VFB(b) b,
+#else
+#define VFB(b)
#endif
- "A", // VEHICLE_ACCELERATE
- "X", // VEHICLE_BRAKE
- "LS", // VEHICLE_CHANGE_RADIO_STATION
- "RB", // VEHICLE_HORN
- "RS", // TOGGLE_SUBMISSIONS
- "Y", // VEHICLE_HANDBRAKE
- nil, // PED_1RST_PERSON_LOOK_LEFT
- nil, // PED_1RST_PERSON_LOOK_RIGHT
- "LT", // VEHICLE_LOOKLEFT
- "RT", // VEHICLE_LOOKRIGHT
- nil, // VEHICLE_LOOKBEHIND
- nil, // VEHICLE_TURRETLEFT
- nil, // VEHICLE_TURRETRIGHT
- nil, // VEHICLE_TURRETUP
- nil, // VEHICLE_TURRETDOWN
- "LT", // PED_CYCLE_TARGET_LEFT
- "RT", // PED_CYCLE_TARGET_RIGHT
- "Y", // PED_CENTER_CAMERA_BEHIND_PLAYER
- "RB", // PED_LOCK_TARGET
- nil, // NETWORK_TALK
- nil, // PED_1RST_PERSON_LOOK_UP
- nil, // PED_1RST_PERSON_LOOK_DOWN
- nil, // _CONTROLLERACTION_36
- nil, // TOGGLE_DPAD
- nil, // SWITCH_DEBUG_CAM_ON
- nil, // TAKE_SCREEN_SHOT
- nil, // SHOW_MOUSE_POINTER_TOGGLE
- },
- {
- "RB", // PED_FIREWEAPON
- "RT", // PED_CYCLE_WEAPON_RIGHT
- "LT", // PED_CYCLE_WEAPON_LEFT
- nil, // GO_FORWARD
- nil, // GO_BACK
- nil, // GO_LEFT
- nil, // GO_RIGHT
- "X", // PED_SNIPER_ZOOM_IN
- "A", // PED_SNIPER_ZOOM_OUT
- "Y", // VEHICLE_ENTER_EXIT
- "BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
- "X", // PED_JUMPING
- "A", // PED_SPRINT
- "RS", // PED_LOOKBEHIND
-#ifdef BIND_VEHICLE_FIREWEAPON
- "RB", // VEHICLE_FIREWEAPON
+
+#define CONTROLLER_BUTTONS(T, O, X, Q, L1, L2, L3, R1, R2, R3, SELECT) \
+ {{ \
+ O, /* PED_FIREWEAPON */ \
+ R2, /* PED_CYCLE_WEAPON_RIGHT */ \
+ L2, /* PED_CYCLE_WEAPON_LEFT */ \
+ nil, /* GO_FORWARD */ \
+ nil, /* GO_BACK */ \
+ nil, /* GO_LEFT */ \
+ nil, /* GO_RIGHT */ \
+ Q, /* PED_SNIPER_ZOOM_IN */ \
+ X, /* PED_SNIPER_ZOOM_OUT */ \
+ T, /* VEHICLE_ENTER_EXIT */ \
+ SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
+ Q, /* PED_JUMPING */ \
+ X, /* PED_SPRINT */ \
+ R3, /* PED_LOOKBEHIND */ \
+ VFB(O) /* VEHICLE_FIREWEAPON */ \
+ X, /* VEHICLE_ACCELERATE */ \
+ Q, /* VEHICLE_BRAKE */ \
+ L1, /* VEHICLE_CHANGE_RADIO_STATION */ \
+ L3, /* VEHICLE_HORN */ \
+ R3, /* TOGGLE_SUBMISSIONS */ \
+ R1, /* VEHICLE_HANDBRAKE */ \
+ nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
+ nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
+ L2, /* VEHICLE_LOOKLEFT */ \
+ R2, /* VEHICLE_LOOKRIGHT */ \
+ nil, /* VEHICLE_LOOKBEHIND */ \
+ nil, /* VEHICLE_TURRETLEFT */ \
+ nil, /* VEHICLE_TURRETRIGHT */ \
+ nil, /* VEHICLE_TURRETUP */ \
+ nil, /* VEHICLE_TURRETDOWN */ \
+ L2, /* PED_CYCLE_TARGET_LEFT */ \
+ R2, /* PED_CYCLE_TARGET_RIGHT */ \
+ L1, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
+ R1, /* PED_LOCK_TARGET */ \
+ nil, /* NETWORK_TALK */ \
+ nil, /* PED_1RST_PERSON_LOOK_UP */ \
+ nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
+ nil, /* _CONTROLLERACTION_36 */ \
+ nil, /* TOGGLE_DPAD */ \
+ nil, /* SWITCH_DEBUG_CAM_ON */ \
+ nil, /* TAKE_SCREEN_SHOT */ \
+ nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
+ }, \
+ { \
+ O, /* PED_FIREWEAPON */ \
+ R2, /* PED_CYCLE_WEAPON_RIGHT */ \
+ L2, /* PED_CYCLE_WEAPON_LEFT */ \
+ nil, /* GO_FORWARD */ \
+ nil, /* GO_BACK */ \
+ nil, /* GO_LEFT */ \
+ nil, /* GO_RIGHT */ \
+ Q, /* PED_SNIPER_ZOOM_IN */ \
+ X, /* PED_SNIPER_ZOOM_OUT */ \
+ T, /* VEHICLE_ENTER_EXIT */ \
+ SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
+ Q, /* PED_JUMPING */ \
+ X, /* PED_SPRINT */ \
+ R3, /* PED_LOOKBEHIND */ \
+ VFB(O) /* VEHICLE_FIREWEAPON */ \
+ X, /* VEHICLE_ACCELERATE */ \
+ Q, /* VEHICLE_BRAKE */ \
+ SELECT, /* VEHICLE_CHANGE_RADIO_STATION */ \
+ L1, /* VEHICLE_HORN */ \
+ R3, /* TOGGLE_SUBMISSIONS */ \
+ R1, /* VEHICLE_HANDBRAKE */ \
+ nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
+ nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
+ L2, /* VEHICLE_LOOKLEFT */ \
+ R2, /* VEHICLE_LOOKRIGHT */ \
+ nil, /* VEHICLE_LOOKBEHIND */ \
+ nil, /* VEHICLE_TURRETLEFT */ \
+ nil, /* VEHICLE_TURRETRIGHT */ \
+ nil, /* VEHICLE_TURRETUP */ \
+ nil, /* VEHICLE_TURRETDOWN */ \
+ L2, /* PED_CYCLE_TARGET_LEFT */ \
+ R2, /* PED_CYCLE_TARGET_RIGHT */ \
+ L1, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
+ R1, /* PED_LOCK_TARGET */ \
+ nil, /* NETWORK_TALK */ \
+ nil, /* PED_1RST_PERSON_LOOK_UP */ \
+ nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
+ nil, /* _CONTROLLERACTION_36 */ \
+ nil, /* TOGGLE_DPAD */ \
+ nil, /* SWITCH_DEBUG_CAM_ON */ \
+ nil, /* TAKE_SCREEN_SHOT */ \
+ nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
+ }, \
+ { \
+ X, /* PED_FIREWEAPON */ \
+ R2, /* PED_CYCLE_WEAPON_RIGHT */ \
+ L2, /* PED_CYCLE_WEAPON_LEFT */ \
+ nil, /* GO_FORWARD */ \
+ nil, /* GO_BACK */ \
+ nil, /* GO_LEFT */ \
+ nil, /* GO_RIGHT */ \
+ T, /* PED_SNIPER_ZOOM_IN */ \
+ Q, /* PED_SNIPER_ZOOM_OUT */ \
+ L1, /* VEHICLE_ENTER_EXIT */ \
+ SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
+ Q, /* PED_JUMPING */ \
+ O, /* PED_SPRINT */ \
+ R3, /* PED_LOOKBEHIND */ \
+ VFB(O) /* VEHICLE_FIREWEAPON */ \
+ X, /* VEHICLE_ACCELERATE */ \
+ Q, /* VEHICLE_BRAKE */ \
+ L3, /* VEHICLE_CHANGE_RADIO_STATION */ \
+ R1, /* VEHICLE_HORN */ \
+ R3, /* TOGGLE_SUBMISSIONS */ \
+ T, /* VEHICLE_HANDBRAKE */ \
+ nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
+ nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
+ L2, /* VEHICLE_LOOKLEFT */ \
+ R2, /* VEHICLE_LOOKRIGHT */ \
+ nil, /* VEHICLE_LOOKBEHIND */ \
+ nil, /* VEHICLE_TURRETLEFT */ \
+ nil, /* VEHICLE_TURRETRIGHT */ \
+ nil, /* VEHICLE_TURRETUP */ \
+ nil, /* VEHICLE_TURRETDOWN */ \
+ L2, /* PED_CYCLE_TARGET_LEFT */ \
+ R2, /* PED_CYCLE_TARGET_RIGHT */ \
+ T, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
+ R1, /* PED_LOCK_TARGET */ \
+ nil, /* NETWORK_TALK */ \
+ nil, /* PED_1RST_PERSON_LOOK_UP */ \
+ nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
+ nil, /* _CONTROLLERACTION_36 */ \
+ nil, /* TOGGLE_DPAD */ \
+ nil, /* SWITCH_DEBUG_CAM_ON */ \
+ nil, /* TAKE_SCREEN_SHOT */ \
+ nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
+ }, \
+ { \
+ R1, /* PED_FIREWEAPON */ \
+ R2, /* PED_CYCLE_WEAPON_RIGHT */ \
+ L2, /* PED_CYCLE_WEAPON_LEFT */ \
+ nil, /* GO_FORWARD */ \
+ nil, /* GO_BACK */ \
+ nil, /* GO_LEFT */ \
+ nil, /* GO_RIGHT */ \
+ Q, /* PED_SNIPER_ZOOM_IN */ \
+ X, /* PED_SNIPER_ZOOM_OUT */ \
+ T, /* VEHICLE_ENTER_EXIT */ \
+ SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
+ Q, /* PED_JUMPING */ \
+ X, /* PED_SPRINT */ \
+ R3, /* PED_LOOKBEHIND */ \
+ VFB(R1) /* VEHICLE_FIREWEAPON */ \
+ nil, /* VEHICLE_ACCELERATE */ \
+ nil, /* VEHICLE_BRAKE */ \
+ O, /* VEHICLE_CHANGE_RADIO_STATION */ \
+ L3, /* VEHICLE_HORN */ \
+ Q, /* TOGGLE_SUBMISSIONS */ \
+ L1, /* VEHICLE_HANDBRAKE */ \
+ nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
+ nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
+ L2, /* VEHICLE_LOOKLEFT */ \
+ R2, /* VEHICLE_LOOKRIGHT */ \
+ nil, /* VEHICLE_LOOKBEHIND */ \
+ nil, /* VEHICLE_TURRETLEFT */ \
+ nil, /* VEHICLE_TURRETRIGHT */ \
+ nil, /* VEHICLE_TURRETUP */ \
+ nil, /* VEHICLE_TURRETDOWN */ \
+ L2, /* PED_CYCLE_TARGET_LEFT */ \
+ R2, /* PED_CYCLE_TARGET_RIGHT */ \
+ O, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
+ L1, /* PED_LOCK_TARGET */ \
+ nil, /* NETWORK_TALK */ \
+ nil, /* PED_1RST_PERSON_LOOK_UP */ \
+ nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
+ nil, /* _CONTROLLERACTION_36 */ \
+ nil, /* TOGGLE_DPAD */ \
+ nil, /* SWITCH_DEBUG_CAM_ON */ \
+ nil, /* TAKE_SCREEN_SHOT */ \
+ nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
+ }}
+
+#ifdef BUTTON_ICONS
+const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK");
+#else
+const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("Y", "B", "A", "X", "LB", "LT", "LS", "RB", "RT", "RS", "BACK");
#endif
- nil, // VEHICLE_ACCELERATE
- nil, // VEHICLE_BRAKE
- "B", // VEHICLE_CHANGE_RADIO_STATION
- "LS", // VEHICLE_HORN
- "X", // TOGGLE_SUBMISSIONS
- "LB", // VEHICLE_HANDBRAKE
- nil, // PED_1RST_PERSON_LOOK_LEFT
- nil, // PED_1RST_PERSON_LOOK_RIGHT
- "LT", // VEHICLE_LOOKLEFT
- "RT", // VEHICLE_LOOKRIGHT
- nil, // VEHICLE_LOOKBEHIND
- nil, // VEHICLE_TURRETLEFT
- nil, // VEHICLE_TURRETRIGHT
- nil, // VEHICLE_TURRETUP
- nil, // VEHICLE_TURRETDOWN
- "LT", // PED_CYCLE_TARGET_LEFT
- "RT", // PED_CYCLE_TARGET_RIGHT
- "B", // PED_CENTER_CAMERA_BEHIND_PLAYER
- "LB", // PED_LOCK_TARGET
- nil, // NETWORK_TALK
- nil, // PED_1RST_PERSON_LOOK_UP
- nil, // PED_1RST_PERSON_LOOK_DOWN
- nil, // _CONTROLLERACTION_36
- nil, // TOGGLE_DPAD
- nil, // SWITCH_DEBUG_CAM_ON
- nil, // TAKE_SCREEN_SHOT
- nil, // SHOW_MOUSE_POINTER_TOGGLE
- }
-};
+
#if 0 // set 1 for ps2 fonts
#define PS2_TRIANGLE "\""
#define PS2_CIRCLE "|"
#define PS2_CROSS "/"
#define PS2_SQUARE "^"
+#elif defined(BUTTON_ICONS)
+#define PS2_TRIANGLE "~T~"
+#define PS2_CIRCLE "~O~"
+#define PS2_CROSS "~X~"
+#define PS2_SQUARE "~Q~"
#else
#define PS2_TRIANGLE "TRIANGLE"
#define PS2_CIRCLE "CIRCLE"
@@ -2516,199 +2524,22 @@ const char *XboxButtons[][MAX_CONTROLLERACTIONS] =
#define PS2_SQUARE "SQUARE"
#endif
+#ifdef BUTTON_ICONS
const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
-{
- {
- PS2_CIRCLE, // PED_FIREWEAPON
- "R2", // PED_CYCLE_WEAPON_RIGHT
- "L2", // PED_CYCLE_WEAPON_LEFT
- nil, // GO_FORWARD
- nil, // GO_BACK
- nil, // GO_LEFT
- nil, // GO_RIGHT
- PS2_SQUARE, // PED_SNIPER_ZOOM_IN
- PS2_CROSS, // PED_SNIPER_ZOOM_OUT
- PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
- "SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
- PS2_SQUARE, // PED_JUMPING
- PS2_CROSS, // PED_SPRINT
- "R3", // PED_LOOKBEHIND
-#ifdef BIND_VEHICLE_FIREWEAPON
- PS2_CIRCLE, // VEHICLE_FIREWEAPON
-#endif
- PS2_CROSS, // VEHICLE_ACCELERATE
- PS2_SQUARE, // VEHICLE_BRAKE
- "L1", // VEHICLE_CHANGE_RADIO_STATION
- "L3", // VEHICLE_HORN
- "R3", // TOGGLE_SUBMISSIONS
- "R1", // VEHICLE_HANDBRAKE
- nil, // PED_1RST_PERSON_LOOK_LEFT
- nil, // PED_1RST_PERSON_LOOK_RIGHT
- "L2", // VEHICLE_LOOKLEFT
- "R2", // VEHICLE_LOOKRIGHT
- nil, // VEHICLE_LOOKBEHIND
- nil, // VEHICLE_TURRETLEFT
- nil, // VEHICLE_TURRETRIGHT
- nil, // VEHICLE_TURRETUP
- nil, // VEHICLE_TURRETDOWN
- "L2", // PED_CYCLE_TARGET_LEFT
- "R2", // PED_CYCLE_TARGET_RIGHT
- "L1", // PED_CENTER_CAMERA_BEHIND_PLAYER
- "R1", // PED_LOCK_TARGET
- nil, // NETWORK_TALK
- nil, // PED_1RST_PERSON_LOOK_UP
- nil, // PED_1RST_PERSON_LOOK_DOWN
- nil, // _CONTROLLERACTION_36
- nil, // TOGGLE_DPAD
- nil, // SWITCH_DEBUG_CAM_ON
- nil, // TAKE_SCREEN_SHOT
- nil, // SHOW_MOUSE_POINTER_TOGGLE
- },
- {
- PS2_CIRCLE, // PED_FIREWEAPON
- "R2", // PED_CYCLE_WEAPON_RIGHT
- "L2", // PED_CYCLE_WEAPON_LEFT
- nil, // GO_FORWARD
- nil, // GO_BACK
- nil, // GO_LEFT
- nil, // GO_RIGHT
- PS2_SQUARE, // PED_SNIPER_ZOOM_IN
- PS2_CROSS, // PED_SNIPER_ZOOM_OUT
- PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
- "SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
- PS2_SQUARE, // PED_JUMPING
- PS2_CROSS, // PED_SPRINT
- "R3", // PED_LOOKBEHIND
-#ifdef BIND_VEHICLE_FIREWEAPON
- PS2_CIRCLE, // VEHICLE_FIREWEAPON
-#endif
- PS2_CROSS, // VEHICLE_ACCELERATE
- PS2_SQUARE, // VEHICLE_BRAKE
- "BACK", // VEHICLE_CHANGE_RADIO_STATION
- "L1", // VEHICLE_HORN
- "R3", // TOGGLE_SUBMISSIONS
- "R1", // VEHICLE_HANDBRAKE
- nil, // PED_1RST_PERSON_LOOK_LEFT
- nil, // PED_1RST_PERSON_LOOK_RIGHT
- "L2", // VEHICLE_LOOKLEFT
- "R2", // VEHICLE_LOOKRIGHT
- nil, // VEHICLE_LOOKBEHIND
- nil, // VEHICLE_TURRETLEFT
- nil, // VEHICLE_TURRETRIGHT
- nil, // VEHICLE_TURRETUP
- nil, // VEHICLE_TURRETDOWN
- "L2", // PED_CYCLE_TARGET_LEFT
- "R2", // PED_CYCLE_TARGET_RIGHT
- "L1", // PED_CENTER_CAMERA_BEHIND_PLAYER
- "R1", // PED_LOCK_TARGET
- nil, // NETWORK_TALK
- nil, // PED_1RST_PERSON_LOOK_UP
- nil, // PED_1RST_PERSON_LOOK_DOWN
- nil, // _CONTROLLERACTION_36
- nil, // TOGGLE_DPAD
- nil, // SWITCH_DEBUG_CAM_ON
- nil, // TAKE_SCREEN_SHOT
- nil, // SHOW_MOUSE_POINTER_TOGGLE
- },
- {
- PS2_CROSS, // PED_FIREWEAPON
- "R2", // PED_CYCLE_WEAPON_RIGHT
- "L2", // PED_CYCLE_WEAPON_LEFT
- nil, // GO_FORWARD
- nil, // GO_BACK
- nil, // GO_LEFT
- nil, // GO_RIGHT
- PS2_TRIANGLE, // PED_SNIPER_ZOOM_IN
- PS2_SQUARE, // PED_SNIPER_ZOOM_OUT
- "L1", // VEHICLE_ENTER_EXIT
- "BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
- PS2_SQUARE, // PED_JUMPING
- PS2_CIRCLE, // PED_SPRINT
- "R3", // PED_LOOKBEHIND
-#ifdef BIND_VEHICLE_FIREWEAPON
- PS2_CIRCLE, // VEHICLE_FIREWEAPON
-#endif
- PS2_CROSS, // VEHICLE_ACCELERATE
- PS2_SQUARE, // VEHICLE_BRAKE
- "L3", // VEHICLE_CHANGE_RADIO_STATION
- "R1", // VEHICLE_HORN
- "R3", // TOGGLE_SUBMISSIONS
- PS2_TRIANGLE, // VEHICLE_HANDBRAKE
- nil, // PED_1RST_PERSON_LOOK_LEFT
- nil, // PED_1RST_PERSON_LOOK_RIGHT
- "L2", // VEHICLE_LOOKLEFT
- "R2", // VEHICLE_LOOKRIGHT
- nil, // VEHICLE_LOOKBEHIND
- nil, // VEHICLE_TURRETLEFT
- nil, // VEHICLE_TURRETRIGHT
- nil, // VEHICLE_TURRETUP
- nil, // VEHICLE_TURRETDOWN
- "L2", // PED_CYCLE_TARGET_LEFT
- "R2", // PED_CYCLE_TARGET_RIGHT
- PS2_TRIANGLE, // PED_CENTER_CAMERA_BEHIND_PLAYER
- "R1", // PED_LOCK_TARGET
- nil, // NETWORK_TALK
- nil, // PED_1RST_PERSON_LOOK_UP
- nil, // PED_1RST_PERSON_LOOK_DOWN
- nil, // _CONTROLLERACTION_36
- nil, // TOGGLE_DPAD
- nil, // SWITCH_DEBUG_CAM_ON
- nil, // TAKE_SCREEN_SHOT
- nil, // SHOW_MOUSE_POINTER_TOGGLE
- },
- {
- "R1", // PED_FIREWEAPON
- "R2", // PED_CYCLE_WEAPON_RIGHT
- "L2", // PED_CYCLE_WEAPON_LEFT
- nil, // GO_FORWARD
- nil, // GO_BACK
- nil, // GO_LEFT
- nil, // GO_RIGHT
- PS2_SQUARE, // PED_SNIPER_ZOOM_IN
- PS2_CROSS, // PED_SNIPER_ZOOM_OUT
- PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
- "SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
- PS2_SQUARE, // PED_JUMPING
- PS2_CROSS, // PED_SPRINT
- "R3", // PED_LOOKBEHIND
-#ifdef BIND_VEHICLE_FIREWEAPON
- "R1", // VEHICLE_FIREWEAPON
+ CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "SELECT");
+#else
+const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
+ CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "L1", "L2", "L3", "R1", "R2", "R3", "SELECT");
#endif
- nil, // VEHICLE_ACCELERATE
- nil, // VEHICLE_BRAKE
- PS2_CIRCLE, // VEHICLE_CHANGE_RADIO_STATION
- "L3", // VEHICLE_HORN
- PS2_SQUARE, // TOGGLE_SUBMISSIONS
- "L1", // VEHICLE_HANDBRAKE
- nil, // PED_1RST_PERSON_LOOK_LEFT
- nil, // PED_1RST_PERSON_LOOK_RIGHT
- "L2", // VEHICLE_LOOKLEFT
- "R2", // VEHICLE_LOOKRIGHT
- nil, // VEHICLE_LOOKBEHIND
- nil, // VEHICLE_TURRETLEFT
- nil, // VEHICLE_TURRETRIGHT
- nil, // VEHICLE_TURRETUP
- nil, // VEHICLE_TURRETDOWN
- "L2", // PED_CYCLE_TARGET_LEFT
- "R2", // PED_CYCLE_TARGET_RIGHT
- PS2_CIRCLE, // PED_CENTER_CAMERA_BEHIND_PLAYER
- "L1", // PED_LOCK_TARGET
- nil, // NETWORK_TALK
- nil, // PED_1RST_PERSON_LOOK_UP
- nil, // PED_1RST_PERSON_LOOK_DOWN
- nil, // _CONTROLLERACTION_36
- nil, // TOGGLE_DPAD
- nil, // SWITCH_DEBUG_CAM_ON
- nil, // TAKE_SCREEN_SHOT
- nil, // SHOW_MOUSE_POINTER_TOGGLE
- }
-};
#undef PS2_TRIANGLE
#undef PS2_CIRCLE
#undef PS2_CROSS
#undef PS2_SQUARE
+#undef CONTROLLER_BUTTONS
+#undef VFB
+
void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *text, uint16 leight)
{
#ifdef DETECT_PAD_INPUT_SWITCH
diff --git a/src/core/config.h b/src/core/config.h
index 9af75405..bdc5cd54 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -258,6 +258,7 @@ enum Config {
#define ALT_DODO_CHEAT
#define REGISTER_START_BUTTON
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
+#define BUTTON_ICONS // use textures to show controller buttons
// Hud, frontend and radar
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index d0b554dd..6aceaf4b 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -224,6 +224,11 @@ wchar foreign_table[128] = {
0, 174, 165, 166, 167, 0, 168, 0, 0, 169, 170, 171, 172, 0, 0, 0,
};
+#ifdef BUTTON_ICONS
+CSprite2d CFont::ButtonSprite[MAX_BUTTON_ICONS];
+int CFont::PS2Symbol = BUTTON_NONE;
+#endif // BUTTON_ICONS
+
void
CFont::Initialise(void)
{
@@ -281,6 +286,31 @@ CFont::Initialise(void)
SetAlphaFade(255.0f);
SetDropShadowPosition(0);
CTxdStore::PopCurrentTxd();
+
+#ifdef BUTTON_ICONS
+ slot = CTxdStore::AddTxdSlot("buttons");
+ CTxdStore::LoadTxd(slot, "MODELS/X360BTNS.TXD");
+ CTxdStore::AddRef(slot);
+ CTxdStore::PushCurrentTxd();
+ CTxdStore::SetCurrentTxd(slot);
+#if 0 // unused
+ ButtonSprite[BUTTON_UP].SetTexture("up");
+ ButtonSprite[BUTTON_DOWN].SetTexture("down");
+ ButtonSprite[BUTTON_LEFT].SetTexture("left");
+ ButtonSprite[BUTTON_RIGHT].SetTexture("right");
+#endif
+ ButtonSprite[BUTTON_CROSS].SetTexture("cross");
+ ButtonSprite[BUTTON_CIRCLE].SetTexture("circle");
+ ButtonSprite[BUTTON_SQUARE].SetTexture("square");
+ ButtonSprite[BUTTON_TRIANGLE].SetTexture("triangle");
+ ButtonSprite[BUTTON_L1].SetTexture("l1");
+ ButtonSprite[BUTTON_L2].SetTexture("l2");
+ ButtonSprite[BUTTON_L3].SetTexture("l3");
+ ButtonSprite[BUTTON_R1].SetTexture("r1");
+ ButtonSprite[BUTTON_R2].SetTexture("r2");
+ ButtonSprite[BUTTON_R3].SetTexture("r3");
+ CTxdStore::PopCurrentTxd();
+#endif // BUTTON_ICONS
}
#ifdef MORE_LANGUAGES
@@ -329,6 +359,11 @@ CFont::ReloadFonts(uint8 set)
void
CFont::Shutdown(void)
{
+#ifdef BUTTON_ICONS
+ for (int i = 0; i < MAX_BUTTON_ICONS; i++)
+ ButtonSprite[i].Delete();
+ CTxdStore::RemoveTxdSlot(CTxdStore::FindTxdSlot("buttons"));
+#endif
Sprite[0].Delete();
Sprite[1].Delete();
Sprite[2].Delete();
@@ -354,7 +389,33 @@ CFont::InitPerFrame(void)
#endif
SetDropShadowPosition(0);
NewLine = 0;
+#ifdef BUTTON_ICONS
+ PS2Symbol = BUTTON_NONE;
+#endif
+}
+
+#ifdef BUTTON_ICONS
+void
+CFont::DrawButton(float x, float y)
+{
+ if (x <= 0.0f || x > SCREEN_WIDTH || y <= 0.0f || y > SCREEN_HEIGHT)
+ return;
+
+ if (PS2Symbol != BUTTON_NONE) {
+ CRect rect;
+ rect.left = x;
+ rect.top = Details.scaleY + Details.scaleY + y;
+ rect.right = Details.scaleY * 17.0f + x;
+ rect.bottom = Details.scaleY * 19.0f + y;
+
+ int vertexAlphaState;
+ RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &vertexAlphaState);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
+ ButtonSprite[PS2Symbol].Draw(rect, CRGBA(255, 255, 255, Details.color.a));
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)vertexAlphaState);
+ }
}
+#endif
void
CFont::PrintChar(float x, float y, wchar c)
@@ -822,6 +883,15 @@ CFont::PrintString(float x, float y, wchar *start, wchar *&end, float spwidth, f
c = *s - ' ';
if (Details.slant != 0.0f && !IsJapanese())
y = (Details.slantRefX - x) * Details.slant + Details.slantRefY;
+
+#ifdef BUTTON_ICONS
+ if (PS2Symbol != BUTTON_NONE) {
+ DrawButton(x, y);
+ x += Details.scaleY * 17.0f;
+ PS2Symbol = BUTTON_NONE;
+ }
+#endif
+
PrintChar(x, y, c);
x += GetCharacterSize(c);
if (c == 0 && (!NewLine || !IsJapanese())) // space
@@ -953,6 +1023,30 @@ CFont::GetStringWidth(wchar *s, bool spaces)
do {
while (*s == '~' || *s == JAP_TERMINATION) {
s++;
+#ifdef BUTTON_ICONS
+ switch (*s) {
+#if 0 // unused
+ case 'U':
+ case 'D':
+ case '<':
+ case '>':
+#endif
+ case 'X':
+ case 'O':
+ case 'Q':
+ case 'T':
+ case 'K':
+ case 'M':
+ case 'A':
+ case 'J':
+ case 'V':
+ case 'C':
+ w += 17.0f * Details.scaleY;
+ break;
+ default:
+ break;
+ }
+#endif
while (!(*s == '~' || *s == JAP_TERMINATION)) s++;
s++;
}
@@ -967,12 +1061,40 @@ CFont::GetStringWidth(wchar *s, bool spaces)
for (; (*s != ' ' || spaces) && *s != '\0'; s++) {
if (*s == '~') {
s++;
+#ifdef BUTTON_ICONS
+ switch (*s) {
+#if 0 // unused
+ case 'U':
+ case 'D':
+ case '<':
+ case '>':
+#endif
+ case 'X':
+ case 'O':
+ case 'Q':
+ case 'T':
+ case 'K':
+ case 'M':
+ case 'A':
+ case 'J':
+ case 'V':
+ case 'C':
+ w += 17.0f * Details.scaleY;
+ break;
+ default:
+ break;
+ }
+#endif
while (*s != '~') s++;
+#ifndef FIX_BUGS
s++;
if (*s == ' ' && !spaces)
break;
- }
- w += GetCharacterSize(*s - ' ');
+ }
+#else
+ } else
+#endif
+ w += GetCharacterSize(*s - ' ');
}
}
return w;
@@ -1026,9 +1148,11 @@ CFont::GetNextSpace(wchar *s)
if(*s == '~'){
s++;
while(*s != '~') s++;
+#ifndef FIX_BUGS
s++;
if(*s == ' ')
break;
+#endif
}
}
return s;
@@ -1036,7 +1160,7 @@ CFont::GetNextSpace(wchar *s)
#ifdef MORE_LANGUAGES
wchar*
-CFont::ParseToken(wchar *s, wchar*, bool japShit)
+CFont::ParseToken(wchar *s, wchar* ss, bool japShit)
{
s++;
if ((Details.color.r || Details.color.g || Details.color.b) && !japShit) {
@@ -1056,13 +1180,37 @@ CFont::ParseToken(wchar *s, wchar*, bool japShit)
case 'r': SetColor(CRGBA(113, 43, 73, 255)); break;
case 'w': SetColor(CRGBA(175, 175, 175, 255)); break;
case 'y': SetColor(CRGBA(210, 196, 106, 255)); break;
+#ifdef BUTTON_ICONS
+#if 0 // unused
+ case 'U': PS2Symbol = BUTTON_UP; break;
+ case 'D': PS2Symbol = BUTTON_DOWN; break;
+ case '<': PS2Symbol = BUTTON_LEFT; break;
+ case '>': PS2Symbol = BUTTON_RIGHT; break;
+#endif
+ case 'X': PS2Symbol = BUTTON_CROSS; break;
+ case 'O': PS2Symbol = BUTTON_CIRCLE; break;
+ case 'Q': PS2Symbol = BUTTON_SQUARE; break;
+ case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
+ case 'K': PS2Symbol = BUTTON_L1; break;
+ case 'M': PS2Symbol = BUTTON_L2; break;
+ case 'A': PS2Symbol = BUTTON_L3; break;
+ case 'J': PS2Symbol = BUTTON_R1; break;
+ case 'V': PS2Symbol = BUTTON_R2; break;
+ case 'C': PS2Symbol = BUTTON_R3; break;
+#endif
}
} else if (IsJapanese()) {
if ((*s & 0x7FFF) == 'N' || (*s & 0x7FFF) == 'n')
NewLine = true;
}
while ((!IsJapanese() || (*s != JAP_TERMINATION)) && *s != '~') s++;
+#ifdef FIX_BUGS
+ if (*(++s) == '~')
+ s = ParseToken(s, ss, japShit);
+ return s;
+#else
return s + 1;
+#endif
}
#else
wchar*
@@ -1083,6 +1231,24 @@ CFont::ParseToken(wchar *s, wchar*)
case 'r': SetColor(CRGBA(0x71, 0x2B, 0x49, 0xFF)); break;
case 'w': SetColor(CRGBA(0xAF, 0xAF, 0xAF, 0xFF)); break;
case 'y': SetColor(CRGBA(0xD2, 0xC4, 0x6A, 0xFF)); break;
+#ifdef BUTTON_ICONS
+#if 0 // unused
+ case 'U': PS2Symbol = BUTTON_UP; break;
+ case 'D': PS2Symbol = BUTTON_DOWN; break;
+ case '<': PS2Symbol = BUTTON_LEFT; break;
+ case '>': PS2Symbol = BUTTON_RIGHT; break;
+#endif
+ case 'X': PS2Symbol = BUTTON_CROSS; break;
+ case 'O': PS2Symbol = BUTTON_CIRCLE; break;
+ case 'Q': PS2Symbol = BUTTON_SQUARE; break;
+ case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
+ case 'K': PS2Symbol = BUTTON_L1; break;
+ case 'M': PS2Symbol = BUTTON_L2; break;
+ case 'A': PS2Symbol = BUTTON_L3; break;
+ case 'J': PS2Symbol = BUTTON_R1; break;
+ case 'V': PS2Symbol = BUTTON_R2; break;
+ case 'C': PS2Symbol = BUTTON_R3; break;
+#endif
}
while(*s != '~') s++;
return s+1;
diff --git a/src/render/Font.h b/src/render/Font.h
index 51035601..be1eabed 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -63,6 +63,31 @@ enum
#define FONT_LOCALE(style) (style)
#endif
+#ifdef BUTTON_ICONS
+enum
+{
+ BUTTON_NONE = -1,
+#if 0 // unused
+ BUTTON_UP,
+ BUTTON_DOWN,
+ BUTTON_LEFT,
+ BUTTON_RIGHT,
+#endif
+ BUTTON_CROSS,
+ BUTTON_CIRCLE,
+ BUTTON_SQUARE,
+ BUTTON_TRIANGLE,
+ BUTTON_L1,
+ BUTTON_L2,
+ BUTTON_L3,
+ BUTTON_R1,
+ BUTTON_R2,
+ BUTTON_R3,
+ MAX_BUTTON_ICONS
+};
+#endif // BUTTON_ICONS
+
+
class CFont
{
#ifdef MORE_LANGUAGES
@@ -77,6 +102,14 @@ public:
static CSprite2d Sprite[MAX_FONTS];
static CFontDetails Details;
+#ifdef BUTTON_ICONS
+ static CSprite2d ButtonSprite[MAX_BUTTON_ICONS];
+ static int PS2Symbol;
+
+ static void DrawButton(float x, float y);
+#endif // BUTTON_ICONS
+
+
static void Initialise(void);
static void Shutdown(void);
static void InitPerFrame(void);