diff --git a/data/objdefs/testobj.dod b/data/objdefs/testobj.dod index 8ee6dfc..8956d9a 100644 --- a/data/objdefs/testobj.dod +++ b/data/objdefs/testobj.dod @@ -2,10 +2,11 @@ entity TestObj { subtype Test - health 1 + health 6 size 10 drawsize 16 sprite "ent/testobj" + color 1, 0, 0 } // EOF diff --git a/data/resdecl.rd b/data/resdecl.rd index 48c0667..4565a42 100644 --- a/data/resdecl.rd +++ b/data/resdecl.rd @@ -5,7 +5,7 @@ font "place" = "fonts/base.ttf", 30pt texture "gui/border" = "textures/Border.png" texture "gui/playerback" = "textures/PlayerBack.png" -texture "ent/testobj" = "sprites/Particle3.png" +texture "ent/testobj" = "sprites/Particle2.png" texture "ent/explosion1" = "sprites/Explosion1.png" texture "ent/explosion2" = "sprites/Explosion2.png" texture "ent/explosion3" = "sprites/Explosion3.png" diff --git a/maps/stage1.gmf9 b/maps/stage1.gmf9 index 9f4e1d0..97f577b 100644 --- a/maps/stage1.gmf9 +++ b/maps/stage1.gmf9 @@ -1,19 +1,19 @@ // Copyright © 2017 Project Golan, all rights reserved. -{ 50 TestObj -300 -200 16} -{ 60 TestObj -250 -200 16} -{100 TestObj -150 -200 16} -{110 TestObj -100 -200 16} -{150 TestObj -200 -200 16} -{160 TestObj -250 -200 16} -{200 TestObj -300 -200 16} -{210 TestObj -250 -200 16} -{250 TestObj -300 -200 16} -{260 TestObj -250 -200 16} -{300 TestObj -150 -200 16} -{310 TestObj -100 -200 16} -{350 TestObj -200 -200 16} -{360 TestObj -250 -200 16} -{400 TestObj -300 -200 16} -{410 TestObj -250 -200 16} +{ 50 TestObj -300 -340 17} +{ 60 TestObj -250 -340 17} +{100 TestObj -150 -340 17} +{110 TestObj -100 -340 17} +{150 TestObj -200 -340 17} +{160 TestObj -250 -340 17} +{200 TestObj -300 -340 17} +{210 TestObj -250 -340 17} +{250 TestObj -300 -340 17} +{260 TestObj -250 -340 17} +{300 TestObj -150 -340 17} +{310 TestObj -100 -340 17} +{350 TestObj -200 -340 17} +{360 TestObj -250 -340 17} +{400 TestObj -300 -340 17} +{410 TestObj -250 -340 17} // EOF diff --git a/src/g_objdef.c b/src/g_objdef.c index 11e99d3..7da3dd7 100644 --- a/src/g_objdef.c +++ b/src/g_objdef.c @@ -87,6 +87,7 @@ typedef union G_odprm integ i; fixed k; lfrac r; + ulfra R; } G_odprm; typedef struct G_odarg @@ -223,12 +224,14 @@ static G_odarg G_ObjDef_getArgs(G_dodst *st, char const *arg) a.argv[a.argc++].t = \ f(st->expect(tok_number, "number")->textV, __VA_ARGS__); \ break - CaseN('u', u, strtoui, NULL, 0); - CaseN('i', i, strtoi, NULL, 0); - CaseN('k', k, strtofxhk, NULL); - CaseN('r', r, strtofxlk, NULL); - // TODO: get david to implement fracts - //CaseN('r', r, strtofxlr, NULL); + CaseN('u', u, strtoui, NULL, 0); + CaseN('i', i, strtoi, NULL, 0); + CaseN('k', k, strtofxhk, NULL); + // TODO: replace when strtofxr* is added + CaseN('r', r, strtod, NULL); + CaseN('R', R, strtod, NULL); + //CaseN('r', r, strtofxlr, NULL); + //CaseN('R', R, strtofxulr, NULL); #undef CaseN case '|': done = true; continue; case '\0': st->throw("too many arguments"); @@ -282,12 +285,10 @@ static void G_ObjDef_getEntProp(G_dodst *st, G_enttype *type, char const *id) G_odarg a = st->getArgs("k|kk"); if(a.argc == 1) { type->sx = type->sy = a.argv[0].k; - type->sz = 16; } else { type->sx = a.argv[0].k; type->sy = a.argv[1].k; if(a.argc > 2) type->sz = a.argv[2].k; - else type->sz = 16; } } else if(strcmp(id, "drawsize") == 0) @@ -300,6 +301,14 @@ static void G_ObjDef_getEntProp(G_dodst *st, G_enttype *type, char const *id) type->rsy = a.argv[1].k; } } + else if(strcmp(id, "color") == 0) + { + G_odarg a = st->getArgs("R|RRR"); + type->cr = a.argv[0].R; + if(a.argc > 1) type->cg = a.argv[1].R; + if(a.argc > 2) type->cb = a.argv[2].R; + if(a.argc > 3) type->ca = a.argv[3].R; + } else if(strcmp(id, "sprite") == 0) { type->sprite = DGE_Texture_Get( @@ -449,6 +458,9 @@ static void G_ObjDef_parseEntDef(G_dodst *st) } } + decl->type.sz = 16; + decl->type.cr = decl->type.cg = decl->type.cb = decl->type.ca = 1.0ulr; + if(st->drop(tok_lt)) { G_etdcl *base = G_enttypes.find(st->expect(tok_identi, "base entity name")->textV); diff --git a/src/g_objdef.h b/src/g_objdef.h index a3a2e4d..0d5cc0f 100644 --- a/src/g_objdef.h +++ b/src/g_objdef.h @@ -18,6 +18,10 @@ (th).sx = (type)->sx; \ (th).sy = (type)->sy; \ (th).sz = (type)->sz; \ + (th).cr = (type)->cr; \ + (th).cg = (type)->cg; \ + (th).cb = (type)->cb; \ + (th).ca = (type)->ca; \ (th).subtype = (type)->subtype; \ } while(0) @@ -53,6 +57,7 @@ typedef struct G_enttype fixed mass; fixed rsx, rsy; fixed sx, sy, sz; + ulfra cr, cg, cb, ca; mword subtype; mword ext; DGE_CallbackType task; diff --git a/src/g_player.c b/src/g_player.c index c76d5f0..1696df4 100644 --- a/src/g_player.c +++ b/src/g_player.c @@ -59,6 +59,8 @@ void G_Player_Think(G_enttype const *ty, unsigned id) G_player th = {id}; G_renderth shot = {DGE_RenderThinker_Create(0)}; + G_Player_Count++; + shot.rsx = 30; shot.rsy = 24; @@ -73,6 +75,7 @@ void G_Player_Think(G_enttype const *ty, unsigned id) { G_Player_applyVelocity(ty, th); + // TODO: de-hardcode this if(G_Time < 70) th.y = th.y + log(G_Time / 70.0) * 0.7hk;