From d831a361d11aaf695fd64ca9061d0a4a82d4178a Mon Sep 17 00:00:00 2001 From: Marrub Date: Wed, 4 Oct 2017 05:08:20 -0400 Subject: [PATCH] Add background, intro and new HUD --- data/resdecl.rd | 10 +++++-- maps/base.gmf9 | 2 +- src/g_stage.c | 6 ++-- src/g_stage.h | 1 + src/m_str.h | 4 +++ src/r_draw.c | 75 +++++++++++++++++++++++++++++++++++++--------- text/gui-eng.nts | 2 +- text/gui-jpn.nts | 2 +- text/place-eng.nts | 3 +- text/place-jpn.nts | 1 + 10 files changed, 84 insertions(+), 22 deletions(-) diff --git a/data/resdecl.rd b/data/resdecl.rd index c54f60c..48c0667 100644 --- a/data/resdecl.rd +++ b/data/resdecl.rd @@ -1,7 +1,9 @@ // Copyright © 2017 Project Golan, all rights reserved. -font "base" = "fonts/base.ttf", 24pt +font "base" = "fonts/base.ttf", 24pt +font "place" = "fonts/base.ttf", 30pt -texture "gui/border" = "textures/Border.png" +texture "gui/border" = "textures/Border.png" +texture "gui/playerback" = "textures/PlayerBack.png" texture "ent/testobj" = "sprites/Particle3.png" texture "ent/explosion1" = "sprites/Explosion1.png" @@ -14,6 +16,10 @@ texture "ent/shotfire1" = "sprites/Player/ShotFire1.png" texture "ent/shotfire2" = "sprites/Player/ShotFire2.png" texture "ent/shotfire3" = "sprites/Player/ShotFire3.png" +texture "bkg/space" = "textures/Space.png" +texture "bkg/earth" = "textures/Earth.png" +texture "bkg/station" = "textures/Station.png" + texture "box" = "textures/Box.png" texture "empty" = "textures/Empty.png" diff --git a/maps/base.gmf9 b/maps/base.gmf9 index 2fa9cad..600b4bb 100644 --- a/maps/base.gmf9 +++ b/maps/base.gmf9 @@ -1,5 +1,5 @@ // Copyright © 2017 Project Golan, all rights reserved. -{0 Player -200 250 16} +{0 Player -200 280 16} {0 Sector -450 -330 510 660 0 96} // center {0 Sector -450 -355 510 25 1 96} // top-blocker {0 Sector -450 -380 510 25 0 0 } // top-wall diff --git a/src/g_stage.c b/src/g_stage.c index 5901cd6..6b8d460 100644 --- a/src/g_stage.c +++ b/src/g_stage.c @@ -13,7 +13,8 @@ // Extern Objects ------------------------------------------------------------| -__str G_Place = s"place/default"; +__str G_Place = s"place/default"; +__str G_PlaceIntro = s"place/default"; unsigned long G_Time; // Static Functions ----------------------------------------------------------| @@ -130,7 +131,8 @@ void G_Stage_Run(unsigned stagenum) { printf("Stage: Beginning stage %u.\n", stagenum); - G_Place = M_StrCreate(M_StrFmt("place/stage%u", stagenum)); + G_Place = M_strmk("place/stage%u", stagenum); + G_PlaceIntro = M_strmk("place/stage%u/intro", stagenum); G_stage s = G_Stage_LoadMap(M_StrFmt("maps/stage%u.gmf0", stagenum)); size_t i; diff --git a/src/g_stage.h b/src/g_stage.h index 213ae28..6e16c90 100644 --- a/src/g_stage.h +++ b/src/g_stage.h @@ -42,6 +42,7 @@ typedef struct G_stage // Extern Objects ------------------------------------------------------------| extern __str G_Place; +extern __str G_PlaceIntro; extern long unsigned G_Time; // Extern Functions ----------------------------------------------------------| diff --git a/src/m_str.h b/src/m_str.h index a5a9594..b0ae4df 100644 --- a/src/m_str.h +++ b/src/m_str.h @@ -6,6 +6,10 @@ #define M_strbufcpy(a, b) (strncpy((a), (b), M_countof(a))) +#if __GDCC__ +#define M_strmk(...) M_StrCreate(M_StrFmt(__VA_ARGS__)) +#endif + // Extern Functions ----------------------------------------------------------| char *M_StrFmt(char const *fmt, ...); diff --git a/src/r_draw.c b/src/r_draw.c index faf1a3c..7a41c31 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -6,6 +6,8 @@ #include +#include + // Static Functions ----------------------------------------------------------| // @@ -37,10 +39,50 @@ static void R_drawHitboxes(void) DGE_Callback [[__script("Draw")]] static void R_draw(ulfra delta) { - DGE_Shader_Bind(DGE_Shader_Get(s"plasma")); - DGE_Texture_Bind(0); - DGE_Draw_Rectangle(0, 0, 960, 720); - DGE_Shader_Bind(0); + static float yadd; + + lfxpt time = G_Time + (lfxpt)delta; + + if(G_Time < 50 && time) + yadd = -logf(0.7 / time); + + DGE_Texture_Bind(DGE_Texture_Get(s"bkg/space")); + DGE_Draw_Rectangle(30, 30, 30+510, 30+660); + + DGE_Texture_Bind(DGE_Texture_Get(s"bkg/earth")); + DGE_Draw_Rectangle(30, 30, 30+510, 30+660 + yadd*4 + time/80); + + if(G_Time < 50) { + DGE_Texture_Bind(DGE_Texture_Get(s"bkg/station")); + DGE_Draw_Rectangle(30, 30, 30+510, 30+660 + yadd*100); + } +} + +// +// R_DrawPlace +// +static void R_drawPlace(lfxpt time) +{ + if(G_Time < 200) + { + if(G_Time > 100) DGE_Draw_SetColor(1lr, 1lr, 1lr, 1 - (time-100) / 100); + + DGE_Font_Bind(DGE_Font_Get(s"place")); + DGE_Draw_SetTextAlign(DGE_Align_Center, DGE_Align_Center); + DGE_Draw_Text(285, 50, M_StrGet(G_Place)); + + DGE_Font_Bind(DGE_Font_Get(s"base")); + DGE_Draw_SetTextAlign(DGE_Align_Left, DGE_Align_Top); + DGE_Draw_Text(50, 80, M_StrGet(G_PlaceIntro)); + } + else + { + if(G_Time < 225) DGE_Draw_SetColor(1lr, 1lr, 1lr, (time-200) / 25); + DGE_Draw_SetTextAlign(DGE_Align_Center, DGE_Align_Top); + DGE_Draw_Text(780, 20, M_StrGet(G_Place)); + } + + DGE_Draw_SetColor(); } // @@ -49,27 +91,32 @@ static void R_draw(ulfra delta) DGE_Callback [[__script("DrawPost")]] static void R_drawPost(ulfra delta) { + lfxpt time = G_Time + (lfxpt)delta; + DGE_Texture_Bind(DGE_Texture_Get(s"gui/border")); DGE_Draw_Rectangle(0, 0, 960, 720); DGE_Font_Bind(DGE_Font_Get(s"base")); - DGE_Draw_SetTextAlign(DGE_Align_Center, DGE_Align_Top); - DGE_Draw_Text(760, 20, M_StrGet(G_Place)); - DGE_Draw_SetTextAlign(DGE_Align_Left); - DGE_Draw_Text(585, 70, M_StrGet(s"gui/highscore")); - DGE_Draw_SetTextAlign(DGE_Align_Right); - DGE_Draw_Text(945, 70, M_StrFmt("%.15i", 0)); + DGE_Draw_SetTextAlign(DGE_Align_Left, DGE_Align_Top); + DGE_Draw_Text(610, 70, M_StrGet(s"gui/highscore")); + DGE_Draw_Text(620, 97, M_StrFmt("%.20i", 0)); for(int i = 0; i < G_Player_Count; i++) { + int const y = 250 * i; + + DGE_Texture_Bind(DGE_Texture_Get(s"gui/playerback")); + DGE_Draw_Rectangle(0, y, 960, 720 + y); + DGE_Draw_SetTextAlign(DGE_Align_Left); - DGE_Draw_Text(585, 120 + i * 20, M_StrFmt(M_StrGet(s"gui/player"), i+1)); - DGE_Draw_SetTextAlign(DGE_Align_Right); - DGE_Draw_Text(945, 140 + i * 20, M_StrFmt("%.15i\n%i", 0, 5)); + DGE_Draw_Text(620, 160 + y, M_StrFmt(M_StrGet(s"gui/player"), i + 1)); + DGE_Draw_Text(630, 207 + y, M_StrFmt(u8"%.20i\n\n%i\n\n∞", 0, 5)); } - R_drawHitboxes(); + R_drawPlace(time); + +// R_drawHitboxes(); } // EOF diff --git a/text/gui-eng.nts b/text/gui-eng.nts index 70cd217..627010c 100644 --- a/text/gui-eng.nts +++ b/text/gui-eng.nts @@ -1,5 +1,5 @@ language eng { gui/highscore = "High Score"; - gui/player = "Player %i\nScore\nReboots"; + gui/player = "Player %i\nScore\n\nReboot\n\nAmmo"; } diff --git a/text/gui-jpn.nts b/text/gui-jpn.nts index 6eb9687..af4b15d 100644 --- a/text/gui-jpn.nts +++ b/text/gui-jpn.nts @@ -1,5 +1,5 @@ language jpn { gui/highscore = "ハイスコア"; - gui/player = "PLAYER %i\nスコア\n残り再試行回"; + gui/player = "PLAYER %i\nスコア\n\n再起動残機\n\n弾薬"; } diff --git a/text/place-eng.nts b/text/place-eng.nts index 9e0dbdb..b5c4fe7 100644 --- a/text/place-eng.nts +++ b/text/place-eng.nts @@ -1,5 +1,6 @@ language eng { place/default = "Default place"; - place/stage1 = "Low Earth Orbit - Morning"; + place/stage1 = "Earth Orbit - Morning"; + place/stage1/intro = "\"Having liabilities like this\nnever turns out well for me,\ndoes it...\""; } diff --git a/text/place-jpn.nts b/text/place-jpn.nts index 5bb84ca..027ae9b 100644 --- a/text/place-jpn.nts +++ b/text/place-jpn.nts @@ -1,4 +1,5 @@ language jpn { place/stage1 = "地球軌道・朝"; + place/stage1/intro = "「こうどんな負債が遺憾っすわね・・・」"; }