00001 00025 #include <stdio.h> 00026 #include <stdlib.h> 00027 #include <string.h> 00028 00029 #include "debug.grid.h" 00030 #include "grid.h" 00031 #include "lbaengine.h" 00032 #include "scene.h" 00033 #include "main.h" 00034 00035 int useFreeCamera=0; 00036 int canChangeScenes=0; 00037 00039 void change_grid_camera(short int pKey) 00040 { 00041 if(useFreeCamera) 00042 { 00043 // Press up - more X positions 00044 if (pKey == 'c') 00045 { 00046 newCameraZ--; 00047 reqBgRedraw = 1; 00048 } 00049 00050 // Press down - less X positions 00051 if (pKey == 'z') 00052 { 00053 newCameraZ++; 00054 reqBgRedraw = 1; 00055 } 00056 00057 // Press left - less Z positions 00058 if (pKey == 's') 00059 { 00060 newCameraX--; 00061 reqBgRedraw = 1; 00062 } 00063 00064 // Press right - more Z positions 00065 if (pKey == 'x') 00066 { 00067 newCameraX++; 00068 reqBgRedraw = 1; 00069 } 00070 } 00071 } 00072 00074 void change_grid(short int pKey) 00075 { 00076 if(canChangeScenes) 00077 { 00078 // Press up - more X positions 00079 if (pKey == 'r') 00080 { 00081 currentSceneIdx++; 00082 if(currentSceneIdx>NUM_SCENES) 00083 currentSceneIdx=0; 00084 needChangeScene = currentSceneIdx; 00085 reqBgRedraw = 1; 00086 } 00087 00088 // Press down - less X positions 00089 if (pKey == 'f') 00090 { 00091 currentSceneIdx--; 00092 if(currentSceneIdx<0) 00093 currentSceneIdx=NUM_SCENES; 00094 needChangeScene = currentSceneIdx; 00095 reqBgRedraw = 1; 00096 } 00097 00098 if(cfgfile.Debug && (pKey=='f' || pKey=='r')) 00099 printf("\nGrid index changed: %d\n", needChangeScene); 00100 } 00101 } 00102 00104 void apply_celling_grid(short int pKey) 00105 { 00106 // Increase celling grid index 00107 if(pKey == 'g') 00108 { 00109 cellingGridIdx++; 00110 if(cellingGridIdx>133) 00111 cellingGridIdx=133; 00112 } 00113 // Decrease celling grid index 00114 if(pKey == 'b') 00115 { 00116 cellingGridIdx--; 00117 if(cellingGridIdx<0) 00118 cellingGridIdx=0; 00119 } 00120 00121 // Enable/disable celling grid 00122 if (pKey == 't' && useCellingGrid==-1) 00123 { 00124 useCellingGrid=1; 00125 //create_grid_map(); 00126 init_celling_grid(cellingGridIdx); 00127 if(cfgfile.Debug && pKey=='t') 00128 printf("\nEnable Celling Grid index: %d\n", cellingGridIdx); 00129 needChangeScene=-2; // tricky to make the fade 00130 } 00131 else if (pKey == 't' && useCellingGrid==1) 00132 { 00133 useCellingGrid=-1; 00134 create_grid_map(); 00135 reqBgRedraw=1; 00136 if(cfgfile.Debug && pKey=='t') 00137 printf("\nDisable Celling Grid index: %d\n", cellingGridIdx); 00138 needChangeScene=-2; // tricky to make the fade 00139 } 00140 } 00141
1.5.5