From 42f7bb55c02d03cd9402f90aa02ea07a6839a57e Mon Sep 17 00:00:00 2001 From: cuckydev Date: Sun, 3 Feb 2019 13:26:43 -0500 Subject: [PATCH 1/2] STAR --- Makefile | 1 + src/Game.cpp | 11 +++-- src/Profile.cpp | 3 +- src/Star.cpp | 126 ++++++++++++++++++++++++++++++++++++++++++++++++ src/Star.h | 4 ++ 5 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 src/Star.cpp create mode 100644 src/Star.h diff --git a/Makefile b/Makefile index 5eb2d240..6f4d8946 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,7 @@ SOURCES = \ Shoot \ Sound \ Stage \ + Star \ SelStage \ TextScr \ Triangle \ diff --git a/src/Game.cpp b/src/Game.cpp index ece14555..09213ed4 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -17,6 +17,7 @@ #include "Bullet.h" #include "BulHit.h" #include "Shoot.h" +#include "Star.h" #include "Fade.h" #include "Frame.h" #include "Flags.h" @@ -103,7 +104,7 @@ int ModeOpening() { InitNpChar(); InitCaret(); - //InitStar(); + InitStar(); InitFade(); InitFlash(); InitBossLife(); @@ -245,7 +246,7 @@ int ModeTitle() //Reset everything InitCaret(); - //InitStar(); + InitStar(); CutNoise(); //Create variables @@ -436,7 +437,7 @@ int ModeAction() InitNpChar(); InitBullet(); InitCaret(); - //InitStar(); + InitStar(); InitFade(); InitFlash(); ClearArmsData(); @@ -470,7 +471,7 @@ int ModeAction() else ActMyChar(false); - //ActStar(); + ActStar(); ActNpChar(); ActBossChar(); ActValueView(); @@ -513,7 +514,7 @@ int ModeAction() PutNpChar(frame_x, frame_y); PutBullet(frame_x, frame_y); PutMyChar(frame_x, frame_y); - //PutStar(frame_x, frame_y); + PutStar(frame_x, frame_y); PutMapDataVector(frame_x, frame_y); PutStage_Front(frame_x, frame_y); PutFront(frame_x, frame_y); diff --git a/src/Profile.cpp b/src/Profile.cpp index 0ef8012d..b2a6a44d 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -11,6 +11,7 @@ #include "Flags.h" #include "MiniMap.h" #include "MyChar.h" +#include "Star.h" #include "NpChar.h" #include "Frame.h" #include "SelStage.h" @@ -215,7 +216,7 @@ bool LoadProfile(char *name) SetFrameTargetMyChar(16); InitBossLife(); CutNoise(); - //InitStar(); + InitStar(); ClearValueView(); gCurlyShoot_wait = 0; return true; diff --git a/src/Star.cpp b/src/Star.cpp new file mode 100644 index 00000000..adb3ded2 --- /dev/null +++ b/src/Star.cpp @@ -0,0 +1,126 @@ +#include + +#include "WindowsWrapper.h" + +#include "MyChar.h" +#include "Draw.h" +#include "Bullet.h" +#include "Game.h" + +static struct +{ + int cond; + int code; + int direct; + int x; + int y; + int xm; + int ym; + int act_no; + int act_wait; + int ani_no; + int ani_wait; + int view_left; + int view_top; + RECT rect; +} star[3]; + +void InitStar() +{ + //Clear stars + memset(star, 0, sizeof(star)); + + //Position + star[0].x = gMC.x; + star[0].y = gMC.y; + + star[1].x = gMC.x; + star[1].y = gMC.y; + + star[2].x = gMC.x; + star[2].y = gMC.y; + + //Speed + star[0].xm = 0x400; + star[0].ym = -0x200; + + star[1].xm = -0x200; + star[1].ym = 0x400; + + star[2].xm = 0x200; + star[2].ym = 0x200; +} + +void ActStar() +{ + static int a; + a++; + a %= 3; + + for (int i = 0; i < 3; i++) + { + if (i) + { + if (star[i - 1].x >= star[i].x) + star[i].xm += 0x80; + else + star[i].xm -= 0x80; + + if (star[i - 1].y >= star[i].y) + star[i].ym += 0xAA; + else + star[i].ym -= 0xAA; + } + else + { + if (gMC.x >= star[0].x) + star[0].xm += 0x80; + else + star[0].xm -= 0x80; + if (gMC.y >= star[0].y) + star[0].ym += 0xAA; + else + star[0].ym -= 0xAA; + } + + if (star[i].xm > 0xA00) + star[i].xm = 0xA00; + if (star[i].xm < -0xA00) + star[i].xm = -0xA00; + if (star[i].ym > 0xA00) + star[i].ym = 0xA00; + if (star[i].ym < -0xA00) + star[i].ym = -0xA00; + if (star[i].xm > 0xA00) + star[i].xm = 0xA00; + if (star[i].xm < -0xA00) + star[i].xm = -0xA00; + if (star[i].ym > 0xA00) + star[i].ym = 0xA00; + if (star[i].ym < -0xA00) + star[i].ym = -0xA00; + + star[i].x += star[i].xm; + star[i].y += star[i].ym; + + if (gMC.star > i && (gMC.equip & 0x80) && (g_GameFlags & 2) && a == i) + SetBullet(45, star[a].x, star[a].y, 0); + } +} + +void __cdecl PutStar(int fx, int fy) +{ + RECT rc[3]; + rc[0] = {192, 0, 200, 8}; + rc[1] = {192, 8, 200, 16}; + rc[2] = {192, 16, 200, 24}; + + if (!(gMC.cond & 2) && (gMC.equip & 0x80)) + { + for (int i = 0; i < 3; i++) + { + if (gMC.star > i) + PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], 16); + } + } +} diff --git a/src/Star.h b/src/Star.h new file mode 100644 index 00000000..ddf82d4d --- /dev/null +++ b/src/Star.h @@ -0,0 +1,4 @@ +#pragma once +void InitStar(); +void ActStar(); +void PutStar(int fx, int fy); From de6bf5209caaefb06b74d116f9b36a27902be676 Mon Sep 17 00:00:00 2001 From: cuckydev Date: Sun, 3 Feb 2019 13:41:15 -0500 Subject: [PATCH 2/2] whimsical star done --- ...Save Curly Booster v2 Spur Whimsical Star.dat | Bin 0 -> 1540 bytes src/Bullet.cpp | 12 +++++++++++- src/MyChar.cpp | 3 ++- src/Stage.cpp | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 build/Save Curly Booster v2 Spur Whimsical Star.dat diff --git a/build/Save Curly Booster v2 Spur Whimsical Star.dat b/build/Save Curly Booster v2 Spur Whimsical Star.dat new file mode 100644 index 0000000000000000000000000000000000000000..42c36f85f95e49ff5b907d5c26dd92a786ce7f1d GIT binary patch literal 1540 zcmZ?CH!v|YGBRLfU|`?_VumUps{zDdV9;b>24V;R$!&wO-K4k}c!6w?9%R4;count1 > bul->life_count) + bul->cond = 0; +} + void ActBullet() { for (int i = 0; i < BULLET_MAX; i++) @@ -1092,7 +1098,11 @@ void ActBullet() case 33: ActBullet_SuperBom(&gBul[i], 3); break; - + case 45: + ActBullet_Star(&gBul[i]); + break; + default: + continue; } } else diff --git a/src/MyChar.cpp b/src/MyChar.cpp index db5d6e78..9fa7f6fb 100644 --- a/src/MyChar.cpp +++ b/src/MyChar.cpp @@ -14,6 +14,7 @@ #include "TextScr.h" #include "Flags.h" #include "Game.h" +#include "Star.h" #include "Caret.h" MYCHAR gMC; @@ -740,7 +741,7 @@ void SetMyCharPosition(int x, int y) gMC.xm = 0; gMC.ym = 0; gMC.cond &= ~1; - //InitStar(); + InitStar(); } void MoveMyChar(int x, int y) diff --git a/src/Stage.cpp b/src/Stage.cpp index 7ce5143c..3c9968f3 100644 --- a/src/Stage.cpp +++ b/src/Stage.cpp @@ -8,6 +8,7 @@ #include "Map.h" #include "MapName.h" #include "MyChar.h" +#include "Bullet.h" #include "Boss.h" #include "Draw.h" #include "Tags.h" @@ -192,7 +193,7 @@ bool TransferStage(int no, int w, int x, int y) StartTextScript(w); SetFrameMyChar(); - //ClearBullet(); + ClearBullet(); InitCaret(); ClearValueView(); ResetQuake();