Account for physics changes

master
Marrub 2017-09-26 19:27:40 -04:00
parent 10986d286b
commit 9191616182
7 changed files with 20 additions and 15 deletions

View File

@ -10,7 +10,6 @@ entity Player < Shootable
size 4
drawsize 16
friction 0.9
mass 1.15
sprite "ent/player"
}

View File

@ -1,9 +1,9 @@
// Copyright © 2017 Project Golan, all rights reserved.
{0 Player -200 250}
{0 Sector -450 -330 510 660 0 64} // center
{0 Sector -450 -355 510 25 64 96} // top
{0 Sector -450 330 510 25 64 96} // bottom
{0 Sector -475 -355 25 710 64 96} // left
{0 Sector 60 -355 25 710 64 96} // right
{0 Player -200 250 0}
{0 Sector -450 -330 510 660 -16 96} // center
{0 Sector -450 -355 510 25 64 96} // top
{0 Sector -450 330 510 25 64 96} // bottom
{0 Sector -475 -355 25 710 64 96} // left
{0 Sector 60 -355 25 710 64 96} // right
// EOF

View File

@ -18,6 +18,11 @@ void G_Entity_Create(G_mfdat *info)
ent.x = info->ent.x;
ent.y = info->ent.y;
ent.z = info->ent.z;
ent.gravity = 1;
ent.mass = 1;
ent.friction = 0.875ulr;
G_entty const *type;
if((type = G_ObjDef_GetType(info->ent.name))) {
@ -36,7 +41,7 @@ void G_Sector_Create(G_mfdat *info)
DGE_Object_RefAdd(sec.id);
sec.friction = 0.9lr;
sec.gz = -3;
sec.gz = -2;
sec.zl = info->sec.f;
sec.zu = info->sec.c;

View File

@ -23,8 +23,8 @@ static void G_Player_applyVelocity(DGE_Entity ent)
sincosf(ang, &s, &c);
ent.vx = ent.vx + c * mag * 1.1;
ent.vy = ent.vy - s * mag * 1.1;
ent.vx = ent.vx + c * mag * 5;
ent.vy = ent.vy - s * mag * 5;
// TODO: apply animation based on X velocity here
}

View File

@ -39,10 +39,11 @@ static void G_Stage_readSector(FILE *fp, G_stage *s, hword *size, mword time)
//
static void G_Stage_readEntity(FILE *fp, G_stage *s, hword *size, mword time, char *name)
{
*size -= 4 * 2;
*size -= 4 * 3;
G_mfent ent;
ent.x = M_IO_ReadLE4k(fp);
ent.y = M_IO_ReadLE4k(fp);
ent.z = M_IO_ReadLE4k(fp);
M_strbufcpy(ent.name, name);
M_Vec_grow(s->map, 1);
M_Vec_next(s->map) = (G_mfptr){time, {.ent = ent}, G_Entity_Create};
@ -87,7 +88,7 @@ G_stage G_Stage_LoadMap(char const *fname)
if(strcmp(name, "Sector") == 0 && size >= 4 * 6)
G_Stage_readSector(fp, &s, &size, time);
else if(size >= 4 * 2)
else if(size >= 4 * 3)
G_Stage_readEntity(fp, &s, &size, time, name);
if(size) fseek(fp, size, SEEK_CUR);

View File

@ -16,7 +16,7 @@ typedef struct G_mfsec
typedef struct G_mfent
{
fixed x, y;
fixed x, y, z;
char name[32];
} G_mfent;

View File

@ -85,8 +85,8 @@ int main(int argc, char **argv)
M_IO_WriteLE2u(out, 4 * 6);
for(int i = 0; i < 6; i++) WriteNum(out, &tb);
} else {
M_IO_WriteLE2u(out, 4 * 2);
for(int i = 0; i < 2; i++) WriteNum(out, &tb);
M_IO_WriteLE2u(out, 4 * 3);
for(int i = 0; i < 3; i++) WriteNum(out, &tb);
}
Expect(&tb, tok_bracec);