/* ================ rvMonsterStroggHover::Spawn ================ */ void rvMonsterStroggHover::Spawn ( void ) { // actionRocketAttack.Init ( spawnArgs, "action_rocketAttack", "Torso_RocketAttack", AIACTIONF_ATTACK ); // actionBlasterAttack.Init ( spawnArgs, "action_blasterAttack", "Torso_BlasterAttack", AIACTIONF_ATTACK ); actionMGunAttack.Init ( spawnArgs, "action_mGunAttack", "Torso_MGunAttack", AIACTIONF_ATTACK ); actionMissileAttack.Init ( spawnArgs, "action_missileAttack", "Torso_MissileAttack", AIACTIONF_ATTACK ); actionBombAttack.Init ( spawnArgs, "action_bombAttack", "Torso_BombAttack", AIACTIONF_ATTACK ); actionStrafe.Init ( spawnArgs, "action_strafe", "Torso_Strafe", 0 ); actionCircleStrafe.Init ( spawnArgs, "action_circleStrafe", "Torso_CircleStrafe", AIACTIONF_ATTACK ); InitSpawnArgsVariables(); evadeDebounce = 0; numHoverJoints = idMath::ClampInt(0,MAX_HOVER_JOINTS,spawnArgs.GetInt( "num_hover_joints", "1" )); for ( int i = 0; i < numHoverJoints; i++ ) { if ( jointHover[i] != INVALID_JOINT ) { effectHover[i] = PlayEffect ( "fx_hover", jointHover[i], true ); } } if ( !marker ) { marker = gameLocal.SpawnEntityDef( "target_null" ); } //LIGHT StopHeadlight(); StartHeadlight(); if ( jointHeadlight != INVALID_JOINT ) { effectHeadlight = PlayEffect( "fx_headlight", jointHeadlight, true ); } }
END_CLASS_STATES /* ================ rvMonsterConvoyGround::State_Fall ================ */ stateResult_t rvMonsterConvoyGround::State_Fall ( const stateParms_t& parms ) { enum { STAGE_INIT, // Initialize fall stage STAGE_WAITIMPACT, // Wait for the drop turret to hit the ground STAGE_IMPACT, // Handle drop turret impact, switch to combat state STAGE_WAITDONE, STAGE_DONE }; switch ( parms.stage ) { case STAGE_INIT: StopMove ( MOVE_STATUS_DONE ); StopAnimState ( ANIMCHANNEL_LEGS ); StopAnimState ( ANIMCHANNEL_TORSO ); StartSound ( "snd_falling", SND_CHANNEL_VOICE, 0, false, NULL ); PlayEffect ( "fx_droptrail", animator.GetJointHandle ( "origin" ), true ); DisableAnimState ( ANIMCHANNEL_LEGS ); PlayCycle ( ANIMCHANNEL_TORSO, "idle", 0 ); oldOrigin = physicsObj.GetOrigin ( ); return SRESULT_STAGE(STAGE_WAITIMPACT); case STAGE_WAITIMPACT: if ( physicsObj.HasGroundContacts ( ) ) { return SRESULT_STAGE(STAGE_IMPACT); } return SRESULT_WAIT; case STAGE_IMPACT: StopSound ( SND_CHANNEL_VOICE, false ); StopEffect ( "fx_droptrail" ); PlayEffect ( "fx_landing", GetPhysics()->GetOrigin(), (-GetPhysics()->GetGravityNormal()).ToMat3() ); if ( (physicsObj.GetOrigin ( ) - oldOrigin).LengthSqr() > Square(128.0f) ) { PlayAnim ( ANIMCHANNEL_TORSO, "land", 0 ); return SRESULT_STAGE ( STAGE_WAITDONE ); } return SRESULT_STAGE ( STAGE_DONE ); case STAGE_WAITDONE: if ( AnimDone ( ANIMCHANNEL_TORSO, 4 ) ) { return SRESULT_STAGE ( STAGE_DONE ); } return SRESULT_WAIT; case STAGE_DONE: onGround = true; SetAnimState ( ANIMCHANNEL_LEGS, "Legs_Idle" ); SetAnimState ( ANIMCHANNEL_TORSO, "Torso_Idle" ); return SRESULT_DONE; } return SRESULT_ERROR; }
/* ================ rvMonsterTurret::Pain ================ */ bool rvMonsterTurret::Pain ( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ) { // Handle the shield effects if ( shieldHealth > 0 ) { shieldHealth -= damage; if ( shieldHealth <= 0 ) { PlayEffect ( "fx_shieldBreak", GetPhysics()->GetOrigin(), (-GetPhysics()->GetGravityNormal()).ToMat3() ); } else { PlayEffect ( "fx_shieldHit", GetPhysics()->GetOrigin(), (-GetPhysics()->GetGravityNormal()).ToMat3() ); } } return idAI::Pain ( inflictor, attacker, damage, dir, location ); }
//---------------------------------------------------------------------------------- // //---------------------------------------------------------------------------------- void Init() { g_position = ::Effekseer::Vector3D( 10.0f, 5.0f, 10.0f ) / 1.0f; g_focus = ::Effekseer::Vector3D( 0.0f, 0.0f, 0.0f ); SetCameraMatrix( ::Effekseer::Matrix44().LookAtRH( g_position, g_focus, ::Effekseer::Vector3D( 0.0f, 1.0f, 0.0f ) ) ); #if __DDS_TEST g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Laser01_dds.efk").c_str() ) ); #elif __CULLING_TEST g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/culling.efk").c_str() ) ); #else g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Laser01.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Laser02.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Simple_Ribbon_Parent.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Simple_Ribbon_Sword.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Simple_Ring_Shape1.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Simple_Ring_Shape2.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Simple_Sprite_FixedYAxis.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Simple_Track1.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/block.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/block_simple.efk").c_str() ) ); g_effects.push_back( Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)ToEFString(L"Resource/Simple_Distortion.efk").c_str() ) ); #endif PlayEffect(); }
void MarsObject::Init() { m_pAvatar = cocos2d::CCSprite::create(); m_pAvatar->setAnchorPoint(ccp(0.5f,0.5f)); SCENEMANAGER->GetSceneBackgroundLayer()->addChild(m_pAvatar,true); PlayEffect("marsbomb",m_pAvatar); }
/* ================= sdWalker::Event_GroundPound ================= */ void sdWalker::Event_GroundPound( float force, float damageScale, float shockWaveRange ) { GroundPound( force, damageScale, shockWaveRange ); bool leftleg = false; jointHandle_t jh = GetAnimator()->GetJointHandle( spawnArgs.GetString( leftleg ? "joint_foot_left" : "joint_foot_right" ) ); idVec3 traceOrig; GetWorldOrigin( jh, traceOrig ); idVec3 traceEnd = traceOrig; traceOrig.z += 100.0f; traceEnd.z -= 10.0f; trace_t traceObject; gameLocal.clip.TracePoint( CLIP_DEBUG_PARMS traceObject, traceOrig, traceEnd, MASK_SOLID | CONTENTS_WATER | MASK_OPAQUE, this ); traceEnd = traceObject.endpos; if ( traceObject.fraction < 1.f ) { int cont = gameLocal.clip.Contents( CLIP_DEBUG_PARMS traceEnd, NULL, mat3_identity, CONTENTS_WATER, this ); if ( !cont ) { const char* surfaceTypeName = NULL; if ( traceObject.c.surfaceType ) { surfaceTypeName = traceObject.c.surfaceType->GetName(); } idVec3 colorWhite(1.f,1.f,1.f); idVec3 xaxis(-1.f, 0.f, 0.f); PlayEffect( "fx_ground_pound", colorWhite, surfaceTypeName, traceEnd, xaxis.ToMat3() ); } } }
/* ================ rvMonsterConvoyGround::AdjustHealthByDamage ================ */ void rvMonsterConvoyGround::AdjustHealthByDamage ( int damage ) { if ( isOpen || vehicleCollision ) { idAI::AdjustHealthByDamage ( damage ); } else { PlayEffect ( "fx_shieldHit", animator.GetJointHandle ( "axis" ) ); } }
//---------------------------------------------------------------------------------- // //---------------------------------------------------------------------------------- bool DoWindowEvent() { if( g_closed ) return false; while ( XPending( g_display ) ) { XEvent event; XNextEvent( g_display, &event ); switch ( event.type ) { case ButtonPress: { PlayEffect(); } break; case ClientMessage : { if ( (Atom)event.xclient.data.l[0] == g_wm_delete_window ) return false; } break; case (DestroyNotify) : { g_closed = true; return false; } break; } } return true; }
/* ================ rvMonsterStroggHover::DoNamedAttack ================ */ void rvMonsterStroggHover::DoNamedAttack ( const char* attackName, jointHandle_t joint ) { if ( joint != INVALID_JOINT ) { StartSound ( va("snd_%s_fire",attackName), SND_CHANNEL_ANY, 0, false, NULL ); PlayEffect ( va("fx_%s_flash",attackName), joint ); Attack ( attackName, joint, GetEnemy() ); } }
void DialogLayer::restore() { PlayEffect("Audio_button.mp3"); if(!m_bInShow) return; m_bInShow = false; this->setVisible(false); }
/* ===================== sdClientScriptEntity::Event_PlayEffect ===================== */ void sdClientScriptEntity::Event_PlayEffect( const char* effectName, const char* jointName, bool loop ) { jointHandle_t joint; joint = GetAnimator() ? GetAnimator()->GetJointHandle( jointName ) : INVALID_JOINT; rvClientEntityPtr< rvClientEffect > eff; eff = PlayEffect( effectName, colorWhite.ToVec3(), NULL, joint, loop ); sdProgram::ReturnHandle( eff.GetSpawnId() ); }
/* ================ idMoveable::AddDamageEffect ================ */ void idMoveable::AddDamageEffect ( const trace_t &collision, const idVec3 &velocity, const char *damageDefName, idEntity* inflictor ) { // Play an impact effect during this stage? if ( stageDict ) { PlayEffect ( gameLocal.GetEffect ( *stageDict, "fx_impact" ), collision.c.point, collision.c.normal.ToMat3(), true, vec3_origin, true ); } }
void ForceFeedbackDevice::TypedForce<P>::UpdateEffect(int magnitude) { if (UpdateParameters(magnitude)) { if (magnitude) PlayEffect(); else StopEffect(); } }
void Player::jump() { if(m_bIsDead || m_nJumpState == kJumpYes) return; //CCLOG("count in jump: %d" , getObjectOnFoot()->count()); if(m_nJumpState == kJumpNo && getObjectOnFoot()->count() != 0) { PlayEffect("Audio_jump.mp3"); b2Vec2 vec = b2Vec2(m_body->GetLinearVelocity().x, 26.0f); m_body->SetLinearVelocity(vec); this->stopAllActions(); if(m_bIsHeadRight) { this->runAction(m_jumpRightAction); } else { this->runAction(m_jumpLeftAction); } m_nJumpState = kJumpYes; m_nJumpCount = 0; m_fJumpBeginningHeight = m_body->GetPosition().y; if(m_pJumpListener) { m_pJumpListener->playerJumped(); } } //// Now in arise //else if(m_nJumpState == kJumpYes // && m_body->GetLinearVelocity().y > 0 // && m_body->GetPosition().y - m_fJumpBeginningHeight < 3.5 // && !m_bHasReleasedInAJump) //{ // //CCLog("JumpSwitch 2"); // //CCLOG("now y : %f",m_body->GetPosition().y); // //CCLOG("2Begin : %f",m_jumpBeginningHeight); // //m_nJumpCount++; // //if(m_nJumpCount > LongJumpCount) // //{ // // b2Vec2 impulse = b2Vec2(0.0f, 150.0f); // // m_body->ApplyForce(impulse, m_body->GetWorldCenter()); // //} //} //else if(m_nJumpState == kJumpYes ) //{ // //CCLog("JumpSwitch 3"); // m_bHasReleasedInAJump = true; // return; //} //CCLog("Jump2\n"); }
void BlobLayer::checkCombo(float) { int combo = (BlobScene::LastScore - lastObservedScore) / 6; if (combo > 0) { auto color = Entity::Colors[combo % Entity::Colors.size()]; flashBigText(LS("Combo") + "\nx" + nToString(combo+1), color); PlayEffect(SOUNDS_COMBO, (float) combo * 0.1f + 0.8f, 0.7f); } lastObservedScore = BlobScene::LastScore; }
void SnakeLayer::itemPicked() { score++; itemsPicked++; spawnItem(); maximumLength += 100; lblScore->setString(LS("ScoreColon") + " " + nToString(score)); lblScore->runAction(Sequence::createWithTwoActions(ScaleTo::create(0.3f, 1.2f), ScaleTo::create(0.3f, 1.0f))); PlayEffect("bottle_pop_2.wav"); }
/* ================ rvMonsterStroggMarine::State_Torso_MovingRangedAttack ================ */ stateResult_t rvMonsterStroggMarine::State_Torso_MovingRangedAttack ( const stateParms_t& parms ) { enum { STAGE_INIT, STAGE_SHOOT, STAGE_SHOOT_WAIT, }; switch ( parms.stage ) { case STAGE_INIT: CalculateShots(); shotsFired = 0; return SRESULT_STAGE ( STAGE_SHOOT ); case STAGE_SHOOT: shots--; shotsFired++; nextShootTime = gameLocal.GetTime() + attackRate; if ( attackJoint != INVALID_JOINT ) { Attack( "base", attackJoint, GetEnemy() ); PlayEffect( "fx_blaster_muzzleflash", attackJoint ); } StartSound( "snd_weapon_fire", SND_CHANNEL_WEAPON, 0, false, 0 ); /* switch ( move.currentDirection ) { case MOVEDIR_RIGHT: PlayAnim ( ANIMCHANNEL_TORSO, "range_attack_torso_right", 0 ); break; case MOVEDIR_LEFT: PlayAnim ( ANIMCHANNEL_TORSO, "range_attack_torso_left", 0 ); break; case MOVEDIR_BACKWARD: PlayAnim ( ANIMCHANNEL_TORSO, "range_attack_torso_back", 0 ); break; default: PlayAnim ( ANIMCHANNEL_TORSO, "range_attack_torso", 0 ); break; } */ return SRESULT_STAGE ( STAGE_SHOOT_WAIT ); case STAGE_SHOOT_WAIT: // When the shoot animation is done either play another shot animation // or finish up with post_shooting if ( gameLocal.GetTime() >= nextShootTime ) { if ( shots <= 0 || (!enemy.fl.inFov && shotsFired >= minShots) || !move.fl.running || !move.fl.moving ) { return SRESULT_DONE; } return SRESULT_STAGE ( STAGE_SHOOT); } return SRESULT_WAIT; } return SRESULT_ERROR; }
void EpisodeLockedScene::btnBuyPressed(Ref*) { PlayEffect("buy.wav"); //if (GameSettings::SpendGems(EpisodeInfos[GameSettings::CurrentEpisode].price)) { GameSettings::UnlockedEpisodes.insert(GameSettings::CurrentEpisode); GameSettings::SaveSettings(); unschedule(schedule_selector(EpisodeLockedScene::checkGemsChanged)); Director::getInstance()->replaceScene(TransitionFade::create(1.0f, ChooserScene::scene())); } }
/* ================= sdWalker::Collide ================= */ bool sdWalker::Collide( const trace_t& trace, const idVec3& velocity, int bodyId ) { idEntity* ent = gameLocal.entities[ trace.c.entityNum ]; idVec3 relativeVelocity = velocity; if ( ent != NULL ) { relativeVelocity -= ent->GetPhysics()->GetLinearVelocity(); } float verticalSpeed = relativeVelocity * physicsObj.GetGravityNormal(); float absVerticalSpeed = idMath::Fabs( verticalSpeed ); if ( ent != NULL ) { float horizontalSpeed = relativeVelocity.Length() - absVerticalSpeed; if ( horizontalSpeed > 5.f ) { idVec3 otherOrigin = ent->GetPhysics()->GetAbsBounds().GetCenter(); const idVec3& origin = trace.c.point; idVec3 impulse = otherOrigin - origin; impulse.z += 4.0f; impulse.Normalize(); impulse *= ent->GetRadiusPushScale(); idVec3 delta = ( otherOrigin - origin ) * 0.5f; ent->GetPhysics()->AddForce( 0, origin + delta, kickForce * impulse ); } } if ( verticalSpeed > groundPoundMinSpeed ) { float scale = absVerticalSpeed * stompSpeedScale; if ( scale > minStompScale ) { if ( scale > maxStompScale ) { scale = maxStompScale; } } else { scale = 0.f; } GroundPound( groundPoundForce, scale, 512.f ); if ( scale > 4.f ) { const char* surfaceTypeName = NULL; if ( trace.c.surfaceType ) { surfaceTypeName = trace.c.surfaceType->GetName(); } idVec3 xaxis(-1.f, 0.f, 0.f); PlayEffect( "fx_ground_collide", colorWhite.ToVec3(), surfaceTypeName, physicsObj.GetOrigin(), xaxis.ToMat3() );//physicsObj.GetGroundNormal().ToMat3() ); } } return false; }
/* ============ idSecurityCamera::Pain ============ */ bool idSecurityCamera::Pain( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ) { // RAVEN BEGIN // bdube: replaced fx call with raven call PlayEffect ( "fx_damage", renderEntity.origin, renderEntity.axis ); /* const char *fx = spawnArgs.GetString( "fx_damage" ); if ( fx[0] != '\0' ) { idEntityFx::StartFx( fx, NULL, NULL, this, true ); } */ // RAVEN END return true; }
void CBaseFX::PlayFX(const string &strFXNameGroup, const string &strFXName, uint32 uDelayTime) { string strFXNameFile = strFXNameGroup; FixFXPath(strFXNameFile); m_sName = strFXNameFile + "," + strFXName; if (uDelayTime==0) { PlayEffect(strFXNameFile, strFXName); } else { CAppClient::Inst()->RegisterTick(this,uDelayTime); } }
void SnakeLayer::bonusPicked() { score += 5; maximumLength += 200; bonus++; if (bonus == 10) GameSettings::ReportAchievement(ACHIEVEMENT_SNAKE_BONUS); unschedule(schedule_selector(SnakeLayer::removeBonus)); bonusGroup->removeAllChildren(); lblScore->setString(LS("ScoreColon") + " " + nToString(score)); lblScore->runAction(Sequence::createWithTwoActions(ScaleTo::create(0.3f, 1.2f), ScaleTo::create(0.3f, 1.0f))); PlayEffect("bottle_pop_2.wav"); }
//---------------------------------------------------------------------------------- // //---------------------------------------------------------------------------------- static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_DESTROY: PostQuitMessage(0); break; case WM_LBUTTONDOWN: PlayEffect(); break; default: return DefWindowProc(hWnd, msg, wParam, lParam); } return 0; }
void HelpLayer::restore() { PlayEffect("Audio_button.mp3"); if(!m_bInShow) return; m_bInShow = false; CCSize size = CCDirector::sharedDirector()->getWinSize(); CCMoveTo* pMoveUp = CCMoveTo::create(0.4, ccp(size.width / 2, m_pFrame->boundingBox().size.height / 2 + size.height)); m_pColorLayer->setVisible(false); m_pFrame->runAction(pMoveUp); if(m_pDelegate) m_pDelegate->helpLayerClosed(); }
void AudioManager::PlayEffect( const tstring& path, const tstring& name, uint8 channel, int32 loopTimes ) { Logger::GetInstance()->Log(mSoundService != nullptr, _T("Sound Service is invalid."), STARENGINE_LOG_TAG); if(mEffectsList.find(name) == mEffectsList.end()) { LoadEffect(path, name, channel); } PlayEffect(name, loopTimes); }
/* ================= idMoveable::Collide ================= */ bool idMoveable::Collide( const trace_t &collision, const idVec3 &velocity ) { float len, f; idVec3 dir; idEntity *ent; dir = velocity; len = dir.NormalizeFast(); if ( len > BOUNCE_SOUND_MIN_VELOCITY ) { if ( gameLocal.time > nextCollideFxTime ) { PlayEffect ( gameLocal.GetEffect(spawnArgs,"fx_collide",collision.c.materialType), collision.c.point, collision.c.normal.ToMat3() ); // RAVEN BEGIN // jscott: fixed negative sqrt call if( len > BOUNCE_SOUND_MAX_VELOCITY ) { f = 1.0f; } else if( len <= BOUNCE_SOUND_MIN_VELOCITY ) { f = 0.0f; } else { f = ( len - BOUNCE_SOUND_MIN_VELOCITY ) * ( 1.0f / ( BOUNCE_SOUND_MAX_VELOCITY - BOUNCE_SOUND_MIN_VELOCITY ) ); } // RAVEN END SetSoundVolume( f ); StartSound( "snd_bounce", SND_CHANNEL_BODY, 0, false, NULL ); nextCollideFxTime = gameLocal.time + BOUNCE_SOUND_DELAY_MIN + gameLocal.random.RandomInt(BOUNCE_SOUND_DELAY_MAX - BOUNCE_SOUND_DELAY_MIN); } } if ( canDamage && damage.Length() ) { ent = gameLocal.entities[ collision.c.entityNum ]; if ( ent && len > minDamageVelocity ) { // RAVEN BEGIN // jscott: fixed negative sqrt call if( len > maxDamageVelocity ) { f = 1.0f; } else if( len <= minDamageVelocity ) { f = 0.0f; } else { f = idMath::Sqrt( len - minDamageVelocity ) * ( 1.0f / idMath::Sqrt( maxDamageVelocity - minDamageVelocity ) ); } // RAVEN END ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, damage, f, INVALID_JOINT ); } } return false; }
/* ================ rvEffect::Play ================ */ bool rvEffect::Play( void ) { clientEffect = PlayEffect ( effect, renderEntity.origin, renderEntity.axis, loop, endOrigin ); if ( clientEffect ) { idVec4 color; color[0] = renderEntity.shaderParms[SHADERPARM_RED]; color[1] = renderEntity.shaderParms[SHADERPARM_GREEN]; color[2] = renderEntity.shaderParms[SHADERPARM_BLUE]; color[3] = renderEntity.shaderParms[SHADERPARM_ALPHA]; clientEffect->SetColor ( color ); clientEffect->SetBrightness ( renderEntity.shaderParms[ SHADERPARM_BRIGHTNESS ] ); clientEffect->SetAmbient( true ); BecomeActive ( TH_THINK ); return true; } return false; }
/* ================ rvMonsterFailedTransfer::OnDeath ================ */ void rvMonsterFailedTransfer::OnDeath ( void ) { idAI::OnDeath ( ); if ( allowSplit ) { idEntity* torso; idDict args; LoadAF ( "ragdoll_legs", true ); PlayEffect ( "fx_bloodyburst", animator.GetJointHandle ( "chest" ) ); SetSkin ( declManager->FindSkin ( spawnArgs.GetString ( "skin_legs" ) ) ); args.Copy ( *gameLocal.FindEntityDefDict ( "monster_failed_transfer_torso" ) ); args.SetVector ( "origin", GetPhysics()->GetOrigin() + GetPhysics()->GetGravityNormal() * -50.0f ); args.SetInt ( "angle", move.current_yaw ); gameLocal.SpawnEntityDef ( args, &torso ); torso->fl.takedamage = false; PostEventMS( &AI_TakeDamage, 100, 1.0f ); } }
BOOL SAV_Load( int load_no ) { char fname[256]; DWORD rsize; int i; char *msgBuf; MySaveHead saveHead; if(load_no>=0) { wsprintf( fname, "save_%02d.sav", load_no ); } else { wsprintf( fname, "save___.sav" ); } exec_mode tmp_back_mode = sysInf.execMode; InitRestartData(); if(sysInf.execMode!=tmp_back_mode)changeExecMode(tmp_back_mode); if(load_no!=98){ HANDLE hFile = CreateFile(fname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0L ,NULL); if(INVALID_HANDLE_VALUE==hFile){ return FALSE; } ReadFile(hFile,saveWnd->saveBmp.pBuf,thumbnailW*thumbnailH*3,&rsize,NULL); ReadFile(hFile,&saveHead,sizeof(MySaveHead),&rsize,NULL); if(saveHead.ver!=MAKEWORD(SaveVerMajor,SaveVerMinor) || 0!=strnicmp(saveHead.head,"LSAV",4)){ MessageBox(sysInf.hWnd,"セーブデータ形式が異常です。このセーブデータは使用できません","データエラー",MB_OK|MB_ICONWARNING); return FALSE; } ReadFile(hFile,&SaveStruct, sizeof(SaveStruct), &rsize,NULL); ReadFile(hFile,&saveInf,sizeof(SaveInfo),&rsize,NULL); ReadFile(hFile,setBmpInf,sizeof(SetBmpInf)*STBMP_MAX,&rsize,NULL); ReadFile(hFile,&backSelectStruct, sizeof(SaveStruct), &rsize,NULL); ReadFile(hFile,&backSelectInf,sizeof(BackSelectInf),&rsize,NULL); CloseHandle(hFile); }else{ CopyMemory(&SaveStruct,&backSelectStruct,sizeof(SaveStruct)); CopyMemory(&saveInf,&backSelectInf.saveInf,sizeof(SaveInfo)); CopyMemory(&setBmpInf,&bak_setBmpInf,sizeof(SetBmpInf)*STBMP_MAX); } SAV_LoadScript(); memcpy( ESC_FlagBuf, SaveStruct.ESC_FlagBuf, sizeof(int)*ESC_FLAG_MAX ); toneConvert.ChangeTable( saveInf.tone_type[0], saveInf.tone_type[1], saveInf.tone_backOnly); SHORT tmp_shakeSize = saveInf.shakeSize; g_disp(saveInf.bak_no, _BAK_DIRECT, saveInf.cg_type, 0, saveInf.btRect.left, saveInf.btRect.top); saveInf.shakeSize = tmp_shakeSize; if(saveInf.shakeSize){ backColorBuf.RollBlt(&bgInf.colorBuf, saveInf.shakeSize*180.0f); bgInf.colorBuf.BltFast(0,0,&backColorBuf,NULL,FALSE); } for(i=0;i<STCHAR_MAX;i++){ if(saveInf.charSave[i].char_no){ c_disp(saveInf.charSave[i].char_no-1, saveInf.charSave[i].pose, saveInf.charSave[i].locate, _CHR_DIRECT, saveInf.charSave[i].layer,saveInf.charSave[i].alpha,0,saveInf.charSave[i].bright); } } for(i=0;i<STBMP_MAX;i++){ setBmpInf[i].Reload(); } if(saveInf.selectNum){ for(i=0;i<saveInf.selectNum;i++){ selectWnd.addSelect(&backSelectInf.selectMsg[i*60]); } sysInf.bMsgAtOnce = on; msgWnd.DisplayMessage((BYTE *)backSelectInf.msgBuf); backLog.SetBackLog(backSelectInf.msgBuf,backSelectInf.msgLine); sysInf.bMsgCLS = on; } if(saveInf.musicNum>=0){ lpSoundDS->ChangeMusic(bgmHandle, saveInf.musicNum,TRUE,0, 30,saveInf.musicVol); }else{ lpSoundDS->FadeOut( bgmHandle ); } for(i=0;i<hEvtSndMax;i++){ if(saveInf.loopSeNum[i]==0)continue; CreateEffect(evtHandle[i],saveInf.loopSeNum[i]-1); PlayEffect(evtHandle[i],saveInf.loopSeVol[i],TRUE); } if(backSelectInf.saveInf.selectNum){ EnableMenuItem( sysInf.hMenu, ID_BACKSELECT, MF_ENABLED ); }else{ EnableMenuItem( sysInf.hMenu, ID_BACKSELECT, MF_GRAYED ); } sysInf.FontSize = mainFontSize; lpSoundDS->voiceCnt = saveInf.voiceCnt; lpSoundDS->scriptNo = saveInf.voiceScriptNo; BOOL bPlayVoice = FALSE; if(saveInf.RestartVoice[0]>0){ char voicefile[32]; saveInf.RestartVoice[0] --; int charNo = checkPlayVoice(saveInf.RestartVoice[0]); if(charNo >= 0){ wsprintf(voicefile,"%05d_%03d_%03d",saveInf.RestartVoice[2], saveInf.RestartVoice[1], charNo); if(!keyState.data_skip && !sysInf.bReadSkip){ bPlayVoice = TRUE; } }else{ wsprintf(voicefile,"%05d_%03d_%03d",saveInf.RestartVoice[2], saveInf.RestartVoice[1], saveInf.RestartVoice[0]); } backLog.SetVoice(voicefile); saveInf.RestartVoice[0] = 0; if(saveWnd){ strcpy(saveWnd->voicefile,voicefile); } } if(FALSE==bPlayVoice){ if(saveWnd)saveWnd->voicefile[0] = '\0'; } return TRUE; } // SAV_Load
/* ================ rvMonsterStreamProtector::State_Torso_PlasmaAttack ================ */ stateResult_t rvMonsterStreamProtector::State_Torso_PlasmaAttack ( const stateParms_t& parms ) { enum { STAGE_START, STAGE_START_WAIT, STAGE_FIRE, STAGE_INITIALFIRE_WAIT, STAGE_FIRE_WAIT, STAGE_END, STAGE_END_WAIT, }; switch ( parms.stage ) { case STAGE_START: DisableAnimState ( ANIMCHANNEL_LEGS ); // Loop the flame animation PlayAnim( ANIMCHANNEL_TORSO, "range_plasma_start", parms.blendFrames ); // Make sure we clean up some things when this state is finished (effects for one) PostAnimState ( ANIMCHANNEL_TORSO, "Torso_FinishPlasmaAttack", 0, 0, SFLAG_ONCLEAR ); return SRESULT_STAGE ( STAGE_START_WAIT ); case STAGE_START_WAIT: if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) { return SRESULT_STAGE ( STAGE_FIRE ); } return SRESULT_WAIT; case STAGE_FIRE: attackEndTime = gameLocal.time + 500; attackNextTime = gameLocal.time; // Flame effect PlayEffect ( "fx_plasma_muzzle", jointPlasmaMuzzle, true ); PlayCycle ( ANIMCHANNEL_TORSO, "range_plasma_fire", 0 ); return SRESULT_STAGE ( STAGE_INITIALFIRE_WAIT ); case STAGE_INITIALFIRE_WAIT: if ( gameLocal.time > attackEndTime ) { attackEndTime = gameLocal.time + SEC2MS ( 1.0f + gameLocal.random.RandomFloat ( ) * 4.0f ); return SRESULT_STAGE ( STAGE_FIRE_WAIT ); } // Launch another attack? if ( gameLocal.time >= attackNextTime ) { Attack ( "plasma", jointPlasmaMuzzle, enemy.ent ); attackNextTime = gameLocal.time + plasmaAttackRate; } return SRESULT_WAIT; case STAGE_FIRE_WAIT: // If we have been using plasma too long or havent seen our enemy for at least half a second then // stop now. if ( gameLocal.time > attackEndTime || gameLocal.time - enemy.lastVisibleTime > 500 || (IsEnemyVisible() && !enemy.fl.inFov) ) { StopEffect ( "fx_plasma_muzzle" ); return SRESULT_STAGE ( STAGE_END ); } // Launch another attack? if ( gameLocal.time >= attackNextTime ) { Attack ( "plasma", jointPlasmaMuzzle, enemy.ent ); attackNextTime = gameLocal.time + plasmaAttackRate; } return SRESULT_WAIT; case STAGE_END: // End animations PlayAnim( ANIMCHANNEL_TORSO, "range_plasma_end", parms.blendFrames ); return SRESULT_STAGE ( STAGE_END_WAIT ); case STAGE_END_WAIT: if ( AnimDone ( ANIMCHANNEL_TORSO, 0 ) ) { return SRESULT_DONE; } return SRESULT_WAIT; } return SRESULT_ERROR; }