@@ -13,6 +13,7 @@ Last Updated : 1010, 2004, C.Wang
13
13
#include " LyubuStateMachine.h"
14
14
#include " AIControl.h"
15
15
#include " BattleRoom.h"
16
+ #include " FyFx.h"
16
17
17
18
int oldX, oldY, oldXM, oldYM, oldXMM, oldYMM;
18
19
@@ -28,6 +29,8 @@ AIControl *npc;
28
29
BattleRoom *bRoom;
29
30
LyubuStateMachine * lyubuState;
30
31
32
+ eF3DFX *fx00 = NULL ;
33
+
31
34
char debug[1024 ] = " \0 " ;
32
35
char loopBuff[1024 ] = " \0 " ;
33
36
void debug_message (char *, char *);
@@ -37,6 +40,7 @@ void CleanDebugBuff(WORLDid, BYTE, BOOL);
37
40
BOOL initLyubu ();
38
41
BOOL initNPC ();
39
42
BOOL initBattleRoom (GameControl *player, AIControl *npc);
43
+ BOOL initFX ();
40
44
void CharacterInit ();
41
45
42
46
void Reset (WORLDid gID , BYTE code, BOOL value);
@@ -135,6 +139,7 @@ void CharacterInit(){
135
139
initLyubu ();
136
140
initNPC ();
137
141
initBattleRoom (kc, npc);
142
+ initFX ();
138
143
}
139
144
140
145
BOOL initLyubu (){ // init Lyubu and Camera
@@ -271,6 +276,36 @@ BOOL initBattleRoom(GameControl *player, AIControl *npc){
271
276
return TRUE ;
272
277
}
273
278
279
+ BOOL initFX (){
280
+ FnWorld gw;
281
+ gw.Object (gID );
282
+ gw.SetTexturePath (" Data\\ FXs\\ Textures" );
283
+ gw.SetObjectPath (" Data\\ FXs\\ Models" );
284
+
285
+ fx00 = new eF3DFX (sID );
286
+ fx00->SetWorkPath (" Data\\ FXs" );
287
+ BOOL beOK = fx00->Load (" NoPigeon" );
288
+
289
+ if (beOK == FALSE ){
290
+ sprintf (debug, " %s fx load failed\n " , debug);
291
+ return FALSE ;
292
+ }else {
293
+ sprintf (debug, " %s fx load successful\n " , debug);
294
+ }
295
+ float pos[3 ];
296
+ pos[0 ] = 3569.0 ;
297
+ pos[1 ] = -3210.0 ;
298
+ pos[2 ] = 0.0 ;
299
+
300
+ eF3DBaseFX *fx;
301
+ int i, numFX = fx00->NumberFXs ();
302
+ for (i = 0 ; i < numFX; i++) {
303
+ fx = fx00->GetFX (i);
304
+ fx->InitPosition (pos);
305
+ }
306
+ return TRUE ;
307
+ }
308
+
274
309
void Reset (WORLDid gID , BYTE code, BOOL value){
275
310
if (code == FY_F1) {
276
311
if (value) {
@@ -284,6 +319,10 @@ void Reset(WORLDid gID, BYTE code, BOOL value){
284
319
delete kc;
285
320
delete npc;
286
321
delete bRoom;
322
+ if (fx00 != NULL ){
323
+ delete fx00;
324
+ }
325
+ fx00 = NULL ;
287
326
CharacterInit ();
288
327
// initLyubu();
289
328
// initNPC();
@@ -302,6 +341,16 @@ void KeyboardAttackCommand(WORLDid gID, BYTE code, BOOL value){
302
341
void PlayAction (int skip){
303
342
kc->PlayAction (skip);
304
343
npc->PlayAction (skip);
344
+ if (fx00 != NULL ) {
345
+ BOOL beOK = fx00->Play ((float ) skip);
346
+ if (!beOK) {
347
+ fx00->Reset (); // make it from the starting position and play it again
348
+
349
+ // if you just play the FX once, here you need to delete the FX
350
+ // delete fx00;
351
+ // fx00 = NULL;
352
+ }
353
+ }
305
354
/*
306
355
if (lyubuState->isNowAttackState()) {
307
356
kc->CamFallow();
0 commit comments