// Copyright © 2017 Project Golan, all rights reserved. #include "g_stage.h" #include "g_object.h" #include "g_player.h" #include "m_math.h" #include #include // Extern Functions ----------------------------------------------------------| // // G_TestObj_Think // DGE_Callback void G_TestObj_Think(unsigned id) { 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); } // // GInit // void GInit(char const *resdecl) { extern void R_ResDec_Load(char const *fname); printf("\n=====================\n" u8"オミ:影響の目 1.0\n" u8"Copyright © 2017 Project Golan, all rights reserved.\n\n"); DGE_Renderer_SetVirtualRes(960, 720); printf("Loading resource declarations...\n"); R_ResDec_Load(resdecl); printf("Loading object function table...\n"); G_ObjDef_Init(); G_ObjDef_AddType("Player", subtype_player, G_Player_propC, (DGE_CallbackType)G_Player_Think); G_ObjDef_AddType("Test", subtype_test, 0, (DGE_CallbackType)G_TestObj_Think); printf("Loading object definitions...\n"); G_ObjDef_Load("objdefs.dod"); printf("Ready.\n"); } // // main // [[__extern("asm")]] DGE_Callback void main(void) { GInit("resdecl.rd"); G_Stage_LoadBase(); G_Stage_Run(1); } // EOF