Skip to content

Commit 1277025

Browse files
unknownunknown
authored andcommitted
fx test
1 parent a6a100a commit 1277025

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

ActorStateMachine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ int ActorStateMachine::ChangeState(ActorState s, BOOL forceSet){
9696
FnActor actor;
9797
actor.Object(this->character);
9898
actor.MoveForward(-MOVE_LENGTH,TRUE, FALSE, 0.0, TRUE);
99-
this->SetNewAction("LightDamage");
99+
//this->SetNewAction("LightDamage");
100+
this->SetNewAction("HeavyDamage");
100101
this->life --;
101102
sprintf(debug, "%s life=%d\n", debug, this->life);
102103
if (this->life <= 0) {

Main.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Last Updated : 1010, 2004, C.Wang
1313
#include "LyubuStateMachine.h"
1414
#include "AIControl.h"
1515
#include "BattleRoom.h"
16+
#include "FyFx.h"
1617

1718
int oldX, oldY, oldXM, oldYM, oldXMM, oldYMM;
1819

@@ -28,6 +29,8 @@ AIControl *npc;
2829
BattleRoom *bRoom;
2930
LyubuStateMachine * lyubuState;
3031

32+
eF3DFX *fx00 = NULL;
33+
3134
char debug[1024] = "\0";
3235
char loopBuff[1024] = "\0";
3336
void debug_message(char*, char*);
@@ -37,6 +40,7 @@ void CleanDebugBuff(WORLDid, BYTE, BOOL);
3740
BOOL initLyubu();
3841
BOOL initNPC();
3942
BOOL initBattleRoom(GameControl *player, AIControl *npc);
43+
BOOL initFX();
4044
void CharacterInit();
4145

4246
void Reset(WORLDid gID, BYTE code, BOOL value);
@@ -135,6 +139,7 @@ void CharacterInit(){
135139
initLyubu();
136140
initNPC();
137141
initBattleRoom(kc, npc);
142+
initFX();
138143
}
139144

140145
BOOL initLyubu(){ // init Lyubu and Camera
@@ -271,6 +276,36 @@ BOOL initBattleRoom(GameControl *player, AIControl *npc){
271276
return TRUE;
272277
}
273278

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+
274309
void Reset(WORLDid gID, BYTE code, BOOL value){
275310
if (code == FY_F1) {
276311
if (value) {
@@ -284,6 +319,10 @@ void Reset(WORLDid gID, BYTE code, BOOL value){
284319
delete kc;
285320
delete npc;
286321
delete bRoom;
322+
if (fx00 != NULL){
323+
delete fx00;
324+
}
325+
fx00 = NULL;
287326
CharacterInit();
288327
//initLyubu();
289328
//initNPC();
@@ -302,6 +341,16 @@ void KeyboardAttackCommand(WORLDid gID, BYTE code, BOOL value){
302341
void PlayAction(int skip){
303342
kc->PlayAction(skip);
304343
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+
}
305354
/*
306355
if (lyubuState->isNowAttackState()) {
307356
kc->CamFallow();

0 commit comments

Comments
 (0)