diff --git a/th01/zunsoft.c b/th01/zunsoft.c index 52b1b0c1..ce7a5233 100644 --- a/th01/zunsoft.c +++ b/th01/zunsoft.c @@ -26,7 +26,7 @@ Point star_pos[STAR_COUNT]; int frame; int circle_speed_x[CIRCLE_COUNT]; int circle_speed_y[CIRCLE_COUNT]; -char star_angle; +unsigned char star_angle; unsigned char star_speed[STAR_COUNT]; void graph_clear_both(void) @@ -103,7 +103,7 @@ void objects_setup(void) star_pos[i].y = rand() % 400; star_speed[i] = (rand() % 32) + 6; } - star_angle = 64; + star_angle = +0x40; } void circles_render_and_update(void) diff --git a/th02/maine_05.cpp b/th02/maine_05.cpp index cbaeec0f..69b6dd20 100644 --- a/th02/maine_05.cpp +++ b/th02/maine_05.cpp @@ -17,9 +17,9 @@ void pascal near rotrect_draw(int rad, unsigned char angle) x[i] = polar_x_fast(192, rad, angle); y[i] = polar_y_fast(200, rad, angle); if(i & 1) { - angle += 81; + angle += 0x51; } else { - angle += 47; + angle += 0x2F; } } grcg_line(x[0], y[0], x[1], y[1]); @@ -34,7 +34,7 @@ void pascal near rotrect_draw(int rad, unsigned char angle) void pascal rotrect_animate(char rot_speed, char start_angle) { int rads[] = {256, 256, 256, 256, 256}; - char angles[] = {41, 41, 41, 41, 41}; + char angles[] = {0x29, 0x29, 0x29, 0x29, 0x29}; int i, j; for(i = 0; i < 5; i++) { angles[i] = start_angle; diff --git a/th02/op_06.cpp b/th02/op_06.cpp index 0bf9e147..0e1d4374 100644 --- a/th02/op_06.cpp +++ b/th02/op_06.cpp @@ -132,9 +132,9 @@ void pascal near polygons_update_and_render(void) } \ move_speed[i].y = ((rand() & 3) << 4) + 32; \ angle[i] = rand(); \ - rot_speed[i] = 4 - (rand() & 7); \ + rot_speed[i] = 0x04 - (rand() & 0x07); \ if(rot_speed[i] == 0) { \ - rot_speed[i] = 4; \ + rot_speed[i] = 0x04; \ } int i; diff --git a/th03/math/randring.h b/th03/math/randring.h index 9b99e808..eb138f1d 100644 --- a/th03/math/randring.h +++ b/th03/math/randring.h @@ -5,7 +5,7 @@ uint16_t pascal near randring1_next16_and(uint16_t mask); uint16_t pascal near randring2_next16_and(uint16_t mask); uint16_t pascal near randring2_next16_mod(uint16_t mask); -inline char randring_angle(char random_range, char offset) +inline unsigned char randring_angle(unsigned char range, unsigned char offset) { - return randring1_next16_and(random_range) + offset; + return randring1_next16_and(range) + offset; } diff --git a/th04/main/bullet/tune.cpp b/th04/main/bullet/tune.cpp index b43a3b99..917d37ef 100644 --- a/th04/main/bullet/tune.cpp +++ b/th04/main/bullet/tune.cpp @@ -75,12 +75,12 @@ void near tune_for_lunatic(void) case BP_SINGLE_AIMED: tmpl.pattern = BP_SPREAD_AIMED; tmpl.count = 3; - tmpl.delta.spread_angle = 0x06; + tmpl.delta.spread_angle = +0x06; break; case BP_SINGLE: tmpl.pattern = BP_SPREAD; tmpl.count = 3; - tmpl.delta.spread_angle = 0x06; + tmpl.delta.spread_angle = +0x06; break; case BP_STACK: diff --git a/th04/main/player/shot.hpp b/th04/main/player/shot.hpp index 31aad8c3..d97beb60 100644 --- a/th04/main/player/shot.hpp +++ b/th04/main/player/shot.hpp @@ -39,10 +39,10 @@ struct shot_t { this->damage = damage; } - void set_random_angle_forwards(char random_range = 15, char offset = 184) { + void set_random_angle_forwards(char range = 0x0F, char offset = -0x48) { shot_velocity_set( (SPPoint near*)&this->pos.velocity, - randring_angle(random_range, offset) + randring_angle(range, offset) ); } }; diff --git a/th05/main/lasers_update_render.asm b/th05/main/lasers_update_render.asm index 49f7e649..5e0500e0 100644 --- a/th05/main/lasers_update_render.asm +++ b/th05/main/lasers_update_render.asm @@ -339,7 +339,7 @@ lasers_render proc near push ax mov al, [si+laser_t.coords.angle] mov ah, 0 - add ax, 64 + add ax, 40h push ax call vector2_at xor di, di diff --git a/th05/main/player/shot.hpp b/th05/main/player/shot.hpp index 38f8db7d..06040960 100644 --- a/th05/main/player/shot.hpp +++ b/th05/main/player/shot.hpp @@ -35,8 +35,8 @@ struct ShotAddIterator { i += n; } - void set_random_angle(char random_range = 15, char offset = 184) { - angle = randring_angle(random_range, offset); + void set_random_angle(char range = 0x0F, char offset = -0x48) { + angle = randring_angle(range, offset); } unsigned char next(void) { diff --git a/th05/main/stage/setup.cpp b/th05/main/stage/setup.cpp index 88a7b23f..23aabd49 100644 --- a/th05/main/stage/setup.cpp +++ b/th05/main/stage/setup.cpp @@ -191,7 +191,7 @@ void pascal near stagex_setup(void) midboss_render_func = midbossx_render; midboss.frames_until = 5800; midboss.pos.init(192, -16); - midboss.angle = 64; + midboss.angle = +0x40; midboss.hp = 3000; midboss.sprite = 220; diff --git a/th05/p_common.cpp b/th05/p_common.cpp index 712e0997..de173c39 100644 --- a/th05/p_common.cpp +++ b/th05/p_common.cpp @@ -62,7 +62,7 @@ void pascal near shot_l1(void) } shot_t near *shot; if(( shot = shots_add() ) != NULL) { - shot_velocity_set(&shot->pos.velocity, randring_angle(7, 188)); + shot_velocity_set(&shot->pos.velocity, randring_angle(0x07, -0x44)); shot->damage = 10; } } diff --git a/th05/p_marisa.cpp b/th05/p_marisa.cpp index a663f984..73012586 100644 --- a/th05/p_marisa.cpp +++ b/th05/p_marisa.cpp @@ -74,10 +74,10 @@ void pascal near shot_marisa_l4(void) while(( shot = shots_add() ) != NULL) { if(sai.i <= STAR_COUNT) { if(sai.i == STAR_COUNT) { - sai.angle = 180; + sai.angle = -0x4C; } shot->damage = 6; - sai.angle += 6; + sai.angle += 0x06; shot_velocity_set(&shot->pos.velocity, sai.angle); } else { switch(sai.i - 4u) { @@ -105,9 +105,9 @@ void pascal near shot_marisa_l5(void) if(sai.i <= STAR_COUNT) { shot->damage = 6; if(sai.i == STAR_COUNT) { - sai.angle = 178; + sai.angle = -0x4E; } - sai.angle += 7; + sai.angle += 0x07; shot_velocity_set(&shot->pos.velocity, sai.angle); } else { switch(sai.i - 4u) { diff --git a/th05/p_mima.cpp b/th05/p_mima.cpp index fd8369c8..007e870d 100644 --- a/th05/p_mima.cpp +++ b/th05/p_mima.cpp @@ -80,7 +80,7 @@ void pascal near shot_mima_l4(void) void pascal near shot_mima_l5(void) { SHOT_FUNC_INIT(4, SC_6X, SC_3X, i += 3); - sai.angle = 186; + sai.angle = -0x46; while(( shot = shots_add() ) != NULL) { if(sai.i <= 4) { switch(sai.i - 1) { @@ -94,7 +94,7 @@ void pascal near shot_mima_l5(void) shot->set_option_sprite_and_damage(4); } else { shot_velocity_set(&shot->pos.velocity, sai.angle); - sai.angle += 6; + sai.angle += 0x06; shot->damage = 7; } if(sai.next() <= 0) { @@ -106,7 +106,7 @@ void pascal near shot_mima_l5(void) void pascal near shot_mima_l6(void) { SHOT_FUNC_INIT(4, SC_6X, SC_3X, i += 3); - sai.angle = 186; + sai.angle = -0x46; while(( shot = shots_add() ) != NULL) { if(sai.i <= 4) { switch(sai.i - 1) { @@ -119,7 +119,7 @@ void pascal near shot_mima_l6(void) shot->set_option_sprite_and_damage(4); } else { shot_velocity_set(&shot->pos.velocity, sai.angle); - sai.angle += 6; + sai.angle += 0x06; shot->damage = 7; } if(sai.next() <= 0) { @@ -131,7 +131,7 @@ void pascal near shot_mima_l6(void) void pascal near shot_mima_l7(void) { SHOT_FUNC_INIT(6, SC_6X, SC_3X, i += 3); - sai.angle = 186; + sai.angle = -0x46; while(( shot = shots_add() ) != NULL) { if(sai.i <= 6) { switch(sai.i - 1) { @@ -147,7 +147,7 @@ void pascal near shot_mima_l7(void) shot->set_option_sprite_and_damage(4); } else { shot_velocity_set(&shot->pos.velocity, sai.angle); - sai.angle += 6; + sai.angle += 0x06; shot->damage = 7; } if(sai.next() <= 0) { @@ -159,7 +159,7 @@ void pascal near shot_mima_l7(void) void pascal near shot_mima_l8(void) { SHOT_FUNC_INIT(6, SC_6X, SC_3X, i += 3); - sai.angle = 186; + sai.angle = -0x46; while(( shot = shots_add() ) != NULL) { if(sai.i <= 6) { shot->pos.velocity.y.set(-20.0f); @@ -176,7 +176,7 @@ void pascal near shot_mima_l8(void) shot->set_option_sprite_and_damage(4); } else { shot_velocity_set(&shot->pos.velocity, sai.angle); - sai.angle += 6; + sai.angle += 0x06; shot->damage = 7; } if(sai.next() <= 0) { @@ -202,10 +202,10 @@ void pascal near shot_mima_l9(void) shot->set_option_sprite_and_damage(4); } else { switch(sai.i - 7u) { - case 0: sai.angle = 184; break; - case 1: sai.angle = 192; shot->pos.cur.x -= 8.0f; break; - case 2: sai.angle = 192; shot->pos.cur.x += 8.0f; break; - case 3: sai.angle = 200; break; + case 0: sai.angle = -0x48; break; + case 1: sai.angle = -0x40; shot->pos.cur.x -= 8.0f; break; + case 2: sai.angle = -0x40; shot->pos.cur.x += 8.0f; break; + case 3: sai.angle = -0x38; break; } shot_velocity_set(&shot->pos.velocity, sai.angle); shot->damage = 7; diff --git a/th05/p_reimu.cpp b/th05/p_reimu.cpp index 190772dc..2600ffb9 100644 --- a/th05/p_reimu.cpp +++ b/th05/p_reimu.cpp @@ -17,16 +17,16 @@ extern "C" { sai.angle += angle_add; #define REIMU_SUB_SPREAD_CONSTANT(i_left) \ - if(sai.i == i_left) { shot->from_option_l(); sai.angle = 184; } \ - else/*i == i_right*/ { shot->from_option_r(); sai.angle = 200; } + if(sai.i == i_left) { shot->from_option_l(); sai.angle = -0x48; } \ + else/*i == i_right*/ { shot->from_option_r(); sai.angle = -0x38; } #define REIMU_SUB_SPREAD_RANDOM(i_left) \ if(sai.i == i_left) { \ shot->from_option_l(); \ - sai.set_random_angle(3, 182); \ + sai.set_random_angle(3, -0x4A); \ } else /* i == i_right */ { \ shot->from_option_r(); \ - sai.set_random_angle(3, 198); \ + sai.set_random_angle(3, -0x3A); \ if(option_only == 0) { \ sai.i = 1; \ } \ @@ -81,7 +81,7 @@ void pascal near shot_reimu_l4(void) while(( shot = shots_add() ) != NULL) { if(sai.i <= 3) { - REIMU_FORWARD(9, 3, 180, 6); + REIMU_FORWARD(9, 3, -0x4C, +0x06); } else { REIMU_SUB_SPREAD_CONSTANT(5); SET_HOMING(3); @@ -101,9 +101,9 @@ void pascal near shot_reimu_l4(void) if(sai.i <= 3) { \ shot->damage = 9; \ if(sai.i == 3) { \ - sai.angle = 178; \ + sai.angle = -0x4E; \ } \ - sai.angle += 7; \ + sai.angle += 0x07; \ } else { \ REIMU_SUB_SPREAD_RANDOM(5); \ shot->set_option_sprite_and_damage(3); \ @@ -132,7 +132,7 @@ void pascal near shot_reimu_l7(void) while(( shot = shots_add() ) != NULL) { if(sai.i <= 5) { - REIMU_FORWARD(9, 5, 177, 5); + REIMU_FORWARD(9, 5, -0x4F, +0x05); } else { REIMU_SUB_SPREAD_RANDOM(7); SET_HOMING(3); @@ -153,10 +153,10 @@ void pascal near shot_reimu_l8(void) } while(( shot = shots_add() ) != NULL) { if(sai.i <= 5) { - REIMU_FORWARD(9, 5, 177, 5); + REIMU_FORWARD(9, 5, -0x4F, +0x05); } else { - if(sai.i == 7) { shot->from_option_l(); sai.set_random_angle(3, 182); } - else/*i == 6*/ { shot->from_option_r(); sai.set_random_angle(3, 198); } + if(sai.i == 7) { shot->from_option_l(); sai.set_random_angle(3, -0x4A); } + else/*i == 6*/ { shot->from_option_r(); sai.set_random_angle(3, -0x3A); } SET_HOMING(3); } shot_velocity_set(&shot->pos.velocity, sai.angle); @@ -173,17 +173,17 @@ void pascal near shot_reimu_l9(void) while(( shot = shots_add() ) != NULL) { if(sai.i <= 5) { - REIMU_FORWARD(9, 5, 177, 5); + REIMU_FORWARD(9, 5, -0x4F, +0x05); } else { if(sai.i <= 7) { REIMU_SUB_SPREAD_CONSTANT(7); } else { if(sai.i == 9) { shot->from_option_l(); - sai.angle = 170; + sai.angle = -0x56; } else /* i == 8 */ { shot->from_option_r(); - sai.angle = 214; + sai.angle = -0x2A; if(option_only == 0) { sai.i = 1; } diff --git a/th05/p_yuuka.cpp b/th05/p_yuuka.cpp index 21aeb507..16b7d9f8 100644 --- a/th05/p_yuuka.cpp +++ b/th05/p_yuuka.cpp @@ -13,20 +13,20 @@ extern "C" { #define YUUKA_INNER_L4 \ switch(sai.i - 1) { \ - case 0: sai.angle = 186; break; \ - case 1: sai.angle = 192; shot->pos.cur.x -= 8; break; \ - case 2: sai.angle = 192; shot->pos.cur.x += 8; break; \ - case 3: sai.angle = 198; break; \ + case 0: sai.angle = -0x46; break; \ + case 1: sai.angle = -0x40; shot->pos.cur.x -= 8; break; \ + case 2: sai.angle = -0x40; shot->pos.cur.x += 8; break; \ + case 3: sai.angle = -0x3A; break; \ } \ shot->damage = 7; #define YUUKA_INNER_L5 \ switch(sai.i - 1) { \ - case 0: sai.angle = 180; break; \ - case 1: sai.angle = 186; break; \ - case 2: sai.angle = 192; break; \ - case 3: sai.angle = 198; break; \ - case 4: sai.angle = 204; break; \ + case 0: sai.angle = -0x4C; break; \ + case 1: sai.angle = -0x46; break; \ + case 2: sai.angle = -0x40; break; \ + case 3: sai.angle = -0x3A; break; \ + case 4: sai.angle = -0x34; break; \ } \ shot->damage = 7; @@ -35,11 +35,11 @@ void pascal near shot_yuuka_l2(void) SHOT_FUNC_INIT(1, SC_3X, SC_1X, i += 2); while(( shot = shots_add() ) != NULL) { if(sai.i == 1) { - sai.set_random_angle(15, 184); + sai.set_random_angle(0x0F, -0x48); shot->damage = 9; } else { - if(sai.i == 3) { shot->from_option_l(); sai.angle = 184; } - else/*i == 2*/ { shot->from_option_r(); sai.angle = 200; } + if(sai.i == 3) { shot->from_option_l(); sai.angle = -0x48; } + else/*i == 2*/ { shot->from_option_r(); sai.angle = -0x38; } shot->set_option_sprite_and_damage(6); } shot_velocity_set(&shot->pos.velocity, sai.angle); @@ -62,10 +62,10 @@ void pascal near shot_yuuka_l3(void) } else { if(sai.i == 4) { shot->from_option_l(); - sai.angle = 184; + sai.angle = -0x48; } else { shot->from_option_r(); - sai.angle = 200; + sai.angle = -0x38; if(option_only == 0) { sai.i = 1; } @@ -87,17 +87,17 @@ void pascal near shot_yuuka_l4(void) while(( shot = shots_add() ) != NULL) { if(sai.i <= 3) { if(sai.i == 3) { - sai.angle = 180; + sai.angle = -0x4C; } shot->damage = 7; - sai.angle += 6; + sai.angle += 0x06; } else { if(sai.i == 5) { shot->from_option_l(); - sai.set_random_angle(7, 180); + sai.set_random_angle(0x07, -0x4C); } else { shot->from_option_r(); - sai.set_random_angle(7, 196); + sai.set_random_angle(0x07, -0x3C); if(option_only == 0) { sai.i = 1; } @@ -121,19 +121,19 @@ void pascal near shot_yuuka_l5(void) if(sai.i <= 3) { shot->damage = 7; if(sai.i == 3) { - sai.angle = 180; + sai.angle = -0x4C; } - sai.angle += 6; + sai.angle += 0x06; } else { switch(sai.i - 4u) { case 0: if(option_only == 0) { sai.i = 1; } - shot->from_option_l(); sai.angle = 178; break; - case 1: shot->from_option_r(); sai.angle = 206; break; - case 2: shot->from_option_l(); sai.angle = 186; break; - case 3: shot->from_option_r(); sai.angle = 198; break; + /* */ shot->from_option_l(); sai.angle = -0x4E; break; + case 1: shot->from_option_r(); sai.angle = -0x32; break; + case 2: shot->from_option_l(); sai.angle = -0x46; break; + case 3: shot->from_option_r(); sai.angle = -0x3A; break; } shot->set_option_sprite_and_damage(6); } @@ -154,14 +154,14 @@ void pascal near shot_yuuka_l6(void) YUUKA_INNER_L4; } else { switch(sai.i - 5u) { - case 0: shot->from_option_l(); sai.angle = 176; + case 0: shot->from_option_l(); sai.angle = -0x50; if(option_only == 0) { sai.i = 1; } break; - case 1: shot->from_option_r(); sai.angle = 208; break; - case 2: shot->from_option_l(); sai.angle = 184; break; - case 3: shot->from_option_r(); sai.angle = 200; break; + case 1: shot->from_option_r(); sai.angle = -0x30; break; + case 2: shot->from_option_l(); sai.angle = -0x48; break; + case 3: shot->from_option_r(); sai.angle = -0x38; break; } shot->set_option_sprite_and_damage(6); } @@ -182,16 +182,16 @@ void pascal near shot_yuuka_l7(void) YUUKA_INNER_L4; } else { switch(sai.i - 5u) { - case 0: shot->from_option_l(); sai.angle = 176; + case 0: shot->from_option_l(); sai.angle = -0x50; if(option_only == 0) { sai.i = 1; } break; - case 1: shot->from_option_r(); sai.angle = 208; break; - case 2: shot->from_option_l(); sai.angle = 183; break; - case 3: shot->from_option_r(); sai.angle = 201; break; - case 4: shot->from_option_l(); sai.angle = 190; break; - case 5: shot->from_option_r(); sai.angle = 194; break; + case 1: shot->from_option_r(); sai.angle = -0x30; break; + case 2: shot->from_option_l(); sai.angle = -0x49; break; + case 3: shot->from_option_r(); sai.angle = -0x37; break; + case 4: shot->from_option_l(); sai.angle = -0x42; break; + case 5: shot->from_option_r(); sai.angle = -0x3E; break; } shot->set_option_sprite_and_damage(6); } @@ -212,16 +212,16 @@ void pascal near shot_yuuka_l8(void) YUUKA_INNER_L5; } else { switch(sai.i - 6u) { - case 0: shot->from_option_l(); sai.angle = 176; + case 0: shot->from_option_l(); sai.angle = -0x50; if(option_only == 0) { sai.i = 1; } break; - case 1: shot->from_option_r(); sai.angle = 208; break; - case 2: shot->from_option_l(); sai.angle = 183; break; - case 3: shot->from_option_r(); sai.angle = 201; break; - case 4: shot->from_option_l(); sai.angle = 190; break; - case 5: shot->from_option_r(); sai.angle = 194; break; + case 1: shot->from_option_r(); sai.angle = -0x30; break; + case 2: shot->from_option_l(); sai.angle = -0x49; break; + case 3: shot->from_option_r(); sai.angle = -0x37; break; + case 4: shot->from_option_l(); sai.angle = -0x42; break; + case 5: shot->from_option_r(); sai.angle = -0x3E; break; } shot->set_option_sprite_and_damage(6); } @@ -242,18 +242,18 @@ void pascal near shot_yuuka_l9(void) YUUKA_INNER_L5; } else { switch(sai.i - 6u) { - case 0: shot->from_option_l(); sai.angle = 168; + case 0: shot->from_option_l(); sai.angle = -0x58; if(option_only == 0) { sai.i = 1; } break; - case 1: shot->from_option_r(); sai.angle = 216; break; - case 2: shot->from_option_l(); sai.angle = 176; break; - case 3: shot->from_option_r(); sai.angle = 208; break; - case 4: shot->from_option_l(); sai.angle = 184; break; - case 5: shot->from_option_r(); sai.angle = 200; break; - case 6: shot->from_option_l(); sai.angle = 193; break; - case 7: shot->from_option_r(); sai.angle = 191; break; + case 1: shot->from_option_r(); sai.angle = -0x28; break; + case 2: shot->from_option_l(); sai.angle = -0x50; break; + case 3: shot->from_option_r(); sai.angle = -0x30; break; + case 4: shot->from_option_l(); sai.angle = -0x48; break; + case 5: shot->from_option_r(); sai.angle = -0x38; break; + case 6: shot->from_option_l(); sai.angle = -0x3F; break; + case 7: shot->from_option_r(); sai.angle = -0x41; break; } shot->set_option_sprite_and_damage(6); }