Work on cinematic cameras ...

... had a mayor breakthrough there but it is still far from beeing
usable.
This commit is contained in:
Walter Julius Hennecke 2013-11-13 21:07:56 +01:00
parent 24af0bd6a6
commit 2a1acdb4fe
3 changed files with 25 additions and 9 deletions

View file

@ -1899,6 +1899,10 @@ static void SendPendingPredictableEvents( playerState_t *ps ) {
static void ClientCamThink(gentity_t* client) {
if(client == NULL || client->client == NULL || client->client->cam == NULL) {
if(client->flags & FL_CCAM) {
client->flags ^= FL_CCAM;
}
client->client->ps.pm_type = PM_NORMAL;
return;
}

View file

@ -47,10 +47,15 @@ void Cinematic_DeactivateCameraMode(gentity_t *ent) {
if(!ent || !ent->client || !(ent->flags & FL_CCAM)) return;
client = ent->client;
ent->flags ^= FL_CCAM;
client->cam = NULL;
G_Printf("resetting origin to %s\n", vtos(client->origOrigin));
G_SetOrigin(ent, client->origOrigin);
VectorCopy(client->origOrigin, ent->client->ps.origin);
G_Client_SetViewAngle(ent, client->origViewAngles);
trap_LinkEntity(ent);
}
void Cinematic_ActivateGlobalCameraMode(gentity_t *target) {

View file

@ -8,6 +8,7 @@
#include "g_client.h"
#include "g_logger.h"
#include "g_lua.h"
#include "g_cinematic.h"
//#include <windows.h>
@ -7423,28 +7424,34 @@ static void Cmd_findEntitiesInRadius(gentity_t *ent) {
}
// CCAM
extern void Cinematic_ActivateCameraMode(gentity_t *ent, gentity_t *target);
extern void Cinematic_DeactivateCameraMode(gentity_t *ent);
static void Cmd_Camtest_f(gentity_t *ent) {
gentity_t *targ;
char tname[256];
if(trap_Argc() < 1) return;
if(trap_Argc() < 1) {
return;
}
G_Printf("activate cam\n");
if(ent->flags & FL_CCAM) return;
if(ent->flags & FL_CCAM) {
return;
}
trap_Argv(1, tname, sizeof(tname));
targ = G_Find(NULL, FOFS(targetname), tname);
if(!targ) return;
if(targ == NULL) {
return;
}
G_Printf("activate cam\n");
G_Printf("original origin: %s\n", vtos(ent->r.currentOrigin));
G_Printf("cam origin: %s\n", vtos(targ->s.origin));
Cinematic_ActivateCameraMode(ent, targ);
}
void Cmd_CamtestEnd_f(gentity_t *ent) {
//Cinematic_DeactivateCameraMode(ent);
Cinematic_DeactivateCameraMode(ent);
}
// END CCAM