You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.5 KiB
81 lines
2.5 KiB
#include "uniquake.h"
|
|
|
|
#include "../Quake/quakedef.h"
|
|
|
|
typedef struct unity_gamecalls_s
|
|
{
|
|
void(*SetEntityModel)(void *context, int entityNum, const char *modelName);
|
|
void(*SetEntityTransform)(void *context, int entityNum, vec3_t origin, vec3_t angles);
|
|
void(*RemoveEntity)(void *context, int entityNum);
|
|
void(*UpdateEntityAnimation)(void *context, int entityNum, int pose1, int pose2, float blend);
|
|
void(*SetEntitySkin)(void *context, int entityNum, int skinNum);
|
|
|
|
void(*RunParticleEffect)(void *context, vec3_t origin, vec3_t direction, unsigned int colorMin, unsigned int colorMax, int count);
|
|
void(*CreateParticleEffect)(void *context, int type, vec3_t origin, unsigned int colorMin, unsigned int colorMax);
|
|
} unity_gamecalls_t;
|
|
|
|
static void *unity_context;
|
|
static const unity_gamecalls_t *unity_gamecalls;
|
|
|
|
UNIQUAKE_API void UniQuake_SetGameCallbacks(void *context, const unity_gamecalls_t *callbacks)
|
|
{
|
|
unity_context = context;
|
|
unity_gamecalls = callbacks;
|
|
}
|
|
|
|
void UQ_Game_SetEntityModel(int entityNum, const char *modelName)
|
|
{
|
|
unity_gamecalls->SetEntityModel(unity_context, entityNum, modelName);
|
|
}
|
|
|
|
void UQ_Game_SetEntityTransform(int entityNum, vec3_t origin, vec3_t angles)
|
|
{
|
|
unity_gamecalls->SetEntityTransform(unity_context, entityNum, origin, angles);
|
|
}
|
|
|
|
void UQ_Game_RemoveEntity(int entityNum)
|
|
{
|
|
unity_gamecalls->RemoveEntity(unity_context, entityNum);
|
|
}
|
|
|
|
void UQ_Game_UpdateEntityAnimation(int entityNum, int pose1, int pose2, float blend)
|
|
{
|
|
unity_gamecalls->UpdateEntityAnimation(unity_context, entityNum, pose1, pose2, blend);
|
|
}
|
|
|
|
void UQ_Game_SetEntitySkin(int entityNum, int skinNum)
|
|
{
|
|
unity_gamecalls->SetEntitySkin(unity_context, entityNum, skinNum);
|
|
}
|
|
|
|
void UQ_Game_RunParticleEffect(vec3_t origin, vec3_t direction, int color, int count)
|
|
{
|
|
unsigned int colorMin, colorMax;
|
|
colorMin = d_8to24table[color & ~7];
|
|
colorMax = d_8to24table[color | 7];
|
|
unity_gamecalls->RunParticleEffect(unity_context, origin, direction, colorMin, colorMax, count);
|
|
}
|
|
|
|
typedef enum
|
|
{
|
|
PARTFX_EXPLOSION = 0,
|
|
PARTFX_EXPLOSION2,
|
|
PARTFX_BLOB_EXPLOSION,
|
|
PARTFX_LAVA_SPLASH,
|
|
PARTFX_TELEPORT_SPLASH,
|
|
} particle_effect_t;
|
|
|
|
void UQ_Game_ParticleExplosion(vec3_t origin)
|
|
{
|
|
unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_EXPLOSION, origin, 0, 0);
|
|
}
|
|
|
|
void UQ_Game_TeleportSplash(vec3_t origin)
|
|
{
|
|
unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_TELEPORT_SPLASH, origin, 0, 0);
|
|
}
|
|
|
|
void UQ_Game_LavaSplash(vec3_t origin)
|
|
{
|
|
unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_LAVA_SPLASH, origin, 0, 0);
|
|
}
|