From 25369bcf67126de7ac1d1d9a93f8113c87d9d71f Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 7 Jan 2020 05:51:54 +0000 Subject: [PATCH] More-accurate Bullet.cpp variable arrangement --- src/Bullet.cpp | 200 +++++++++++++++++++++++++------------------------ 1 file changed, 103 insertions(+), 97 deletions(-) diff --git a/src/Bullet.cpp b/src/Bullet.cpp index b5d472e3..668ec61f 100644 --- a/src/Bullet.cpp +++ b/src/Bullet.cpp @@ -12,56 +12,6 @@ #include "NpChar.h" #include "Sound.h" -BULLET_TABLE gBulTbl[46] = -{ - {0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}}, - {4, 1, 20, 36, 4, 4, 2, 2, {8, 8, 8, 8}}, - {6, 1, 23, 36, 4, 4, 2, 2, {8, 8, 8, 8}}, - {8, 1, 30, 36, 4, 4, 2, 2, {8, 8, 8, 8}}, - {1, 1, 8, 32, 6, 6, 2, 2, {8, 8, 8, 8}}, - {2, 1, 12, 32, 6, 6, 2, 2, {8, 8, 8, 8}}, - {4, 1, 16, 32, 6, 6, 2, 2, {8, 8, 8, 8}}, - {2, 2, 100, 8, 8, 16, 4, 2, {8, 8, 8, 8}}, - {3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}}, - {3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}}, - {2, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}}, - {4, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}}, - {6, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}}, - {0, 10, 50, 40, 2, 2, 2, 2, {8, 8, 8, 8}}, - {0, 10, 70, 40, 4, 4, 4, 4, {8, 8, 8, 8}}, - {0, 10, 90, 40, 4, 4, 0, 0, {8, 8, 8, 8}}, - {1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}}, - {1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}}, - {1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}}, - {1, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}}, - {2, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}}, - {2, 1, 20, 8, 4, 4, 4, 4, {4, 4, 4, 4}}, - {3, 1, 32, 32, 2, 2, 2, 2, {4, 4, 4, 4}}, - {0, 100, 0, 36, 8, 8, 8, 8, {12, 12, 12, 12}}, - {127, 1, 2, 4, 8, 4, 8, 4, {0, 0, 0, 0}}, - {15, 1, 30, 36, 8, 8, 4, 2, {8, 8, 8, 8}}, - {6, 3, 18, 36, 10, 10, 4, 2, {12, 12, 12, 12}}, - {1, 100, 30, 36, 6, 6, 4, 4, {12, 12, 12, 12}}, - {0, 10, 30, 40, 2, 2, 2, 2, {8, 8, 8, 8}}, - {0, 10, 40, 40, 4, 4, 4, 4, {8, 8, 8, 8}}, - {0, 10, 40, 40, 4, 4, 0, 0, {8, 8, 8, 8}}, - {2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}}, - {2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}}, - {2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}}, - {4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}}, - {4, 2, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}}, - {1, 1, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}}, - {4, 4, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}}, - {8, 8, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}}, - {12, 12, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}}, - {3, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}}, - {6, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}}, - {11, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}}, - {4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}}, - {0, 4, 4, 4, 0, 0, 0, 0, {0, 0, 0, 0}}, - {1, 1, 1, 36, 1, 1, 1, 1, {1, 1, 1, 1}} -}; - BULLET gBul[BULLET_MAX]; void InitBullet(void) @@ -150,6 +100,56 @@ void PutBullet(int fx, int fy) } } +BULLET_TABLE gBulTbl[46] = +{ + {0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}}, + {4, 1, 20, 36, 4, 4, 2, 2, {8, 8, 8, 8}}, + {6, 1, 23, 36, 4, 4, 2, 2, {8, 8, 8, 8}}, + {8, 1, 30, 36, 4, 4, 2, 2, {8, 8, 8, 8}}, + {1, 1, 8, 32, 6, 6, 2, 2, {8, 8, 8, 8}}, + {2, 1, 12, 32, 6, 6, 2, 2, {8, 8, 8, 8}}, + {4, 1, 16, 32, 6, 6, 2, 2, {8, 8, 8, 8}}, + {2, 2, 100, 8, 8, 16, 4, 2, {8, 8, 8, 8}}, + {3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}}, + {3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}}, + {2, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}}, + {4, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}}, + {6, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}}, + {0, 10, 50, 40, 2, 2, 2, 2, {8, 8, 8, 8}}, + {0, 10, 70, 40, 4, 4, 4, 4, {8, 8, 8, 8}}, + {0, 10, 90, 40, 4, 4, 0, 0, {8, 8, 8, 8}}, + {1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}}, + {1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}}, + {1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}}, + {1, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}}, + {2, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}}, + {2, 1, 20, 8, 4, 4, 4, 4, {4, 4, 4, 4}}, + {3, 1, 32, 32, 2, 2, 2, 2, {4, 4, 4, 4}}, + {0, 100, 0, 36, 8, 8, 8, 8, {12, 12, 12, 12}}, + {127, 1, 2, 4, 8, 4, 8, 4, {0, 0, 0, 0}}, + {15, 1, 30, 36, 8, 8, 4, 2, {8, 8, 8, 8}}, + {6, 3, 18, 36, 10, 10, 4, 2, {12, 12, 12, 12}}, + {1, 100, 30, 36, 6, 6, 4, 4, {12, 12, 12, 12}}, + {0, 10, 30, 40, 2, 2, 2, 2, {8, 8, 8, 8}}, + {0, 10, 40, 40, 4, 4, 4, 4, {8, 8, 8, 8}}, + {0, 10, 40, 40, 4, 4, 0, 0, {8, 8, 8, 8}}, + {2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}}, + {2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}}, + {2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}}, + {4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}}, + {4, 2, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}}, + {1, 1, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}}, + {4, 4, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}}, + {8, 8, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}}, + {12, 12, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}}, + {3, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}}, + {6, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}}, + {11, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}}, + {4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}}, + {0, 4, 4, 4, 0, 0, 0, 0, {0, 0, 0, 0}}, + {1, 1, 1, 36, 1, 1, 1, 1, {1, 1, 1, 1}} +}; + void SetBullet(int no, int x, int y, int dir) { int i = 0; @@ -246,6 +246,8 @@ void ActBullet_Frontia1(BULLET *bul) void ActBullet_Frontia2(BULLET *bul, int level) { + static unsigned int inc; + if (++bul->count1 > bul->life_count) { bul->cond = 0; @@ -274,7 +276,6 @@ void ActBullet_Frontia2(BULLET *bul, int level) break; } - static unsigned int inc; ++inc; switch (bul->direct) @@ -372,10 +373,6 @@ void ActBullet_Frontia2(BULLET *bul, int level) void ActBullet_PoleStar(BULLET *bul, int level) { - RECT rect1[2]; - RECT rect2[2]; - RECT rect3[2]; - if (++bul->count1 > bul->life_count) { bul->cond = 0; @@ -450,14 +447,20 @@ void ActBullet_PoleStar(BULLET *bul, int level) bul->y += bul->ym; } - SET_RECT(rect1[0], 128, 32, 144, 48) - SET_RECT(rect1[1], 144, 32, 160, 48) + RECT rect1[2] = { + {128, 32, 144, 48}, + {144, 32, 160, 48}, + }; - SET_RECT(rect2[0], 160, 32, 176, 48) - SET_RECT(rect2[1], 176, 32, 192, 48) + RECT rect2[2] = { + {160, 32, 176, 48}, + {176, 32, 192, 48}, + }; - SET_RECT(rect3[0], 128, 48, 144, 64) - SET_RECT(rect3[1], 144, 48, 160, 64) + RECT rect3[2] = { + {128, 48, 144, 64}, + {144, 48, 160, 64}, + }; //Set framerect switch (level) @@ -491,10 +494,6 @@ void ActBullet_PoleStar(BULLET *bul, int level) void ActBullet_FireBall(BULLET *bul, int level) { BOOL bBreak; - RECT rect_left1[4]; - RECT rect_right1[4]; - RECT rect_left2[3]; - RECT rect_right2[3]; if (++bul->count1 > bul->life_count) { @@ -585,23 +584,31 @@ void ActBullet_FireBall(BULLET *bul, int level) PlaySoundObject(34, 1); } - SET_RECT(rect_left1[0], 128, 0, 144, 16) - SET_RECT(rect_left1[1], 144, 0, 160, 16) - SET_RECT(rect_left1[2], 160, 0, 176, 16) - SET_RECT(rect_left1[3], 176, 0, 192, 16) + RECT rect_left1[4] = { + {128, 0, 144, 16}, + {144, 0, 160, 16}, + {160, 0, 176, 16}, + {176, 0, 192, 16}, + }; - SET_RECT(rect_right1[0], 128, 16, 144, 32) - SET_RECT(rect_right1[1], 144, 16, 160, 32) - SET_RECT(rect_right1[2], 160, 16, 176, 32) - SET_RECT(rect_right1[3], 176, 16, 192, 32) + RECT rect_right1[4] = { + {128, 16, 144, 32}, + {144, 16, 160, 32}, + {160, 16, 176, 32}, + {176, 16, 192, 32}, + }; - SET_RECT(rect_left2[0], 192, 16, 208, 32) - SET_RECT(rect_left2[1], 208, 16, 224, 32) - SET_RECT(rect_left2[2], 224, 16, 240, 32) + RECT rect_left2[3] = { + {192, 16, 208, 32}, + {208, 16, 224, 32}, + {224, 16, 240, 32}, + }; - SET_RECT(rect_right2[0], 224, 16, 240, 32) - SET_RECT(rect_right2[1], 208, 16, 224, 32) - SET_RECT(rect_right2[2], 192, 16, 208, 32) + RECT rect_right2[3] = { + {224, 16, 240, 32}, + {208, 16, 224, 32}, + {192, 16, 208, 32}, + }; ++bul->ani_no; @@ -734,6 +741,8 @@ void ActBullet_Missile(BULLET *bul, int level) { BOOL bHit; + static unsigned int inc; + if (++bul->count1 > bul->life_count) { bul->cond = 0; @@ -810,8 +819,6 @@ void ActBullet_Missile(BULLET *bul, int level) break; } - static unsigned int inc; - switch (++inc % 3) { case 0: @@ -992,8 +999,6 @@ void ActBullet_Bom(BULLET *bul, int level) void ActBullet_Bubblin1(BULLET *bul) { - RECT rect[4]; - if (bul->flag & 0x2FF) { bul->cond = 0; @@ -1050,10 +1055,12 @@ void ActBullet_Bubblin1(BULLET *bul) SetCaret(bul->x, bul->y, 15, 0); } - SET_RECT(rect[0], 192, 0, 200, 8) - SET_RECT(rect[1], 200, 0, 208, 8) - SET_RECT(rect[2], 208, 0, 216, 8) - SET_RECT(rect[3], 216, 0, 224, 8) + RECT rect[4] = { + {192, 0, 200, 8}, + {200, 0, 208, 8}, + {208, 0, 216, 8}, + {216, 0, 224, 8}, + }; if (++bul->ani_wait > 3) { @@ -1069,10 +1076,7 @@ void ActBullet_Bubblin1(BULLET *bul) void ActBullet_Bubblin2(BULLET *bul) { - BOOL bDelete; - RECT rect[4]; - - bDelete = FALSE; + BOOL bDelete = FALSE; if (bul->direct == 0 && bul->flag & 1) bDelete = TRUE; @@ -1143,10 +1147,12 @@ void ActBullet_Bubblin2(BULLET *bul) SetCaret(bul->x, bul->y, 15, 0); } - SET_RECT(rect[0], 192, 8, 200, 16) - SET_RECT(rect[1], 200, 8, 208, 16) - SET_RECT(rect[2], 208, 8, 216, 16) - SET_RECT(rect[3], 216, 8, 224, 16) + RECT rect[4] = { + {192, 8, 200, 16}, + {200, 8, 208, 16}, + {208, 8, 216, 16}, + {216, 8, 224, 16}, + }; if (++bul->ani_wait > 3) { @@ -1656,6 +1662,8 @@ void ActBullet_SuperMissile(BULLET *bul, int level) { BOOL bHit; + static unsigned int inc; + if (++bul->count1 > bul->life_count) { bul->cond = 0; @@ -1737,8 +1745,6 @@ void ActBullet_SuperMissile(BULLET *bul, int level) break; } - static unsigned int inc; - switch (++inc % 3) { case 0: