omi-eikyo/src/main.c

100 lines
2.1 KiB
C
Raw Normal View History

2017-09-20 08:42:57 -07:00
// Copyright © 2017 Project Golan, all rights reserved.
2017-10-04 17:14:46 -07:00
// See COPYING for more information.
2017-09-23 12:43:54 -07:00
#include "g_stage.h"
2017-09-27 19:26:32 -07:00
#include "g_object.h"
#include "g_player.h"
2017-09-29 04:50:36 -07:00
#include "m_math.h"
2017-09-20 08:42:57 -07:00
#include <Doominati.h>
#include <stdio.h>
2017-09-21 10:53:20 -07:00
// Extern Functions ----------------------------------------------------------|
2017-09-20 19:36:30 -07:00
2017-09-29 04:50:36 -07:00
//
// G_TestObj_Think
//
DGE_Callback
2017-10-04 02:07:02 -07:00
void G_TestObj_Think(G_entty const *ty, unsigned id)
2017-09-29 04:50:36 -07:00
{
G_entit th = {id};
DGE_Object_RefAdd(id);
while(th.health > 0)
DGE_Task_Sleep(0, 1);
fixed x = th.x, y = th.y;
DGE_Object_RefSub(id);
DGE_ParticleSys ps = {DGE_ParticleSys_Create(0, 128)};
ps.sprite = DGE_Texture_Get(s"ent/explosion1");
ps.x = x;
ps.y = y;
DGE_Particle prt = {
.life = 30,
.size = {20, 20},
.color = {1ulr, 1ulr, 0ulr, 1ulr}, {1ulr, 1ulr, 0ulr, 0ulr}, 0.05};
for(int i = 0; i < 7; i++)
{
prt.vel.x = M_Random_Float(-2, 2);
prt.vel.y = M_Random_Float(-2, 2);
prt.pos.x = M_Random_Float(-4, 4);
prt.pos.y = M_Random_Float(-4, 4);
DGE_ParticleSys_Add(ps.id, prt);
}
DGE_Task_Sleep(0, 10);
ps.sprite = DGE_Texture_Get(s"ent/explosion2");
DGE_Task_Sleep(0, 10);
ps.sprite = DGE_Texture_Get(s"ent/explosion3");
DGE_Task_Sleep(0, 20);
DGE_Thinker_Unlink(ps.id);
}
2017-09-20 08:42:57 -07:00
//
2017-09-23 17:21:07 -07:00
// GInit
2017-09-20 08:42:57 -07:00
//
2017-09-26 14:00:23 -07:00
void GInit(char const *resdecl)
2017-09-20 08:42:57 -07:00
{
2017-09-23 12:43:54 -07:00
extern void R_ResDec_Load(char const *fname);
2017-09-20 08:42:57 -07:00
printf("\n=====================\n"
u8"オミ:影響の目 1.0\n"
u8"Copyright © 2017 Project Golan, all rights reserved.\n\n");
2017-09-21 10:53:20 -07:00
DGE_Renderer_SetVirtualRes(960, 720);
2017-09-20 08:42:57 -07:00
2017-09-21 18:55:03 -07:00
printf("Loading resource declarations...\n");
2017-09-26 14:00:23 -07:00
R_ResDec_Load(resdecl);
2017-09-21 18:55:03 -07:00
2017-09-20 08:42:57 -07:00
printf("Loading object function table...\n");
G_ObjDef_Init();
G_ObjDef_AddType("Player", subtype_player, G_Player_propC, (DGE_CallbackType)G_Player_Think);
2017-09-29 04:50:36 -07:00
G_ObjDef_AddType("Test", subtype_test, 0, (DGE_CallbackType)G_TestObj_Think);
2017-09-20 08:42:57 -07:00
printf("Loading object definitions...\n");
G_ObjDef_Load("objdefs.dod");
2017-09-20 19:36:30 -07:00
printf("Ready.\n");
2017-09-23 17:21:07 -07:00
}
2017-09-21 10:53:20 -07:00
2017-09-23 17:21:07 -07:00
//
// main
//
[[__extern("asm")]] DGE_Callback
void main(void)
{
2017-09-26 14:00:23 -07:00
GInit("resdecl.rd");
2017-09-28 10:51:14 -07:00
G_Stage_LoadBase();
G_Stage_Run(1);
2017-09-20 08:42:57 -07:00
}
// EOF