62 lines
1.3 KiB
C
62 lines
1.3 KiB
C
// Copyright © 2017 Project Golan, all rights reserved.
|
|
#include "g_object.h"
|
|
|
|
#include "g_stage.h"
|
|
|
|
#include <Doominati.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
//
|
|
// G_Entity_Create
|
|
//
|
|
void G_Entity_Create(G_mfdat *info)
|
|
{
|
|
G_entty const *type = G_ObjDef_GetType(info->ent.name);
|
|
|
|
G_entit ent = {DGE_Entity_Create(type ? type->ext : 0)};
|
|
|
|
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;
|
|
|
|
if(type) {
|
|
G_ObjDef_setupEntity(type, ent);
|
|
G_ObjDef_createTask (type, ent.id);
|
|
}
|
|
}
|
|
|
|
//
|
|
// G_Sector_Create
|
|
//
|
|
void G_Sector_Create(G_mfdat *info)
|
|
{
|
|
DGE_Sector sec = {DGE_Sector_Create(4, 0)};
|
|
|
|
DGE_Object_RefAdd(sec.id);
|
|
|
|
sec.friction = 0.9lr;
|
|
sec.gz = -2;
|
|
sec.zl = info->sec.f;
|
|
sec.zu = info->sec.c;
|
|
|
|
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
|