Add proper stage running
parent
cc8f9f21bc
commit
67307e300a
|
@ -1,4 +1,5 @@
|
|||
// Copyright © 2017 Project Golan, all rights reserved.
|
||||
include "objdefs/player.dod"
|
||||
include "objdefs/testobj.dod"
|
||||
|
||||
// EOF
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
// Copyright © 2017 Project Golan, all rights reserved.
|
||||
entity Shootable
|
||||
entity Player
|
||||
{
|
||||
health 1
|
||||
}
|
||||
|
||||
entity Player < Shootable
|
||||
{
|
||||
task G_Player_Think
|
||||
subtype Player
|
||||
size 4
|
||||
drawsize 16
|
||||
friction 0.9
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright © 2017 Project Golan, all rights reserved.
|
||||
entity TestObj
|
||||
{
|
||||
health 1
|
||||
size 10
|
||||
drawsize 16
|
||||
sprite "ent/testobj"
|
||||
}
|
||||
|
||||
// EOF
|
|
@ -2,7 +2,10 @@
|
|||
font "base" = "fonts/base.ttf", 24pt
|
||||
|
||||
texture "gui/border" = "textures/Border.png"
|
||||
texture "ent/player" = "sprites/Particle3_Pointer.png"
|
||||
|
||||
texture "ent/player" = "sprites/Particle3_Pointer.png"
|
||||
texture "ent/testobj" = "sprites/Particle3.png"
|
||||
|
||||
texture "box" = "textures/Box.png"
|
||||
texture "empty" = "textures/Empty.png"
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// Copyright © 2017 Project Golan, all rights reserved.
|
||||
{50 TestObj -200 0 16}
|
||||
{50 TestObj -200 100 16}
|
||||
|
||||
// EOF
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
// Extern Objects ------------------------------------------------------------|
|
||||
|
||||
char const *G_Place = u8"地球軌道・朝";
|
||||
char const *G_Place = u8"地球軌道・朝";
|
||||
unsigned long G_Time;
|
||||
|
||||
// Static Functions ----------------------------------------------------------|
|
||||
|
||||
|
@ -95,6 +96,8 @@ G_stage G_Stage_LoadMap(char const *fname)
|
|||
}
|
||||
while(!feof(fp));
|
||||
|
||||
printf("Stage: Done loading stage '%s'.\n", fname);
|
||||
|
||||
done:
|
||||
free(name);
|
||||
fclose(fp);
|
||||
|
@ -103,22 +106,42 @@ done:
|
|||
}
|
||||
|
||||
//
|
||||
// G_Stage_Begin
|
||||
// G_Stage_LoadBase
|
||||
//
|
||||
void G_Stage_Begin(unsigned stagenum)
|
||||
void G_Stage_LoadBase(void)
|
||||
{
|
||||
printf("Stage: Beginning stage %u.\n", stagenum);
|
||||
printf("Stage: Loading base map.\n");
|
||||
|
||||
G_stage s = G_Stage_LoadMap("maps/base.gmf0");
|
||||
|
||||
for(int i = 0; i < s.mapC; i++)
|
||||
for(size_t i = 0; i < s.mapC && s.mapV[i].time == 0; i++)
|
||||
s.mapV[i].proc(&s.mapV[i].data);
|
||||
|
||||
M_Vec_clear(s.map);
|
||||
|
||||
printf("Stage: Done loading, splitting blockmap.\n");
|
||||
printf("Stage: Splitting blockmap.\n");
|
||||
DGE_BlockMap_Split(16, 1);
|
||||
|
||||
printf("Stage: Done loading stage %u.\n", stagenum);
|
||||
M_Vec_clear(s.map);
|
||||
}
|
||||
|
||||
//
|
||||
// G_Stage_Run
|
||||
//
|
||||
void G_Stage_Run(unsigned stagenum)
|
||||
{
|
||||
printf("Stage: Beginning stage %u.\n", stagenum);
|
||||
|
||||
G_stage s = G_Stage_LoadMap(M_StrFmt("maps/stage%u.gmf0", stagenum));
|
||||
size_t i;
|
||||
|
||||
for(G_Time = 0;; G_Time++)
|
||||
{
|
||||
for(; i < s.mapC && s.mapV[i].time == G_Time; i++)
|
||||
s.mapV[i].proc(&s.mapV[i].data);
|
||||
|
||||
DGE_Task_Sleep(0, 1);
|
||||
}
|
||||
|
||||
M_Vec_clear(s.map);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
|
@ -41,11 +41,13 @@ typedef struct G_stage
|
|||
|
||||
// Extern Objects ------------------------------------------------------------|
|
||||
|
||||
extern char const *G_Place;
|
||||
extern char const *G_Place;
|
||||
extern long unsigned G_Time;
|
||||
|
||||
// Extern Functions ----------------------------------------------------------|
|
||||
|
||||
G_stage G_Stage_LoadMap(char const *fname);
|
||||
void G_Stage_Begin(unsigned stagenum);
|
||||
void G_Stage_LoadBase(void);
|
||||
void G_Stage_Run(unsigned stagenum);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,8 @@ void GInit(char const *resdecl)
|
|||
void main(void)
|
||||
{
|
||||
GInit("resdecl.rd");
|
||||
G_Stage_Begin(1);
|
||||
G_Stage_LoadBase();
|
||||
G_Stage_Run(1);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
|
@ -19,7 +19,8 @@ static void R_drawHitboxes(void)
|
|||
unsigned head = DGE_Thinker_Head();
|
||||
DGE_Point2 vp = DGE_Renderer_GetViewpoint();
|
||||
|
||||
for(DGE_Thinker th = {head}; (th.id = th.next) != head;) {
|
||||
for(DGE_Thinker th = {head}; (th.id = th.next) != head;)
|
||||
{
|
||||
DGE_PhysicsThinker pth;
|
||||
if((pth.id = DGE_Object_Cast(th.id, DGE_OT_PhysicsThinker))) {
|
||||
fixed tx = pth.x - vp.x, ty = pth.y - vp.y;
|
||||
|
|
Loading…
Reference in New Issue