projects
/
gba_blender
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2210b20
)
minor control tweaks and fixes
author
John Tsiombikas
<nuclear@member.fsf.org>
Tue, 16 Mar 2021 19:18:35 +0000
(21:18 +0200)
committer
John Tsiombikas
<nuclear@member.fsf.org>
Tue, 16 Mar 2021 19:18:35 +0000
(21:18 +0200)
src/main.c
patch
|
blob
|
history
diff --git
a/src/main.c
b/src/main.c
index
b5648d0
..
8a0df39
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-249,6
+249,8
@@
int main(void)
}
#define PAN_SPEED 0x4000
}
#define PAN_SPEED 0x4000
+#define MAX_XPAN 0x50000
+#define MAX_YPAN 0x1c000
static void handle_keys(void)
{
static void handle_keys(void)
{
@@
-257,7
+259,7
@@
static void handle_keys(void)
if(KEYPRESS(KEY_UP)) {
if(pan_mode) {
cam_pan_y += PAN_SPEED;
if(KEYPRESS(KEY_UP)) {
if(pan_mode) {
cam_pan_y += PAN_SPEED;
- if(cam_pan_y > 0x1c000) cam_pan_y = 0x1c000;
+ if(cam_pan_y > MAX_YPAN) cam_pan_y = MAX_YPAN;
} else {
cam_phi += 0x2000;
if(cam_phi > X_HPI) cam_phi = X_HPI;
} else {
cam_phi += 0x2000;
if(cam_phi > X_HPI) cam_phi = X_HPI;
@@
-267,7
+269,7
@@
static void handle_keys(void)
if(KEYPRESS(KEY_DOWN)) {
if(pan_mode) {
cam_pan_y -= PAN_SPEED;
if(KEYPRESS(KEY_DOWN)) {
if(pan_mode) {
cam_pan_y -= PAN_SPEED;
- if(cam_pan_y < -0x1c000) cam_pan_y = -0x1c000;
+ if(cam_pan_y < -MAX_YPAN) cam_pan_y = -MAX_YPAN;
} else {
cam_phi -= 0x2000;
if(cam_phi < -X_HPI) cam_phi = -X_HPI;
} else {
cam_phi -= 0x2000;
if(cam_phi < -X_HPI) cam_phi = -X_HPI;
@@
-277,7
+279,7
@@
static void handle_keys(void)
if(KEYPRESS(KEY_LEFT)) {
if(pan_mode) {
cam_pan_x -= PAN_SPEED;
if(KEYPRESS(KEY_LEFT)) {
if(pan_mode) {
cam_pan_x -= PAN_SPEED;
- if(cam_pan_x < -0x50000) cam_pan_x = -0x50000;
+ if(cam_pan_x < -MAX_XPAN) cam_pan_x = -MAX_XPAN;
} else {
cam_theta += 0x2000;
if(cam_theta > X_2PI) cam_theta -= X_2PI;
} else {
cam_theta += 0x2000;
if(cam_theta > X_2PI) cam_theta -= X_2PI;
@@
-287,7
+289,7
@@
static void handle_keys(void)
if(KEYPRESS(KEY_RIGHT)) {
if(pan_mode) {
cam_pan_x += PAN_SPEED;
if(KEYPRESS(KEY_RIGHT)) {
if(pan_mode) {
cam_pan_x += PAN_SPEED;
- if(cam_pan_x > 0x50000) cam_pan_x = 0x50000;
+ if(cam_pan_x > MAX_XPAN) cam_pan_x = MAX_XPAN;
} else {
cam_theta -= 0x2000;
if(cam_theta < 0) cam_theta += X_2PI;
} else {
cam_theta -= 0x2000;
if(cam_theta < 0) cam_theta += X_2PI;
@@
-308,14
+310,20
@@
static void handle_keys(void)
if(KEYPRESS(KEY_RT)) {
cam_pan_x += PAN_SPEED;
if(KEYPRESS(KEY_RT)) {
cam_pan_x += PAN_SPEED;
+ if(cam_pan_x > 0x50000) cam_pan_x = 0x50000;
}
if(KEYPRESS(KEY_LT)) {
cam_pan_x -= PAN_SPEED;
}
if(KEYPRESS(KEY_LT)) {
cam_pan_x -= PAN_SPEED;
+ if(cam_pan_x < -0x50000) cam_pan_x = -0x50000;
}
if(KEYPRESS(KEY_A)) {
if(!show_del) {
}
if(KEYPRESS(KEY_A)) {
if(!show_del) {
- if(show_obj) show_del = 1;
+ if(show_obj) {
+ show_del = 1;
+ } else {
+ show_obj = 1;
+ }
} else {
show_del = 0;
}
} else {
show_del = 0;
}