📄 ccameracontrol.h
字号:
#if !defined(AFX_CAMERACONTROL_H__INCLUDED_)
#define AFX_CAMERACONTROL_H__INCLUDED_
/*
* ============================================================================
* Name : CCameraControl.h:
* Part of : Game
* Created : 2004-10-26 by Yi Wen Hu
* Implementation notes:
*
* Version :
* Copyright: Gameloft S.A.
*
* ============================================================================
*/
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//#include "..\zlib\zconf.h"
#include "def.h"
#include "..\3d\render3d.h"
//#define DEBUG_CAMERA true;
// define camera combinations,
// CCI, Camera Control Id
const int CCS_CAMERAVIEW=0;
//Qiu Li, replaced by enum, 2004/12/22
enum CCI_TYPE
{
CCI_CHASING=0,
CCI_LOWBACKSIDE,
CCI_BACKSIDE_LEANING,
CCI_SIDEVIEW1,
CCI_SIDEVIEW2,
CCI_BACKSIDE2,
CCI_SIDEVIEW3,
CCI_BACKSIDE3,
CCI_COUNT
};
/*
// set stage
const int CCSS_PREPARE=1;
const int CCSS_THROW=2;
const int CCSS_ROLLING=3;
const int CCSS_FINISH=4;
const int CCSS_CHEER=5;
const int CCSS_FOUL=6;
//Qiu Li, add two camera views for throw when foul, 2004/12/21
const int CCSS_FOUL_L=6;
const int CCSS_FOUL_R=7;
//Qiu Li end
const int CCSS_AIM=8;
const int CCSS_WIN=9;
const int CCSS_LOSE=10;
const int CCSS_INTRODUCTION=11;
//Qiu Li, add camera shake when strike, 2004/12/22
const int CCSS_STRIKE=12;
//Qiu Li end
const int CC_STAGE_COUNT=12;
*/
enum CCSS_TYPE
{
CCSS_PREPARE=1,
CCSS_THROW,
CCSS_ROLLING,
CCSS_FINISH,
CCSS_CHEER,
//Qiu Li, add two camera views for throw when foul, 2004/12/21
CCSS_FOUL_L,
CCSS_FOUL_R,
//Qiu Li end
CCSS_AIM,
CCSS_WIN,
CCSS_LOSE,
CCSS_INTRODUCTION,
//Qiu Li, add camera shake when strike, 2004/12/22
CCSS_STRIKE,
//Qiu Li end
CCSS_CAMERE_FORWARD,
CCSS_THROW2,
CCSS_ROCK_LOSE,
//Story Mode
CCSS_CLUB1_LEFTSIDE,
CCSS_CLUB1_RIGHTSIDEBACK,
CCSS_CLUB1_LEFTSIDEFRONT,
CCSS_CLUB1_BACKSIDE,
CCSS_CLUB1_FRONTSIDE,
CCSS_CLUB2_RIGHTSIDE,
CCSS_CLUB2_LEFTSIDEBACK,
CCSS_CLUB2_RIGHTSIDEFRONT,
CCSS_CLUB2_BACKSIDE,
CCSS_CLUB2_FRONTSIDE,
CCSS_CLUB3_RIGHTSIDE,
CCSS_CLUB3_LEFTSIDEBACK,
CCSS_CLUB3_LEFTSIDEFRONT,
CCSS_CLUB3_BACKSIDE,
CCSS_CLUB3_FRONTSIDE,
CCSS_CAMERA_VS,
CCSS_COLLIDE_CENTER,
CCSS_COLLIDE_RIGHT,
CCSS_COLLIDE_BACK,
CCSS_FOUL2,
CCSS_TV,
CCSS_TITLE,
CC_STAGE_COUNT
};
#define CCSS_FOUL CCSS_FOUL_L
// cameras for throw state
//Qiu Li, seperate to 2 group
#define CC_TRW_STEP1_COUNT 6
#define CC_TRW_STEP2_COUNT 10
#define CC_TRW_STEP3_COUNT 4
#define TRW_STEP2_COMMON 4
#define TRW_STEP2_LOW 4
#define TRW_STEP2_HIGH 2
#define CAMERAVIEW_FWD_BWD 2
#define CAMERAVIEW_ROT 4
#define CAMERAVIEW_SIDE 2
//Qiu Li, 2004/12/22
/*
const int CCSS_TRW_FWD = 33;
const int CCSS_TRW_FWD_L = 34;
const int CCSS_TRW_FWD_R = 35;
const int CCSS_TRW_BWD = 36;
const int CCSS_TRW_BWD_L = 37;
const int CCSS_TRW_BWD_R = 38;
const int CCSS_TRW_AIM_L = 39;
const int CCSS_TRW_AIM_R = 40;
const int CCSS_TRW_FLW_L = 41;
const int CCSS_TRW_FLW_R = 42;
*/
/*
enum CCSS_TRW_TYPE
{
CCSS_TRW_FWD = 33,
CCSS_TRW_FWD_L,
CCSS_TRW_FWD_R,
CCSS_TRW_BWD,
CCSS_TRW_BWD_L,
CCSS_TRW_BWD_R,
CCSS_TRW_AIM_L,
CCSS_TRW_AIM_R,
CCSS_TRW_FLW_L,
CCSS_TRW_FLW_R
};
*/
//Qiu Li
/*
const int CCSS_SETPLAYPOS=0;
const int CCSS_SETPOWER=0;
const int CCSS_SETDIRECTION=0;
const int CCSS_THROW=0;
const int CCSS_BALLROLL=1;
const int CCSS_COLLION=2;
*/
// reference objects
// CCRO, Camera Control Reference Object
//Qiu Li
/*
const int CCRO_BALL=0; // ball
const int CCRO_PLAYER=1; // player
const int CCRO_SCENE=2; // scene
const int CCRO_CAMERA=3; // Camera
*/
enum CCRO_TYPE
{
CCRO_BALL=0, // ball
CCRO_PLAYER, // player
CCRO_SCENE, // scene
CCRO_CAMERA // Camera
};
// stage control type
/*
const int CCSCT_TIME=0;
const int CCSCT_DISTANCE=1;
const int CCSCT_STATIC=2;
const int CCSCT_CONSTANT=3; // camera stop at current position
const int CCSCT_MENTAL=4;
*/
enum CCSCT_TYPE
{
CCSCT_TIME=0,
CCSCT_DISTANCE,
CCSCT_STATIC,
CCSCT_CONSTANT, // camera stop at current position
CCSCT_MENTAL
};
// position define style
/*
const int CCPDS_XYZ=0; // 3d coordinates
const int CCPDS_AAD=1; // pale coordinates; angle, angle, distance
*/
enum CCPDS_TYPE
{
CCPDS_XYZ=0, // 3d coordinates
CCPDS_AAD // pale coordinates; angle, angle, distance
};
//Qiu Li end
const int CC_LANE_LENGH=2000;
// camera moving range
//Qiu Li, 2004/12/21
const int CMR_LEFT= -250;//-75;
const int CMR_RIGHT=250;//75;
const int CMR_FAR= 1600;//1350;
const int CMR_NEAR= -800;//-350;
const int CMR_TOP= 400;//300;
//Qiu Li end
const int CMR_BOTTOM=100;
const int CMR_LOOKUP=350;
const int CMR_LOOKDOWN=-350;
// script file
#define CAMERA_MOVE_UP 1
#define CAMERA_MOVE_DOWN 2
#define CAMERA_MOVE_LEFT 3
#define CAMERA_MOVE_RIGHT 4
#define CAMERA_MOVE_FORWARD 5
#define CAMERA_MOVE_BACKWARD 6
#define CAMERA_ROTATE_UP 7
#define CAMERA_ROTATE_DOWN 8
#define CAMERA_ROTATE_LEFT 9
#define CAMERA_ROTATE_RIGHT 10
class CScene;
class CEngine;
typedef struct _CameraStage
{
int iControlType; // 0, time control; 1, distance control;
int iTotalTime; // useless when bControlType=1;
int iPosRefer;
int iPosContStyle; //0, 3d coordinates; 1, pale coordinates;
int iLookatRefer;
int iLookatContStyle; //0, 3d coordinates; 1, pale coordinates;
int iStartPos[3]; // x,y,z or angle,angle,distance
int iStartLookat[3];
int iStartUp[2]; // angle,angle
int iStartRate;
int iEndPos[3];
int iEndLookat[3];
int iEndUp[2];
int iEndRate;
}CCameraStage;
class CCameraControl
{
public:
bool IsInRange();
bool IsInViewAngle();
//Qiu Li, 2004/12/29
void AdjustPosWhenRotLR();
//Qiu Li
/*
void RotationZ(int angle);
void RotationY(int angle);
void RotationX(int angle);
*/
/*
void RotateUp(int angle);
void RotateDown(int angle);
void RotateLeft(int angle);
void RotateRight(int angle);
*/
void MoveCamera(int distance, int mode);
/*
void MoveBackward(int distance);
void MoveForward(int distance);
void MoveRight(int distance);
void MoveLeft(int distance);
void MoveDown(int distance);
void MoveUp(int distance);
*/
void SetStage(int stageId,int replaytimer=0);
int GetStage(void){return m_iCurStageIndex;}
void SetReplay(bool flag);
//Qiu Li, push camera focus on a tenpin, 2004/12/22
void SetCameraFocus(Vector4s focus);
//Qiu Li end
//Qiu Li, move to coin and back, 2005/1/11
void MovetoCoin(Vector4s coin);
void MoveBackFromCoin(void);
//Qiu Li
bool IsFinished(){return m_bFinished;};
CCameraControl(CScene* pScene);
~CCameraControl();
bool Load(CEngine *pEngine);
bool SetCamera(int id);
void UpdateCamera(int replaytimer=0);
//Qiu Li, 2004/12/29
bool IsCameraConstant();
//Qiu Li end
bool NeedRemoveActor();
void PreviousStageInReplay();
bool IsNeedRollback(int *y);
void CheckCameraStage(void);
/*
int t_prepare;
int t_rolling;
int t_finish;
*/
private:
void Test();
void CompMatrix();
void SetViewMatrix();
void UpdateView();
bool CallCamera(int id);
void NextStage();
int Interpolate(int StartValue, int EndValue, int StartRate, int EndRate, int InterRate);
void AADtoXYZ(int* aad, int* xyz);
void XYZtoAAD(int* xyz, int* aad);
void GetAbsCoords(int refer, int*coords);
void SetLookat();
CScene* m_pScene;
// CGraphics3D* m_pG3D;
CCameraStage** m_pCameraCombinations;
CCameraStage* m_pCurStage;
Vector4s m_eye;
Vector4s m_lookat;
Vector4s m_up;
bool m_bReplay;
int m_iCmbsCount;
int* m_pStagesCount;
int m_iCombIndex;
int m_iStageIndex;
int m_iTimer;
int m_iHorAngle; //horizontal angle: ---
int m_iVerAngle; //vertical angle: |||
int m_iCurCombIndex;
int m_iCurStageIndex;
CMatrix44 m_viewMat;
// camera view
CMatrix44 m_origin;
CMatrix44 m_HorMat;
CMatrix44 m_VerMat;
//Qiu Li
//Throw step
int iThrowStep;
int iFoulStep;
int iCameraViewStep;
bool bReplay_NotRenderActor;
bool bNeedRollbackInReplay;
int iRollbackY;
Vector4s vCoinPos;
public:
int GetCameraCombIndex(){return m_iCombIndex;};
bool m_bFinished;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -