rpg-x2/game/g_cinematic.c
UberGames eb2bd43add - fixed game Makefile
- added basic cinematic camera mode (needs much more work until it is finished)
2011-06-09 00:16:25 +02:00

62 lines
1.5 KiB
C

#include "g_local.h"
#include "g_cinematic.h"
extern void InitMover( gentity_t *ent );
/*QUAKED cinematic_camera (0 0.5 0) (-4 -4 -4) (4 4 4)
Camera for cinematic. Normally spawn by Lua script.
*/
void SP_cinematic_camera(gentity_t *ent) {
trap_LinkEntity(ent);
InitMover(ent);
}
void Cinematic_ActivateCameraMode(gentity_t *ent, gentity_t *target) {
gclient_t *client;
if(!ent || !ent->client || (ent->flags & FL_CCAM)) return;
client = ent->client;
ent->flags ^= FL_CCAM;
client->ps.pm_type = PM_CCAM;
client->cam = target;
VectorCopy(client->ps.viewangles, client->origViewAngles);
VectorCopy(ent->r.currentOrigin, client->origOrigin);
SetClientViewAngle(ent, target->s.angles);
G_SetOrigin(ent, target->r.currentOrigin);
trap_LinkEntity(ent);
}
void Cinematic_DeactivateCameraMode(gentity_t *ent) {
gclient_t *client;
if(!ent || !ent->client || !(ent->flags & FL_CCAM)) return;
client = ent->client;
ent->flags ^= FL_CCAM;
G_SetOrigin(ent, client->origOrigin);
SetClientViewAngle(ent, client->origViewAngles);
trap_LinkEntity(ent);
}
void Cinematic_ActivateGlobalCameraMode(gentity_t *target) {
int i;
gentity_t *ent;
for(i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i;
if(!ent || !ent->client) continue;
Cinematic_ActivateCameraMode(ent, target);
}
}
void Cinematic_DeactivateGlobalCameraMode(void) {
int i;
gentity_t *ent;
for(i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i;
if(!ent || !ent->client) continue;
Cinematic_DeactivateCameraMode(ent);
}
}