From: Laszlo T. <ave...@us...> - 2005-07-23 17:10:48
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3311 Modified Files: Actions.cpp GameScript.cpp GameScript.h Log Message: Added randomturn action (face random direction) Index: GameScript.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameScript.cpp,v retrieving revision 1.316 retrieving revision 1.317 diff -C2 -d -r1.316 -r1.317 *** GameScript.cpp 22 Jul 2005 15:43:19 -0000 1.316 --- GameScript.cpp 23 Jul 2005 17:09:51 -0000 1.317 *************** *** 539,542 **** --- 539,543 ---- {"quitgame", GameScript::QuitGame, 0}, {"randomfly", GameScript::RandomFly, AF_BLOCKING}, + {"randomturn", GameScript::RandomTurn, AF_BLOCKING}, {"randomwalk", GameScript::RandomWalk, AF_BLOCKING}, {"randomwalkcontinuous", GameScript::RandomWalkContinuous, AF_BLOCKING}, Index: GameScript.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameScript.h,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -d -r1.212 -r1.213 *** GameScript.h 20 Jul 2005 21:46:30 -0000 1.212 --- GameScript.h 23 Jul 2005 17:09:51 -0000 1.213 *************** *** 1152,1155 **** --- 1152,1156 ---- static void QuitGame(Scriptable* Sender, Action* parameters); static void RandomFly(Scriptable* Sender, Action* parameters); + static void RandomTurn(Scriptable* Sender, Action* parameters); static void RandomWalk(Scriptable* Sender, Action* parameters); static void RandomWalkContinuous(Scriptable* Sender, Action* parameters); Index: Actions.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actions.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Actions.cpp 20 Jul 2005 21:46:28 -0000 1.24 --- Actions.cpp 23 Jul 2005 17:09:51 -0000 1.25 *************** *** 1072,1076 **** } Actor *actor = (Actor *) tar; ! actor->SetOrientation(parameters->int0Parameter,0 ); } --- 1072,1076 ---- } Actor *actor = (Actor *) tar; ! actor->SetOrientation(parameters->int0Parameter, false); } *************** *** 1084,1092 **** Actor* actor = ( Actor* ) Sender; if (parameters->int0Parameter==-1) { ! actor->SetOrientation(core->Roll(1,MAX_ORIENT,-1),0 ); } else { ! actor->SetOrientation(parameters->int0Parameter,0); } - actor->resetAction = true; actor->SetWait( 1 ); } --- 1084,1091 ---- Actor* actor = ( Actor* ) Sender; if (parameters->int0Parameter==-1) { ! actor->SetOrientation(core->Roll(1,MAX_ORIENT,-1), false); } else { ! actor->SetOrientation(parameters->int0Parameter, false); } actor->SetWait( 1 ); } *************** *** 1104,1109 **** } Actor* actor = ( Actor* ) Sender; ! actor->SetOrientation( GetOrient( target->Pos, actor->Pos ),0 ); ! actor->resetAction = true; actor->SetWait( 1 ); } --- 1103,1107 ---- } Actor* actor = ( Actor* ) Sender; ! actor->SetOrientation( GetOrient( target->Pos, actor->Pos ), false); actor->SetWait( 1 ); } *************** *** 1123,1128 **** value = (ieDword) CheckVariable( target, parameters->string0Parameter ); Point p( *(unsigned short *) &value, *(((unsigned short *) &value)+1)); ! actor->SetOrientation ( GetOrient( p, actor->Pos ),0 ); ! actor->resetAction = true; actor->SetWait( 1 ); } --- 1121,1125 ---- value = (ieDword) CheckVariable( target, parameters->string0Parameter ); Point p( *(unsigned short *) &value, *(((unsigned short *) &value)+1)); ! actor->SetOrientation ( GetOrient( p, actor->Pos ), false); actor->SetWait( 1 ); } *************** *** 3762,3768 **** int x = rand()&31; if (x<10) { ! actor->SetOrientation(actor->GetOrientation()-1, 0); } else if (x>20) { ! actor->SetOrientation(actor->GetOrientation()+1, 0); } //fly in this direction for 2 steps --- 3759,3765 ---- int x = rand()&31; if (x<10) { ! actor->SetOrientation(actor->GetOrientation()-1, false); } else if (x>20) { ! actor->SetOrientation(actor->GetOrientation()+1, false); } //fly in this direction for 2 steps *************** *** 3910,3915 **** } Actor *actor = (Actor *) Sender; ! actor->SetOrientation(actor->GetOrientation()+parameters->int0Parameter,0); ! actor->resetAction = true; actor->SetWait( 1 ); } --- 3907,3922 ---- } Actor *actor = (Actor *) Sender; ! actor->SetOrientation(actor->GetOrientation()+parameters->int0Parameter, true); ! actor->SetWait( 1 ); ! } ! ! void GameScript::RandomTurn(Scriptable* Sender, Action* /*parameters*/) ! { ! if (Sender->Type!=ST_ACTOR) { ! Sender->CurrentAction = NULL; ! return; ! } ! Actor *actor = (Actor *) Sender; ! actor->SetOrientation(rand() % MAX_ORIENT, true); actor->SetWait( 1 ); } |