Supprimer 'SH3D/userview/userview.cpp'
This commit is contained in:
parent
70d299c7ce
commit
392c53b972
|
@ -1,153 +0,0 @@
|
|||
#include "userview.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "fxlib.h"
|
||||
}
|
||||
|
||||
#include "src/libs/sh4.h"
|
||||
// Mouvement
|
||||
#define KEY_m_ju K_CH_5 // saut
|
||||
#define KEY_m_up K_CH_8 // avant
|
||||
#define KEY_m_do K_CH_2 // arrière
|
||||
#define KEY_m_le K_CH_4 // gauche
|
||||
#define KEY_m_ri K_CH_6 // droite
|
||||
// Camera
|
||||
#define KEY_d_up K_CT_UP
|
||||
#define KEY_d_do K_CT_DOWN
|
||||
#define KEY_d_le K_CT_LEFT
|
||||
#define KEY_d_ri K_CT_RIGHT
|
||||
|
||||
int UserView::x=0;
|
||||
int UserView::y=0;
|
||||
int UserView::z=0;
|
||||
|
||||
int UserView::m_x=0;
|
||||
int UserView::m_y=0;
|
||||
int UserView::m_z=0;
|
||||
|
||||
int UserView::m_nVFrames=0;
|
||||
int UserView::m_nRFrames=0;
|
||||
|
||||
Angle UserView::dh;
|
||||
Angle UserView::dv;
|
||||
|
||||
Angle UserView::m_dh;
|
||||
Angle UserView::m_dv;
|
||||
|
||||
bool UserView::m_moveActive=false;
|
||||
|
||||
void UserView::set(int tx,int ty,int tz, unsigned char tdh,unsigned char tdv)
|
||||
{
|
||||
m_x=tx;
|
||||
m_y=ty;
|
||||
m_z=tz;
|
||||
|
||||
m_dh=tdh;
|
||||
m_dv=tdv;
|
||||
}
|
||||
|
||||
void UserView::reload()
|
||||
{
|
||||
x=m_x;
|
||||
y=m_y;
|
||||
z=m_z;
|
||||
|
||||
dh=m_dh;
|
||||
dv=m_dv;
|
||||
m_nRFrame++;
|
||||
}
|
||||
|
||||
void UserView::move()
|
||||
{
|
||||
if (m_moveActive)
|
||||
{
|
||||
|
||||
|
||||
|
||||
/* phases touche->action
|
||||
peut être envisager de le remplacer par des tableaux
|
||||
- moins d'optimisation
|
||||
- moins rapide à mettre en place(pour l'instant)
|
||||
- tres dur à mettre en place
|
||||
+ plus standardisé dans le code pur (une boucle for et c'est tout)
|
||||
+ ajout et retrait plus simple de fonctionnalités
|
||||
*/
|
||||
bool hasChanged=false;
|
||||
if (KeyDown(KEY_d_le)==1)
|
||||
{
|
||||
m_dh+=1;
|
||||
hasChanged=true;
|
||||
}
|
||||
if (KeyDown(KEY_d_ri)==1)
|
||||
{
|
||||
m_dh-=1;
|
||||
hasChanged=true;
|
||||
}
|
||||
if (KeyDown(KEY_d_do)==1)
|
||||
{
|
||||
m_dv+=1;
|
||||
if (m_dv>50)
|
||||
m_dv=50;
|
||||
hasChanged=true;
|
||||
}
|
||||
if (KeyDown(KEY_d_up)==1)
|
||||
{
|
||||
dv-=1;
|
||||
if (dv<-50)
|
||||
dv=-50;
|
||||
hasChanged=true;
|
||||
}
|
||||
if (KeyDown(KEY_m_up)==1)
|
||||
{
|
||||
x+=10*Angle::cos(dh+64)*Angle::cos(dv);
|
||||
y+=10*Angle::sin(dh+64)*Angle::cos(dv);
|
||||
hasChanged=true;
|
||||
}
|
||||
if (KeyDown(KEY_m_do)==1)
|
||||
{
|
||||
x+=10*Angle::cos(dh-64)*Angle::cos(dv);
|
||||
y+=10*Angle::sin(dh-64)*Angle::cos(dv);
|
||||
hasChanged=true;
|
||||
}
|
||||
if (KeyDown(KEY_m_le)==1)
|
||||
{
|
||||
x+=10*Angle::cos(dh-128)*Angle::cos(dv);
|
||||
y+=10*Angle::sin(dh-128)*Angle::cos(dv);
|
||||
hasChanged=true;
|
||||
}
|
||||
if (KeyDown(KEY_m_ri)==1)
|
||||
{
|
||||
x+=10*Angle::cos(dh)*Angle::cos(dv);
|
||||
y+=10*Angle::sin(dh)*Angle::cos(dv);
|
||||
hasChanged=true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// **TODO**
|
||||
// ajouter le moteur physique -> peut etre une fonction decentralisée loin, loin, loin d'ici
|
||||
|
||||
|
||||
if (hasChanged)
|
||||
m_nVFrames++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void UserView::setState(bool state)
|
||||
{
|
||||
if (m_moveActive==state)
|
||||
return;
|
||||
if (state==true)
|
||||
{
|
||||
m_moveActive=true;
|
||||
SetTimer(USVW_timer_identifier,USVW_timer_interval,UserView::move);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_moveActive=false;
|
||||
KillTimer(USVW_timer_identifier);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue