示例#1
0
void ConfuseSpell::Launch() {
	
	ARX_SOUND_PlaySFX(SND_SPELL_CONFUSE, &entities[m_target]->pos);
	
	m_hasDuration = true;
	m_fManaCostPerSecond = 1.5f;
	m_duration = (m_launchDuration > -1) ? m_launchDuration : 5000;
	
	
	tex_p1 = TextureContainer::Load("graph/obj3d/textures/(fx)_tsu_blueting");
	tex_trail = TextureContainer::Load("graph/obj3d/textures/(fx)_bandelette_blue");
	
	const char tex[] = "graph/obj3d/interactive/fix_inter/fx_papivolle/fx_papivolle.tea";
	ANIM_HANDLE * anim_papii = EERIE_ANIMMANAGER_Load(tex);
	
	ANIM_Set(&au, anim_papii);
	au.next_anim = NULL;
	au.cur_anim = anim_papii;
	au.ctime = 0;
	au.flags = EA_LOOP;
	au.nextflags = 0;
	au.lastframe = 0;
	au.pour = 0;
	au.fr = 0;
	au.altidx_cur = 0;
	au.altidx_next = 0;
	
	m_targets.push_back(m_target);
}
示例#2
0
void changeAnimation(Entity * entity, size_t layer, ANIM_HANDLE * animation,
                          AnimUseType flags, bool startAtBeginning) {
	AnimLayer  & animlayer = entity->animlayer[layer];
	AcquireLastAnim(entity);
	FinishAnim(entity, animlayer.cur_anim);
	ANIM_Set(animlayer, animation);
	animlayer.flags |= flags;
	if(startAtBeginning) {
		animlayer.altidx_cur = 0;
	}
}
示例#3
0
void ManageCombatModeAnimationsEND() {
	
	Entity * io = entities.player();
	
	AnimLayer & layer1 = io->animlayer[1];
	AnimLayer & layer3 = io->animlayer[3];
	
	ANIM_HANDLE ** alist = io->anims;

	if(layer1.cur_anim
		&&(		(layer1.cur_anim == alist[ANIM_BARE_READY])
			||	(layer1.cur_anim == alist[ANIM_DAGGER_READY_PART_2])
			||	(layer1.cur_anim == alist[ANIM_DAGGER_READY_PART_1])
			||	(layer1.cur_anim == alist[ANIM_1H_READY_PART_2])
			||	(layer1.cur_anim == alist[ANIM_1H_READY_PART_1])
			||	(layer1.cur_anim == alist[ANIM_2H_READY_PART_2])
			||	(layer1.cur_anim == alist[ANIM_2H_READY_PART_1])
			||	(layer1.cur_anim == alist[ANIM_MISSILE_READY_PART_1])
			||	(layer1.cur_anim == alist[ANIM_MISSILE_READY_PART_2])	)
	) {
		AimTime = (unsigned long)(arxtime);
	}

	if(layer1.flags & EA_ANIMEND) {
		WeaponType weapontype = ARX_EQUIPMENT_GetPlayerWeaponType();

		if(layer1.cur_anim &&
			(	(layer1.cur_anim == io->anims[ANIM_BARE_UNREADY])
			||	(layer1.cur_anim == io->anims[ANIM_DAGGER_UNREADY_PART_2])
			||	(layer1.cur_anim == io->anims[ANIM_1H_UNREADY_PART_2])
			||	(layer1.cur_anim == io->anims[ANIM_2H_UNREADY_PART_2])
			||	(layer1.cur_anim == io->anims[ANIM_MISSILE_UNREADY_PART_2])	)
		) {
			AcquireLastAnim(io);
			layer1.cur_anim = NULL;
		}

		switch(weapontype) {
			case WEAPON_BARE: {
				// Is Weapon Ready ? In this case go to Fight Wait anim
				if(layer1.cur_anim == alist[ANIM_BARE_READY]) {
					if(player.Interface & INTER_NO_STRIKE) {
						player.Interface &= ~INTER_NO_STRIKE;
						changeAnimation(io, 1, alist[ANIM_BARE_WAIT], EA_LOOP);
					} else {
						changeAnimation(io, 1, alist[ANIM_BARE_STRIKE_LEFT_START + CurrFightPos * 3]);
					}
					AimTime = (unsigned long)(arxtime);
					io->isHit = false;
				}
				break;
			}
			case WEAPON_DAGGER: // DAGGER ANIMS end

				if(alist[ANIM_DAGGER_READY_PART_1]) {
					if(layer1.cur_anim == alist[ANIM_DAGGER_READY_PART_1]) {
						ARX_EQUIPMENT_AttachPlayerWeaponToHand();
						changeAnimation(io, 1, alist[ANIM_DAGGER_READY_PART_2]);
					} else if(layer1.cur_anim == alist[ANIM_DAGGER_READY_PART_2]) {
						if(player.Interface & INTER_NO_STRIKE) {
							player.Interface &= ~INTER_NO_STRIKE;
							changeAnimation(io, 1, alist[ANIM_DAGGER_WAIT], EA_LOOP);
						} else {
							changeAnimation(io, 1, alist[ANIM_DAGGER_STRIKE_LEFT_START + CurrFightPos * 3]);
						}
						AimTime = (unsigned long)(arxtime);
						io->isHit = false;
					} else if(layer1.cur_anim == alist[ANIM_DAGGER_UNREADY_PART_1]) {
						ARX_EQUIPMENT_AttachPlayerWeaponToBack();
						changeAnimation(io, 1, alist[ANIM_DAGGER_UNREADY_PART_2]);
					}
				}

			break;
			case WEAPON_1H:	// 1H ANIMS end

				if(alist[ANIM_1H_READY_PART_1]) {
					if(layer1.cur_anim == alist[ANIM_1H_READY_PART_1]) {
						ARX_EQUIPMENT_AttachPlayerWeaponToHand();
						changeAnimation(io, 1, alist[ANIM_1H_READY_PART_2]);
					} else if(layer1.cur_anim == alist[ANIM_1H_READY_PART_2]) {
						if(player.Interface & INTER_NO_STRIKE) {
							player.Interface &= ~INTER_NO_STRIKE;
							changeAnimation(io, 1, alist[ANIM_1H_WAIT], EA_LOOP);
						} else {
							changeAnimation(io, 1, alist[ANIM_1H_STRIKE_LEFT_START + CurrFightPos * 3]);
						}
						AimTime = (unsigned long)(arxtime);
						io->isHit = false;
					} else if (layer1.cur_anim == alist[ANIM_1H_UNREADY_PART_1]) {
						ARX_EQUIPMENT_AttachPlayerWeaponToBack();
						changeAnimation(io, 1, alist[ANIM_1H_UNREADY_PART_2]);
					}
				}

			break;
			case WEAPON_2H:	// 2H ANIMS end

				if(alist[ANIM_2H_READY_PART_1]) {
					if(layer1.cur_anim == alist[ANIM_2H_READY_PART_1]) {
						ARX_EQUIPMENT_AttachPlayerWeaponToHand();
						changeAnimation(io, 1, alist[ANIM_2H_READY_PART_2]);
					} else if(layer1.cur_anim == alist[ANIM_2H_READY_PART_2]) {
						if(player.Interface & INTER_NO_STRIKE) {
							player.Interface &= ~INTER_NO_STRIKE;
							changeAnimation(io, 1, alist[ANIM_2H_WAIT], EA_LOOP);
						} else {
							changeAnimation(io, 1, alist[ANIM_2H_STRIKE_LEFT_START + CurrFightPos * 3]);
						}
						AimTime = (unsigned long)(arxtime);
						io->isHit = false;
					} else if(layer1.cur_anim == alist[ANIM_2H_UNREADY_PART_1]) {
						ARX_EQUIPMENT_AttachPlayerWeaponToBack();
						changeAnimation(io, 1, alist[ANIM_2H_UNREADY_PART_2]);
					}
				}

			break;
			case WEAPON_BOW:// MISSILE Weapon ANIMS end

				if(alist[ANIM_MISSILE_READY_PART_1]) {
					if(layer1.cur_anim == alist[ANIM_MISSILE_READY_PART_1]) {
						ARX_EQUIPMENT_AttachPlayerWeaponToHand();
						changeAnimation(io, 1, alist[ANIM_MISSILE_READY_PART_2]);
					} else if(layer1.cur_anim == alist[ANIM_MISSILE_READY_PART_2]) {
						if(Player_Arrow_Count() > 0) {
							if(player.Interface & INTER_NO_STRIKE) {
								player.Interface &= ~INTER_NO_STRIKE;
								changeAnimation(io, 1, alist[ANIM_MISSILE_WAIT], EA_LOOP);
							} else {
								changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE_PART_1]);
							}
							io->isHit = false;
						} else {
							changeAnimation(io, 1, alist[ANIM_MISSILE_WAIT]);
						}
						EERIE_LINKEDOBJ_UnLinkObjectFromObject(io->obj, arrowobj);
					} else if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE_PART_1]) {
						// TODO why no AcquireLastAnim()?
						ANIM_Set(layer1, alist[ANIM_MISSILE_STRIKE_PART_2]);
					} else if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE_PART_2]) {
						// TODO why no AcquireLastAnim()?
						ANIM_Set(layer1, alist[ANIM_MISSILE_STRIKE_CYCLE]);
					} else if(layer1.cur_anim == alist[ANIM_MISSILE_UNREADY_PART_1]) {
						ARX_EQUIPMENT_AttachPlayerWeaponToBack();
						changeAnimation(io, 1, alist[ANIM_MISSILE_UNREADY_PART_2]);
					}
				}

			break;
		}

		// Spell casting anims
		if(alist[ANIM_CAST] && layer1.cur_anim == alist[ANIM_CAST]) {
			if(alist[ANIM_CAST_END]) {
				changeAnimation(io, 1, alist[ANIM_CAST_END]);
			}
		} else if(alist[ANIM_CAST_END] && layer1.cur_anim == alist[ANIM_CAST_END]) {
			AcquireLastAnim(io);
			layer1.cur_anim = NULL;
			player.doingmagic = 0;

			if(WILLRETURNTOCOMBATMODE) {
				player.Interface |= INTER_COMBATMODE;
				player.Interface |= INTER_NO_STRIKE;

				ARX_EQUIPMENT_LaunchPlayerReadyWeapon();
				WILLRETURNTOCOMBATMODE = false;
			}
		}
	}

	// Is the shield off ?
	if(layer3.flags & EA_ANIMEND) {
		if(io->anims[ANIM_SHIELD_END] && layer3.cur_anim == io->anims[ANIM_SHIELD_END]) {
			AcquireLastAnim(io);
			layer3.cur_anim = NULL;
		}
	}
}
示例#4
0
//-----------------------------------------------------------------------------
// ARX Menu Rendering Func
// returns false if no menu needs to be displayed
//-----------------------------------------------------------------------------
bool ARX_Menu_Render() {
	
	if(ARXmenu.currentmode == AMCM_OFF)
		return false;

	bool br = Menu2_Render();

	if(br)
		return br;

	if(ARXmenu.currentmode == AMCM_OFF)
		return false;

	if(GInput->getMouseButton(Mouse::Button_0)) {
		EERIEMouseButton = 1;
		LastMouseClick = 1;
	} else if(GInput->getMouseButton(Mouse::Button_1)) {
		EERIEMouseButton = 2;
		LastMouseClick = 2;
	} else {
		EERIEMouseButton = 0;
	}

	GRenderer->BeginScene();

	GRenderer->Clear(Renderer::ColorBuffer | Renderer::DepthBuffer);
	
	FLYING_OVER = 0;

	//-------------------------------------------------------------------------

	if(ARXmenu.currentmode == AMCM_NEWQUEST && ARXmenu.mda) {
		if(ITC.Get("questbook") == NULL) {
			ARX_Menu_Resources_Release(false);
			ARX_Menu_Resources_Create();
			
			// TODO this is also in Interface.cpp

			ITC.Set("playerbook", "graph/interface/book/character_sheet/char_sheet_book");
			ITC.Set("ic_casting", "graph/interface/book/character_sheet/buttons_carac/icone_casting");
			ITC.Set("ic_close_combat", "graph/interface/book/character_sheet/buttons_carac/icone_close_combat");
			ITC.Set("ic_constitution", "graph/interface/book/character_sheet/buttons_carac/icone_constit");
			ITC.Set("ic_defense", "graph/interface/book/character_sheet/buttons_carac/icone_defense");
			ITC.Set("ic_dexterity", "graph/interface/book/character_sheet/buttons_carac/icone_dext");
			ITC.Set("ic_etheral_link", "graph/interface/book/character_sheet/buttons_carac/icone_etheral_link");
			ITC.Set("ic_mind", "graph/interface/book/character_sheet/buttons_carac/icone_intel");
			ITC.Set("ic_intuition", "graph/interface/book/character_sheet/buttons_carac/icone_intuition");
			ITC.Set("ic_mecanism", "graph/interface/book/character_sheet/buttons_carac/icone_mecanism");
			ITC.Set("ic_object_knowledge", "graph/interface/book/character_sheet/buttons_carac/icone_obj_knowledge");
			ITC.Set("ic_projectile", "graph/interface/book/character_sheet/buttons_carac/icone_projectile");
			ITC.Set("ic_stealth", "graph/interface/book/character_sheet/buttons_carac/icone_stealth");
			ITC.Set("ic_strength", "graph/interface/book/character_sheet/buttons_carac/icone_strenght");

			ITC.Set("questbook", "graph/interface/book/questbook");
			ITC.Set("ptexspellbook", "graph/interface/book/spellbook");
			ITC.Set("bookmark_char", "graph/interface/book/bookmark_char");
			ITC.Set("bookmark_magic", "graph/interface/book/bookmark_magic");
			ITC.Set("bookmark_map", "graph/interface/book/bookmark_map");
			ITC.Set("bookmark_quest", "graph/interface/book/bookmark_quest");

			ITC.Set("accessible_1", "graph/interface/book/accessible/accessible_1");
			ITC.Set("accessible_2", "graph/interface/book/accessible/accessible_2");
			ITC.Set("accessible_3", "graph/interface/book/accessible/accessible_3");
			ITC.Set("accessible_4", "graph/interface/book/accessible/accessible_4");
			ITC.Set("accessible_5", "graph/interface/book/accessible/accessible_5");
			ITC.Set("accessible_6", "graph/interface/book/accessible/accessible_6");
			ITC.Set("accessible_7", "graph/interface/book/accessible/accessible_7");
			ITC.Set("accessible_8", "graph/interface/book/accessible/accessible_8");
			ITC.Set("accessible_9", "graph/interface/book/accessible/accessible_9");
			ITC.Set("accessible_10", "graph/interface/book/accessible/accessible_10");
			ITC.Set("current_1", "graph/interface/book/current_page/current_1");
			ITC.Set("current_2", "graph/interface/book/current_page/current_2");
			ITC.Set("current_3", "graph/interface/book/current_page/current_3");
			ITC.Set("current_4", "graph/interface/book/current_page/current_4");
			ITC.Set("current_5", "graph/interface/book/current_page/current_5");
			ITC.Set("current_6", "graph/interface/book/current_page/current_6");
			ITC.Set("current_7", "graph/interface/book/current_page/current_7");
			ITC.Set("current_8", "graph/interface/book/current_page/current_8");
			ITC.Set("current_9", "graph/interface/book/current_page/current_9");
			ITC.Set("current_10", "graph/interface/book/current_page/current_10");

			ITC.Set("ptexcursorredist", "graph/interface/cursors/add_points");

			ITC.Level = getLocalised("system_charsheet_player_lvl");
			ITC.Xp = getLocalised("system_charsheet_player_xp");

			ANIM_Set(&player.bookAnimation[0], herowaitbook);
			player.bookAnimation[0].flags |= EA_LOOP;

			ARXOldTimeMenu = ARXTimeMenu = arxtime.get_updated();
			ARXDiffTimeMenu = 0;
		}

		GRenderer->SetRenderState(Renderer::Fog, false);
		GRenderer->SetRenderState(Renderer::AlphaBlending, false);

		if(ARXmenu.mda->BookBackground != NULL) {
			GRenderer->SetRenderState(Renderer::AlphaBlending, false);
			GRenderer->SetRenderState(Renderer::Fog, false);
			GRenderer->SetRenderState(Renderer::DepthWrite, false);
			GRenderer->SetRenderState(Renderer::DepthTest, false);

			EERIEDrawBitmap2(0, 0, static_cast<float>(g_size.width()), static_cast<float>(g_size.height()), 0.9f, ARXmenu.mda->BookBackground, Color::white);
		}

		BOOKZOOM = 1;

		ARX_INTERFACE_ManageOpenedBook();


		if(ARXmenu.mda) {
			long DONE = 0;

			if(player.Skill_Redistribute == 0 && player.Attribute_Redistribute == 0)
				DONE = 1;

			float ox, oy;
			ox = Xratio;
			oy = Yratio;
			LASTBOOKBUTTON = BOOKBUTTON;
			BOOKBUTTON = EERIEMouseButton;
			Xratio = ox;
			Yratio = oy;

			if(!ARXmenu.mda->flyover[FLYING_OVER].empty() ) //=ARXmenu.mda->flyover[FLYING_OVER];
			{
				if(FLYING_OVER != OLD_FLYING_OVER) {

					float fRandom = rnd() * 2;

					int t = checked_range_cast<int>(fRandom);

					pTextManage->Clear();
					OLD_FLYING_OVER = FLYING_OVER;
					UNICODE_ARXDrawTextCenteredScroll(hFontInGame,
						(g_size.width() * 0.5f),
						12,
						(g_size.center().x) * 0.82f,
						ARXmenu.mda->flyover[FLYING_OVER],
						Color(232 + t, 204 + t, 143 + t),
						1000,
						0.01f,
						2);
				}
			} else {
				OLD_FLYING_OVER = -1;
			}
			
			float fPosX = 0;
			float fPosY = 313 * Yratio + (g_size.height() - 313 * Yratio) * 0.70f;

			float fSizeX = 100 * Xratio;
			float fSizeY = 100 * Yratio;

			Color color = Color::none;

			//---------------------------------------------------------------------
			// Button QUICK GENERATION
			fPosX = (g_size.width() - (513 * Xratio)) * 0.5f;

			if(MouseInRect(fPosX, fPosY, fPosX + fSizeX + 50, fPosY + fSizeY)) {
				SpecialCursor = CURSOR_INTERACTION_ON;
				FLYING_OVER = BUTTON_QUICK_GENERATION;

				if (EERIEMouseButton & 1) ;
				else if ((!(EERIEMouseButton & 1)) && (LastMouseClick & 1))
				{
					QUICK_MOD++;
					int iSkin = player.skin;
					ARX_MENU_CLICKSOUND();

					if(bQuickGenFirstClick) {
						ARX_PLAYER_MakeAverageHero();
						bQuickGenFirstClick = false;
					} else {
						ARX_PLAYER_QuickGeneration();
					}

					player.skin = checked_range_cast<char>(iSkin);
				}

				color = Color(255, 255, 255);
			}
			else
				color = Color(232, 204, 143);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_quickgen, static_cast<long>(fPosX), static_cast<long>(fPosY), color);

			//---------------------------------------------------------------------
			// Button SKIN
			fPosX = g_size.width() * 0.5f;

			if(MouseInRect(fPosX, fPosY, fPosX + fSizeX, fPosY + fSizeY)) {
				SpecialCursor = CURSOR_INTERACTION_ON;
				FLYING_OVER = BUTTON_SKIN;

				if(!(EERIEMouseButton & 1) && (LastMouseClick & 1)) {
					SKIN_MOD++;
					BOOKZOOM = 1;
					ARX_MENU_CLICKSOUND();
					player.skin++;

					if(player.skin > 3)
						player.skin = 0;

					ARX_PLAYER_Restore_Skin();
				}

				color = Color(255, 255, 255);
			}
			else
				color = Color(232, 204, 143);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_skin, static_cast<long>(fPosX), static_cast<long>(fPosY), color);

			//---------------------------------------------------------------------
			// Button DONE
			fPosX = g_size.width() - (g_size.width() - 513 * Xratio) * 0.5f - 40 * Xratio;

			if(MouseInRect(fPosX, fPosY, fPosX + fSizeX, fPosY + fSizeY)) {
				if(DONE)
					SpecialCursor = CURSOR_INTERACTION_ON;

				FLYING_OVER = BUTTON_DONE;

				if(DONE && !(EERIEMouseButton & 1) && (LastMouseClick & 1)) {
					if(SKIN_MOD == 8 && QUICK_MOD == 10) {
						SKIN_MOD = -2;
					} else if(SKIN_MOD == -1) {
						ARX_PLAYER_MakeSpHero();
						player.skin = 4;
						ARX_PLAYER_Restore_Skin();
						SKIN_MOD = 0;
						SP_HEAD = 1;
					} else {
						if(SP_HEAD) {
							player.skin = 4;
							ARX_PLAYER_Restore_Skin();
							SP_HEAD = 0;
						}

						ARX_MENU_CLICKSOUND();

						bFadeInOut = true;		//fade out
						bFade = true;			//active le fade
						iFadeAction = AMCM_OFF;
					}
				} else {
					if(DONE)
						color = Color(255, 255, 255);
					else
						color = Color(192, 192, 192);
				}
			} else {
				if(DONE)
					color = Color(232, 204, 143);
				else
					color = Color(192, 192, 192);
			}

			if(SKIN_MOD < 0)
				color = Color(255, 0, 255);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_done, static_cast<long>(fPosX), static_cast<long>(fPosY), color);
		}
	}

	DynLight[0].pos.x = 0.f + GInput->getMousePosAbs().x - (g_size.width() >> 1);
	DynLight[0].pos.y = 0.f + GInput->getMousePosAbs().y - (g_size.height() >> 1);

	if(pTextManage) {
		pTextManage->Update(framedelay);
		pTextManage->Render();
	}

	if(ARXmenu.currentmode != AMCM_CREDITS)
		ARX_INTERFACE_RenderCursor(1);

	if(ARXmenu.currentmode == AMCM_NEWQUEST) {
		if(ProcessFadeInOut(bFadeInOut, 0.1f)) {
			switch(iFadeAction) {
				case AMCM_OFF:
					arxtime.resume();
					ARX_MENU_NEW_QUEST_Clicked_QUIT();
					iFadeAction = -1;
					bFade = false;
					fFadeInOut = 0.f;

					if(pTextManage)
						pTextManage->Clear();

					break;
			}
		}
	}

	GRenderer->EndScene();
	return true;
}