00001 #ifndef PA_MODE7
00002 #define PA_MODE7
00003
00004
00005 #include "PA_BgRot.h"
00006
00007
00008
00009
00010
00011 void hbl_mode7(void);
00012
00013 extern const s32 DIV[160];
00014
00015
00016 #define M7_D_SH 7 // focal shift
00017 #define M7O_NORM 1 // object renormalization shift (by /2)
00018
00019
00020 #define M7_NEAR 16
00021 #define M7_FAR 384
00022 #define M7_LEFT -120
00023 #define M7_RIGHT 120
00024 #define M7_TOP 80
00025 #define M7_BOTTOM -80
00026
00027
00028 #define M7_FAR_BG 512
00029
00030
00031 typedef struct{
00032 s32 x, y, z;
00033 }VECTOR;
00034
00035 typedef struct tagM7CAM
00036 {
00037 VECTOR pos;
00038 int phi;
00039 int theta;
00040 VECTOR u;
00041 VECTOR v;
00042 VECTOR w;
00043 } M7CAM;
00044
00045
00046 typedef struct {
00047 s16 pa, pb, pc, pd; s32 dx, dy;
00048 } BGAFF_EX;
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 extern M7CAM _m7_cam;
00062 extern int _m7_horizon;
00063 extern BGAFF_EX _m7_bgaff_ex[192];
00064
00065
00066
00067
00068
00069 #define X0 256<<8
00070 #define Y0 32<<8 // Default camera height -> 8192
00071 #define Z0 256<<8
00072
00073
00074 extern u8 PA_currentmode;
00075
00076
00077
00078
00079
00080
00081 extern s32 mode7cam_x, mode7cam_y, mode7cam_z, mode7alpha;
00082
00083 extern s32 mode7cos, mode7sin;
00084
00085 extern s16 mode7_distance;
00086
00087
00088
00103 void PA_InitMode7(u8 bg_select);
00104
00110 extern inline void PA_DeInitMode7(void) {
00111
00112 irqDisable(IRQ_HBLANK);
00113 }
00114
00115
00125 extern inline void PA_Mode7Angle(s16 angle){
00126 mode7alpha = angle&511;
00127 mode7cos = PA_Cos(mode7alpha);
00128 mode7sin = PA_Sin(mode7alpha);
00129 }
00130
00131
00132
00142 extern inline void PA_Mode7MoveLeftRight(s16 x_deplac){
00143 mode7cam_x += x_deplac*mode7cos;
00144 mode7cam_z += x_deplac*mode7sin;
00145 }
00146
00147
00157 extern inline void PA_Mode7MoveForwardBack(s16 z_deplac){
00158 mode7cam_x += z_deplac*mode7sin;
00159 mode7cam_z -= z_deplac*mode7cos;
00160 }
00161
00162
00163
00173 extern inline void PA_Mode7X(s16 mode7x){
00174 mode7cam_x = mode7x;
00175 }
00176
00177
00187 extern inline void PA_Mode7Z(s16 mode7z){
00188 mode7cam_z = mode7z;
00189 }
00190
00191
00192
00204 extern inline void PA_Mode7SetPointXZ(s16 mode7x, s16 mode7z){
00205 mode7cam_x = mode7x;
00206 mode7cam_z = mode7z;
00207 }
00208
00209
00219 extern inline void PA_Mode7Height(s16 mode7y){
00220 mode7cam_y = mode7y;
00221 }
00222
00223
00224
00225
00226
00227
00228
00230
00231
00232
00233 void m7_aff_calc(void);
00234 void m7_hbl_flr(void);
00235 void m7_horz_calc(void);
00236
00237 #endif
00238
00239