Browse Source

Add background, intro and new HUD

master
Marrub 4 years ago
parent
commit
d831a361d1
10 changed files with 84 additions and 22 deletions
  1. +8
    -2
      data/resdecl.rd
  2. +1
    -1
      maps/base.gmf9
  3. +4
    -2
      src/g_stage.c
  4. +1
    -0
      src/g_stage.h
  5. +4
    -0
      src/m_str.h
  6. +61
    -14
      src/r_draw.c
  7. +1
    -1
      text/gui-eng.nts
  8. +1
    -1
      text/gui-jpn.nts
  9. +2
    -1
      text/place-eng.nts
  10. +1
    -0
      text/place-jpn.nts

+ 8
- 2
data/resdecl.rd View File

@@ -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"



+ 1
- 1
maps/base.gmf9 View File

@@ -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


+ 4
- 2
src/g_stage.c View File

@@ -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;


+ 1
- 0
src/g_stage.h View File

@@ -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 ----------------------------------------------------------|


+ 4
- 0
src/m_str.h View File

@@ -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, ...);


+ 61
- 14
src/r_draw.c View File

@@ -6,6 +6,8 @@

#include <Doominati.h>

#include <math.h>

// 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

+ 1
- 1
text/gui-eng.nts View File

@@ -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";
}

+ 1
- 1
text/gui-jpn.nts View File

@@ -1,5 +1,5 @@
language jpn
{
gui/highscore = "ハイスコア";
gui/player = "PLAYER %i\nスコア\n残り再試行回";
gui/player = "PLAYER %i\nスコア\n\n再起動残機\n\n弾薬";
}

+ 2
- 1
text/place-eng.nts View File

@@ -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...\"";
}

+ 1
- 0
text/place-jpn.nts View File

@@ -1,4 +1,5 @@
language jpn
{
place/stage1 = "地球軌道・朝";
place/stage1/intro = "「こうどんな負債が遺憾っすわね・・・」";
}

Loading…
Cancel
Save