00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "tMemManager.h"
00029 #include "gCycle.h"
00030 #include "gCamera.h"
00031 #include "gGame.h"
00032 #include "ePlayer.h"
00033 #include "rFont.h"
00034 #include "eSoundMixer.h"
00035
00036 void gCamera::MyInit(){
00037 if (mode == CAMERA_SMART)
00038 if (sg_currentSettings->finishType==gFINISH_EXPRESS && sn_GetNetState() != nCLIENT )
00039 pos=CenterPos()+dir.Turn(eCoord(-2,-10)) ;
00040
00041 lastCenter=Center();
00042 }
00043
00044 gCamera::gCamera(eGrid *grid, rViewport *view,ePlayerNetID *p,ePlayer *lp,eCamMode m)
00045 :eCamera(grid, view,p,lp,m), lastCenter(NULL){
00046 MyInit();
00047 }
00048
00049
00050 gCamera::~gCamera(){
00051 int x;
00052 x =0;
00053 }
00054
00055 eCoord gCamera::CenterCycleDir(){
00056 gCycle *c = dynamic_cast<gCycle *>( Center());
00057 if (c)
00058 return c->CamDir();
00059 else
00060 return CenterDir();
00061 }
00062
00063 REAL gCamera::SpeedMultiplier() const
00064 {
00065 return gCycle::SpeedMultiplier();
00066 }
00067
00068 void gCamera::Timestep(REAL ts){
00069 eCamera::Timestep(ts);
00070 if (Center()!=lastCenter){
00071 if (!netPlayer || !netPlayer->Object() ||
00072 netPlayer->Object()!=center){
00073 if (dynamic_cast<gCycle *>(Center())){
00074 eNetGameObject *x=dynamic_cast<eNetGameObject *>(Center());
00075 if (x){
00076 const ePlayerNetID *p=x->Player();
00077 if (p==NULL)
00078 con << tOutput("$camera_watching_ai");
00079 else{
00080 tOutput o;
00081 o.SetTemplateParameter(1, p->GetName());
00082 o << "$camera_watching_player";
00083 con << o;
00084 }
00085 }
00086 }
00087 lastCenter=Center();
00088
00089 eSoundMixer* mixer = eSoundMixer::GetMixer();
00090 mixer->SetMicrophoneOwner(Center());
00091 }
00092 }
00093 }
00094
00095
00096
00097
00098
00099