omi-eikyo/src/g_object.c

61 lines
1.3 KiB
C
Raw Normal View History

2017-09-23 12:43:54 -07:00
// Copyright © 2017 Project Golan, all rights reserved.
#include "g_object.h"
#include "g_stage.h"
#include <Doominati.h>
2017-09-23 17:21:07 -07:00
#include <stdio.h>
2017-09-23 12:43:54 -07:00
// Extern Functions ----------------------------------------------------------|
//
// G_Entity_Create
//
void G_Entity_Create(G_mfdat *info)
{
DGE_Entity ent = {DGE_Entity_Create(0)};
ent.x = info->ent.x;
ent.y = info->ent.y;
2017-09-26 16:27:40 -07:00
ent.z = info->ent.z;
ent.gravity = 1;
ent.mass = 1;
ent.friction = 0.875ulr;
2017-09-23 12:43:54 -07:00
G_entty const *type;
if((type = G_ObjDef_GetType(info->ent.name))) {
G_ObjDef_setupEntity(type, ent);
G_ObjDef_createTask (type, ent);
}
}
//
// G_Sector_Create
//
void G_Sector_Create(G_mfdat *info)
{
DGE_Sector sec = {DGE_Sector_Create(4, 0)};
DGE_Object_RefAdd(sec.id);
2017-09-23 17:21:07 -07:00
sec.friction = 0.9lr;
2017-09-26 16:27:40 -07:00
sec.gz = -2;
2017-09-23 17:21:07 -07:00
sec.zl = info->sec.f;
sec.zu = info->sec.c;
2017-09-23 12:43:54 -07:00
fixed xl = info->sec.x , yl = info->sec.y;
fixed xu = info->sec.w + xl, yu = info->sec.h + yl;
DGE_Sector_PointSet(sec.id, 0, (DGE_Point2){xl, yl});
DGE_Sector_PointSet(sec.id, 1, (DGE_Point2){xl, yu});
DGE_Sector_PointSet(sec.id, 2, (DGE_Point2){xu, yu});
DGE_Sector_PointSet(sec.id, 3, (DGE_Point2){xu, yl});
DGE_Sector_CalcBounds(sec.id);
DGE_Sector_Block(sec.id);
}
// EOF