diff --git a/Utils/Scripter/function.cpp b/Utils/Scripter/function.cpp index 04c7e44b6..54bfcf08b 100644 --- a/Utils/Scripter/function.cpp +++ b/Utils/Scripter/function.cpp @@ -68,6 +68,7 @@ static FunctionDef s_functionNames[]= { "getAmmoCount", 1 }, // ammoId { "setAmmoCount", 2 }, // ammoId,amount { "isHoldingWeapon", 1 }, // weaponId + { "giveWeapon", 1 }, // weaponId }; static int s_functionCount=sizeof(s_functionNames)/sizeof(FunctionDef); diff --git a/data/Scripts/ch2l2_01.scr b/data/Scripts/ch2l2_01.scr index 524354b07..82b90b68a 100644 --- a/data/Scripts/ch2l2_01.scr +++ b/data/Scripts/ch2l2_01.scr @@ -6,12 +6,16 @@ #include data/scripts/defs/trans.scr -_setText(CHAR_PATRICK,STR__INGAME__CH2__L2__PATRICK1); -_setResponseOptions(QUESTION_OK); -do +if(_isHoldingWeapon(WEAPON_BALLOON)==FALSE) { - pause; + _setText(CHAR_PATRICK,STR__INGAME__CH2__L2__PATRICK1); + _setResponseOptions(QUESTION_OK); + do + { + pause; + } + while(_getResponse()==ANSWER_NONE); + _giveWeapon(WEAPON_BALLOON); } -while(_getResponse()==ANSWER_NONE); stop; diff --git a/data/Scripts/ch2l2_02.scr b/data/Scripts/ch2l2_02.scr index b4d598f08..21b33af9b 100644 --- a/data/Scripts/ch2l2_02.scr +++ b/data/Scripts/ch2l2_02.scr @@ -6,12 +6,16 @@ #include data/scripts/defs/trans.scr -_setText(CHAR_PATRICK,STR__INGAME__CH2__L2__PATRICK2); -_setResponseOptions(QUESTION_OK); -do +if(_isHoldingWeapon(WEAPON_BALLOON)==FALSE) { - pause; + _setText(CHAR_PATRICK,STR__INGAME__CH2__L2__PATRICK2); + _setResponseOptions(QUESTION_OK); + do + { + pause; + } + while(_getResponse()==ANSWER_NONE); + _giveWeapon(WEAPON_BALLOON); } -while(_getResponse()==ANSWER_NONE); stop; diff --git a/data/Scripts/defs/items.scr b/data/Scripts/defs/items.scr index 093f1e350..ab5309144 100644 --- a/data/Scripts/defs/items.scr +++ b/data/Scripts/defs/items.scr @@ -4,4 +4,4 @@ // For isHoldingWeapon() #define WEAPON_BUBBLEWAND 0 - +#define WEAPON_BALLOON 1 diff --git a/source/player/player.h b/source/player/player.h index 7480c44cd..632a743d4 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -426,6 +426,8 @@ public: int getJellyFishAmmo() {return m_jellyfishAmmoCount;} int isHoldingNet() {return m_currentMode==PLAYER_MODE_NET;} + int isHoldingBalloon() {return m_currentMode==PLAYER_MODE_BALLOON;} + void setIsInWater(int _in) {m_isInWater=_in;m_helmetSoundTimer=0;} int getIsInWater() {return m_isInWater;} int getIsHelmetFullSoICanStopSoakingUp() {return m_healthWaterLevel==WATERMAXHEALTH;} diff --git a/source/script/function.cpp b/source/script/function.cpp index 33cea0149..4ea56b14c 100644 --- a/source/script/function.cpp +++ b/source/script/function.cpp @@ -65,6 +65,7 @@ enum enum { WEAPON_BUBBLEWAND, + WEAPON_BALLOON, }; @@ -90,6 +91,7 @@ static signed short func_getResponse(unsigned short *_args); static signed short func_getAmmoCount(unsigned short *_args); static signed short func_setAmmoCount(unsigned short *_args); static signed short func_isHoldingWeapon(unsigned short *_args); +static signed short func_giveWeapon(unsigned short *_args); /*---------------------------------------------------------------------- @@ -105,6 +107,7 @@ static FunctionDef s_functionDefs[]= { func_getAmmoCount, 1 }, // ammoId { func_setAmmoCount, 2 }, // ammoId,amount { func_isHoldingWeapon, 1 }, // weaponId + { func_giveWeapon, 1 }, // weaponId }; static const int s_numFunctionDefs=sizeof(s_functionDefs)/sizeof(FunctionDef); @@ -244,8 +247,15 @@ static signed short func_isHoldingWeapon(unsigned short *_args) } break; + case WEAPON_BALLOON: + if(GameScene.getPlayer()->isHoldingBalloon()) + { + held=1; + } + break; + default: - ASSERT(!"BAD AMMO TYPE IN func_setAmmoCount()"); + ASSERT(!"BAD WEAPON TYPE IN func_isHoldingWeapon()"); break; } @@ -253,5 +263,32 @@ static signed short func_isHoldingWeapon(unsigned short *_args) } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: weaponId + Returns: true(1) or false(0) + ---------------------------------------------------------------------- */ +static signed short func_giveWeapon(unsigned short *_args) +{ + switch(_args[0]) + { + case WEAPON_BUBBLEWAND: + GameScene.getPlayer()->setMode(PLAYER_MODE_BUBBLE_MIXTURE); + break; + + case WEAPON_BALLOON: + GameScene.getPlayer()->setMode(PLAYER_MODE_BALLOON); + break; + + default: + ASSERT(!"BAD WEAPON TYPE IN func_giveWeapon()"); + break; + } + + return 0; +} + + /*=========================================================================== end */ diff --git a/tools/scripter.exe b/tools/scripter.exe index 41bbf64d8..11918961c 100644 Binary files a/tools/scripter.exe and b/tools/scripter.exe differ