Browse Source

Add background, intro and new HUD

Marrub 1 year 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 @@
1 1
 // Copyright © 2017 Project Golan, all rights reserved.
2
-font "base" = "fonts/base.ttf", 24pt
2
+font "base"  = "fonts/base.ttf", 24pt
3
+font "place" = "fonts/base.ttf", 30pt
3 4
 
4
-texture "gui/border" = "textures/Border.png"
5
+texture "gui/border"     = "textures/Border.png"
6
+texture "gui/playerback" = "textures/PlayerBack.png"
5 7
 
6 8
 texture "ent/testobj"    = "sprites/Particle3.png"
7 9
 texture "ent/explosion1" = "sprites/Explosion1.png"
@@ -14,6 +16,10 @@ texture "ent/shotfire1" = "sprites/Player/ShotFire1.png"
14 16
 texture "ent/shotfire2" = "sprites/Player/ShotFire2.png"
15 17
 texture "ent/shotfire3" = "sprites/Player/ShotFire3.png"
16 18
 
19
+texture "bkg/space"   = "textures/Space.png"
20
+texture "bkg/earth"   = "textures/Earth.png"
21
+texture "bkg/station" = "textures/Station.png"
22
+
17 23
 texture "box"   = "textures/Box.png"
18 24
 texture "empty" = "textures/Empty.png"
19 25
 

+ 1
- 1
maps/base.gmf9 View File

@@ -1,5 +1,5 @@
1 1
 // Copyright © 2017 Project Golan, all rights reserved.
2
-{0 Player -200  250 16}
2
+{0 Player -200  280 16}
3 3
 {0 Sector -450 -330 510 660 0 96} // center
4 4
 {0 Sector -450 -355 510  25 1 96} // top-blocker
5 5
 {0 Sector -450 -380 510  25 0 0 } // top-wall

+ 4
- 2
src/g_stage.c View File

@@ -13,7 +13,8 @@
13 13
 
14 14
 // Extern Objects ------------------------------------------------------------|
15 15
 
16
-__str         G_Place = s"place/default";
16
+__str         G_Place      = s"place/default";
17
+__str         G_PlaceIntro = s"place/default";
17 18
 unsigned long G_Time;
18 19
 
19 20
 // Static Functions ----------------------------------------------------------|
@@ -130,7 +131,8 @@ void G_Stage_Run(unsigned stagenum)
130 131
 {
131 132
    printf("Stage: Beginning stage %u.\n", stagenum);
132 133
 
133
-   G_Place = M_StrCreate(M_StrFmt("place/stage%u", stagenum));
134
+   G_Place      = M_strmk("place/stage%u",       stagenum);
135
+   G_PlaceIntro = M_strmk("place/stage%u/intro", stagenum);
134 136
 
135 137
    G_stage s = G_Stage_LoadMap(M_StrFmt("maps/stage%u.gmf0", stagenum));
136 138
    size_t i;

+ 1
- 0
src/g_stage.h View File

@@ -42,6 +42,7 @@ typedef struct G_stage
42 42
 // Extern Objects ------------------------------------------------------------|
43 43
 
44 44
 extern __str         G_Place;
45
+extern __str         G_PlaceIntro;
45 46
 extern long unsigned G_Time;
46 47
 
47 48
 // Extern Functions ----------------------------------------------------------|

+ 4
- 0
src/m_str.h View File

@@ -6,6 +6,10 @@
6 6
 
7 7
 #define M_strbufcpy(a, b) (strncpy((a), (b), M_countof(a)))
8 8
 
9
+#if __GDCC__
10
+#define M_strmk(...) M_StrCreate(M_StrFmt(__VA_ARGS__))
11
+#endif
12
+
9 13
 // Extern Functions ----------------------------------------------------------|
10 14
 
11 15
 char *M_StrFmt(char const *fmt, ...);

+ 61
- 14
src/r_draw.c View File

@@ -6,6 +6,8 @@
6 6
 
7 7
 #include <Doominati.h>
8 8
 
9
+#include <math.h>
10
+
9 11
 // Static Functions ----------------------------------------------------------|
10 12
 
11 13
 //
@@ -37,10 +39,50 @@ static void R_drawHitboxes(void)
37 39
 DGE_Callback [[__script("Draw")]]
38 40
 static void R_draw(ulfra delta)
39 41
 {
40
-   DGE_Shader_Bind(DGE_Shader_Get(s"plasma"));
41
-   DGE_Texture_Bind(0);
42
-   DGE_Draw_Rectangle(0, 0, 960, 720);
43
-   DGE_Shader_Bind(0);
42
+   static float yadd;
43
+
44
+   lfxpt time = G_Time + (lfxpt)delta;
45
+
46
+   if(G_Time < 50 && time)
47
+      yadd = -logf(0.7 / time);
48
+
49
+   DGE_Texture_Bind(DGE_Texture_Get(s"bkg/space"));
50
+   DGE_Draw_Rectangle(30, 30, 30+510, 30+660);
51
+
52
+   DGE_Texture_Bind(DGE_Texture_Get(s"bkg/earth"));
53
+   DGE_Draw_Rectangle(30, 30, 30+510, 30+660 + yadd*4 + time/80);
54
+
55
+   if(G_Time < 50) {
56
+      DGE_Texture_Bind(DGE_Texture_Get(s"bkg/station"));
57
+      DGE_Draw_Rectangle(30, 30, 30+510, 30+660 + yadd*100);
58
+   }
59
+}
60
+
61
+//
62
+// R_DrawPlace
63
+//
64
+static void R_drawPlace(lfxpt time)
65
+{
66
+   if(G_Time < 200)
67
+   {
68
+      if(G_Time > 100) DGE_Draw_SetColor(1lr, 1lr, 1lr, 1 - (time-100) / 100);
69
+
70
+      DGE_Font_Bind(DGE_Font_Get(s"place"));
71
+      DGE_Draw_SetTextAlign(DGE_Align_Center, DGE_Align_Center);
72
+      DGE_Draw_Text(285, 50, M_StrGet(G_Place));
73
+
74
+      DGE_Font_Bind(DGE_Font_Get(s"base"));
75
+      DGE_Draw_SetTextAlign(DGE_Align_Left, DGE_Align_Top);
76
+      DGE_Draw_Text(50, 80, M_StrGet(G_PlaceIntro));
77
+   }
78
+   else
79
+   {
80
+      if(G_Time < 225) DGE_Draw_SetColor(1lr, 1lr, 1lr, (time-200) / 25);
81
+      DGE_Draw_SetTextAlign(DGE_Align_Center, DGE_Align_Top);
82
+      DGE_Draw_Text(780, 20, M_StrGet(G_Place));
83
+   }
84
+
85
+   DGE_Draw_SetColor();
44 86
 }
45 87
 
46 88
 //
@@ -49,27 +91,32 @@ static void R_draw(ulfra delta)
49 91
 DGE_Callback [[__script("DrawPost")]]
50 92
 static void R_drawPost(ulfra delta)
51 93
 {
94
+   lfxpt time = G_Time + (lfxpt)delta;
95
+
52 96
    DGE_Texture_Bind(DGE_Texture_Get(s"gui/border"));
53 97
    DGE_Draw_Rectangle(0, 0, 960, 720);
54 98
 
55 99
    DGE_Font_Bind(DGE_Font_Get(s"base"));
56
-   DGE_Draw_SetTextAlign(DGE_Align_Center, DGE_Align_Top);
57
-   DGE_Draw_Text(760, 20, M_StrGet(G_Place));
58 100
 
59
-   DGE_Draw_SetTextAlign(DGE_Align_Left);
60
-   DGE_Draw_Text(585, 70, M_StrGet(s"gui/highscore"));
61
-   DGE_Draw_SetTextAlign(DGE_Align_Right);
62
-   DGE_Draw_Text(945, 70, M_StrFmt("%.15i", 0));
101
+   DGE_Draw_SetTextAlign(DGE_Align_Left, DGE_Align_Top);
102
+   DGE_Draw_Text(610, 70, M_StrGet(s"gui/highscore"));
103
+   DGE_Draw_Text(620, 97, M_StrFmt("%.20i", 0));
63 104
 
64 105
    for(int i = 0; i < G_Player_Count; i++)
65 106
    {
107
+      int const y = 250 * i;
108
+
109
+      DGE_Texture_Bind(DGE_Texture_Get(s"gui/playerback"));
110
+      DGE_Draw_Rectangle(0, y, 960, 720 + y);
111
+
66 112
       DGE_Draw_SetTextAlign(DGE_Align_Left);
67
-      DGE_Draw_Text(585, 120 + i * 20, M_StrFmt(M_StrGet(s"gui/player"), i+1));
68
-      DGE_Draw_SetTextAlign(DGE_Align_Right);
69
-      DGE_Draw_Text(945, 140 + i * 20, M_StrFmt("%.15i\n%i", 0, 5));
113
+      DGE_Draw_Text(620, 160 + y, M_StrFmt(M_StrGet(s"gui/player"), i + 1));
114
+      DGE_Draw_Text(630, 207 + y, M_StrFmt(u8"%.20i\n\n%i\n\n∞", 0, 5));
70 115
    }
71 116
 
72
-   R_drawHitboxes();
117
+   R_drawPlace(time);
118
+
119
+// R_drawHitboxes();
73 120
 }
74 121
 
75 122
 // EOF

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

@@ -1,5 +1,5 @@
1 1
 language eng
2 2
 {
3 3
    gui/highscore = "High Score";
4
-   gui/player = "Player %i\nScore\nReboots";
4
+   gui/player = "Player %i\nScore\n\nReboot\n\nAmmo";
5 5
 }

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

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

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

@@ -1,5 +1,6 @@
1 1
 language eng
2 2
 {
3 3
    place/default = "Default place";
4
-   place/stage1 = "Low Earth Orbit - Morning";
4
+   place/stage1 = "Earth Orbit - Morning";
5
+   place/stage1/intro = "\"Having liabilities like this\nnever turns out well for me,\ndoes it...\"";
5 6
 }

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

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

Loading…
Cancel
Save