Browse Source

Account for physics changes

master
Marrub 5 years ago
parent
commit
9191616182
  1. 1
      data/objdefs/player.dod
  2. 12
      maps/base.gmf9
  3. 7
      src/g_object.c
  4. 4
      src/g_player.c
  5. 5
      src/g_stage.c
  6. 2
      src/g_stage.h
  7. 4
      src/golan5.c

1
data/objdefs/player.dod

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

12
maps/base.gmf9

@ -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

7
src/g_object.c

@ -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;

4
src/g_player.c

@ -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
}

5
src/g_stage.c

@ -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);

2
src/g_stage.h

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

4
src/golan5.c

@ -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);

Loading…
Cancel
Save