// // 初始化 // VOID CSceneNode::Identity(VOID) { m_bNeedUpdateAABB = TRUE; m_bNeedUpdateTransform = TRUE; Vec3Set(&m_localScale, 1.0f, 1.0f, 1.0f); Vec3Set(&m_localPosition, 0.0f, 0.0f, 0.0f); QuatSet(&m_localOrientation, 0.0f, 0.0f, 0.0f, 1.0f); MtxIdentity(&m_mtxLocal); }
// // 设置本地朝向 // VOID CSceneNode::SetWorldDirection(FLOAT x, FLOAT y, FLOAT z, FLOAT upx, FLOAT upy, FLOAT upz) { VEC3 up; VEC3 direction; QUAT worldOrientation; Vec3Set(&up, upx, upy, upz); Vec3Set(&direction, x, y, z); QuatDefLookAt(&worldOrientation, &direction, &up); SetWorldOrientation(worldOrientation[0], worldOrientation[1], worldOrientation[2], worldOrientation[3]); }
// // 设置本地朝向 // VOID CSceneNode::SetLocalDirection(FLOAT x, FLOAT y, FLOAT z, FLOAT upx, FLOAT upy, FLOAT upz) { m_bNeedUpdateAABB = TRUE; m_bNeedUpdateTransform = TRUE; VEC3 up; VEC3 direction; Vec3Set(&up, upx, upy, upz); Vec3Set(&direction, x, y, z); QuatDefLookAt(&m_localOrientation, &direction, &up); }
// // 设置本地位置 // VOID CSceneNode::SetLocalPosition(FLOAT x, FLOAT y, FLOAT z) { m_bNeedUpdateAABB = TRUE; m_bNeedUpdateTransform = TRUE; Vec3Set(&m_localPosition, x, y, z); }
// // 影响粒子 // 注意: 只影响从KeepLocal=TRUE 到 KeepLocal=FALSE // VOID CAffectorKeepLocal::Affect(CParticle *pParticle, FLOAT deltaTime) { if (IsCanAffect(pParticle)) { if (pParticle->bKeepLocal && m_bKeepLocal == FALSE) { const VEC3 *parentWorldScale = pParticle->pEmitter->GetWorldScale(); const VEC3 *parentWorldPosition = pParticle->pEmitter->GetWorldPosition(); const QUAT *parentWorldOrientation = pParticle->pEmitter->GetWorldOrientation(); QuatMul(&pParticle->localOrientation, &pParticle->localOrientation, parentWorldOrientation); VEC3 scalePosition; VEC3 scaleOrientationPosition; Vec3Mul(&scalePosition, &pParticle->localPosition, parentWorldScale); Vec3MulQuat(&scaleOrientationPosition, &scalePosition, parentWorldOrientation); Vec3Add(&pParticle->localPosition, &scaleOrientationPosition, parentWorldPosition); FLOAT velocity = Vec3Normalize(&pParticle->localVelocity); VEC3 localDirection; Vec3Set(&localDirection, 0.0f, 0.0f, 1.0f); Vec3MulQuat(&pParticle->localVelocity, &localDirection, &pParticle->localOrientation); Vec3Normalize(&pParticle->localVelocity); Vec3Scale(&pParticle->localVelocity, &pParticle->localVelocity, velocity); Vec3Mul(&pParticle->localVelocity, &pParticle->localVelocity, parentWorldScale); pParticle->bKeepLocal = FALSE; } } }
Weapon* CreateWeapon(char* weaponName, char* weaponTexture, int weaponType, int weaponRarity, int collisionGroup, float width, float height) { Weapon *CurrentWeapon = AddWeapon(); Vec3 TextTint; int nameLen, statsLen; Vec3Set(&TextTint, 0, 0, 0); CurrentWeapon->WeaponFOF = PlayerWeapon; // Friend or Foe tag CurrentWeapon->objID = GetObjectID(); CurrentWeapon->WeaponRarity = weaponRarity; CurrentWeapon->WeaponType = weaponType; CurrentWeapon->WeaponName = (char *) CallocMyAlloc(MAX_NAME_LENGTH, sizeof(char)); CurrentWeapon->WeaponStatsString = (char *) CallocMyAlloc(MAX_NAME_LENGTH, sizeof(char)); SetWeaponStats(CurrentWeapon, 0, 0, 0); if(CurrentWeapon->WeaponName) strcpy(CurrentWeapon->WeaponName, weaponName); else CurrentWeapon->WeaponName = "Error: Memory Allocation Failed!"; CurrentWeapon->WeaponGlyphs = CreateText(CurrentWeapon->WeaponName, CurrentWeapon->WeaponPickup.Position.x, CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f + 25, 50, TextTint, Center, Plain); CreateStatsString(CurrentWeapon->WeaponStatsString, CurrentWeapon->BonusStrength, CurrentWeapon->BonusAgility, CurrentWeapon->BonusDefense); CurrentWeapon->WeaponStatsGlyphs = CreateText(CurrentWeapon->WeaponStatsString, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f - 25), 50, TextTint, Center, Plain); ChangeTextZIndex(CurrentWeapon->WeaponGlyphs, 451); ChangeTextZIndex(CurrentWeapon->WeaponStatsGlyphs, 451); CurrentWeapon->WeaponSprite = (Sprite *) CreateSprite(weaponTexture, 256, 256, 22, 1, 1, 0, 0); CreateCollisionBox(&CurrentWeapon->WeaponPickup, &CurrentWeapon->Position, WeaponDrop, width / 2, height, CurrentWeapon->objID); CreateCollisionBox(&CurrentWeapon->WeaponAttack, &CurrentWeapon->Position, collisionGroup, height / 4, height / 4, CurrentWeapon->objID); CurrentWeapon->WeaponLength = 80.0f; nameLen = strlen(CurrentWeapon->WeaponName); statsLen = strlen(CurrentWeapon->WeaponStatsString); if(nameLen >= statsLen) { CurrentWeapon->WeaponHoverBackground = (Sprite *) CreateSprite("TextureFiles/WeaponHoverBackground.png", nameLen * 25.0f, 180, 450, 1, 1, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f - 2 * CurrentWeapon->WeaponGlyphs->Glyph->Height)); } else { CurrentWeapon->WeaponHoverBackground = (Sprite *) CreateSprite("TextureFiles/WeaponHoverBackground.png", statsLen * 25.0f, 180, 450, 1, 1, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f - 2 * CurrentWeapon->WeaponGlyphs->Glyph->Height)); } CurrentWeapon->WeaponHoverBackground->Visible = FALSE; //Start off shopless CurrentWeapon->CurrentShop = NULL; CurrentWeapon->WeaponFalling = FALSE; return CurrentWeapon; }
void InitializeLevel(void) { Vec3 TextTint; ResetObjectList(); ResetCamera(); // Initialize the player InitializePlayer(&CurrentPlayer, Mayple, 0, -220); CurrentPlayer.PlayerCollider.Position = CurrentPlayer.Position; Vec3Set(&TextTint, 1, 1, 1); LevelName = CreateText("Level 4", 0, 300, 100, TextTint, Center, Border); ChangeTextVisibility(LevelName); }
// // 设置世界缩放 // VOID CSceneNode::SetWorldScale(FLOAT x, FLOAT y, FLOAT z) { if (m_pParentNode) { // 算法: // worldScale = localScale * parentScale // localScale = worldScale / parentScale VEC3 localScale; VEC3 worldScale; Vec3Set(&worldScale, x, y, z); Vec3Div(&localScale, &worldScale, m_pParentNode->GetWorldScale()); x = localScale[0]; y = localScale[1]; z = localScale[2]; } SetLocalScale(x, y, z); }
// // 设置世界位置 // VOID CSceneNode::SetWorldPosition(FLOAT x, FLOAT y, FLOAT z) { if (m_pParentNode) { // 算法: // worldPosition = localPosition * parentMatrix; // localPosition = worldPosition * parentMatrixInv; MATRIX4 mtxParentInv; MtxInverse(&mtxParentInv, m_pParentNode->GetWorldMatrix()); VEC3 localPosition; VEC3 worldPosition; Vec3Set(&worldPosition, x, y, z); Vec3MulMtx4x4(&localPosition, &worldPosition, &mtxParentInv); x = localPosition[0]; y = localPosition[1]; z = localPosition[2]; } SetLocalPosition(x, y, z); }
// // 更新 // VOID CGfxBillboard::Update(const CEntityCamera *pCamera, CParticle *pParticleList, INT numParticles) { // // 1. 参数安全检查 // if (pCamera == NULL || pParticleList == NULL || numParticles <= 0) { return; } // // 2. 更新相机矩阵 // if (m_directionType == DIRECTION_CAMERA) { VEC3 direction; VEC3 position, up, target; Vec3Scale(&direction, pCamera->GetForwardDirection(), -1.0f); Vec3Set(&up, 0.0f, 1.0f, 0.0f); Vec3Set(&position, 0.0f, 0.0f, 0.0f); Vec3Ma(&target, &position, &direction, 1.0f); MtxDefLookAt(&m_mtxFaceToCamera, &position, &up, &target); } // // 3. 更新粒子数据 // VERTEX *vertices = (VERTEX *)SAFE_MALLOC(4 * numParticles * sizeof(*vertices), MEMTYPE_STACK); { // Billboard // 0 ___ 3 // | | // |___| // 1 2 INT indexVertex = 0; CParticle *pParticle = pParticleList; while (pParticle) { const VEC3 *parentWorldScale = pParticle->pEmitter->GetWorldScale(); const VEC3 *parentWorldPosition = pParticle->pEmitter->GetWorldPosition(); const QUAT *parentWorldOrientation = pParticle->pEmitter->GetWorldOrientation(); // // 1. 计算粒子位置与朝向 // VEC3 scale; VEC3 position; QUAT orientation; if (pParticle->bKeepLocal && pParticle->pEmitter) { Vec3Mul(&scale, &pParticle->localScale, parentWorldScale); if (m_directionType == DIRECTION_FIXED) { QuatMul(&orientation, &pParticle->localOrientation, parentWorldOrientation); } VEC3 scalePosition; VEC3 scaleOrientationPosition; Vec3Mul(&scalePosition, &pParticle->localPosition, parentWorldScale); Vec3MulQuat(&scaleOrientationPosition, &scalePosition, parentWorldOrientation); Vec3Add(&position, &scaleOrientationPosition, parentWorldPosition); } else { Vec3Copy(&scale, &pParticle->localScale); if (m_directionType == DIRECTION_FIXED) { QuatCopy(&orientation, &pParticle->localOrientation); } Vec3Copy(&position, &pParticle->localPosition); } // // 2. 粒子位置偏移量 // MATRIX4 mtxOrientation; if (m_directionType == DIRECTION_CAMERA) { MtxCopy(&mtxOrientation, &m_mtxFaceToCamera); if (m_offset < -EPSILON_E3 || m_offset > EPSILON_E3) { VEC3 offsetDirection; Vec3Sub(&offsetDirection, pCamera->GetPosition(), &position); Vec3Normalize(&offsetDirection); Vec3Ma(&position, &position, &offsetDirection, m_offset); } } else { QuatToMtxRotation(&mtxOrientation, &orientation); if (m_offset < -EPSILON_E3 || m_offset > EPSILON_E3) { VEC3 localDirection; VEC3 offsetDirection; Vec3Set(&localDirection, 0.0f, 0.0f, 1.0f); Vec3MulQuat(&offsetDirection, &localDirection, &orientation); Vec3Normalize(&offsetDirection); Vec3Ma(&position, &position, &offsetDirection, m_offset); } } // // 3. 计算粒子变换矩阵 // MATRIX4 mtxScale; MATRIX4 mtxRotate; MATRIX4 mtxRotateSelf; MATRIX4 mtxTranslate; MtxDefScale(&mtxScale, scale[0], scale[1], scale[2]); MtxDefTranslate(&mtxTranslate, position[0], position[1], position[2]); MtxDefRotateAxisAngle(&mtxRotateSelf, &axisz, pParticle->radian); MtxMul(&mtxRotate, &mtxRotateSelf, &mtxOrientation); MATRIX4 mtxSR; MATRIX4 mtxTransform; MtxMul(&mtxSR, &mtxScale, &mtxRotate); MtxMul(&mtxTransform, &mtxSR, &mtxTranslate); // // 4. 计算粒子纹理矩阵 // MATRIX4 mtxTexScale; MATRIX4 mtxTexTranslate; MATRIX4 mtxTexTransform; MtxDefScale(&mtxTexScale, pParticle->texSequenceScale[0], pParticle->texSequenceScale[1], 1.0f); MtxDefTranslate(&mtxTexTranslate, pParticle->texSequenceOffset[0] + pParticle->texScrollOffset[0], pParticle->texSequenceOffset[1] + pParticle->texScrollOffset[1], 0.0f); MtxMul(&mtxTexTransform, &mtxTexScale, &mtxTexTranslate); // // 5. 计算粒子顶点 // VEC3 desVertices[4]; VEC3 srcVertices[4] = { VEC3(-1.0f, 1.0f, 0.0f), VEC3(-1.0f, -1.0f, 0.0f), VEC3( 1.0f, -1.0f, 0.0f), VEC3( 1.0f, 1.0f, 0.0f), }; VEC2 texCoords[4] = { VEC2(pParticle->uvOffset[0] + 0.0f, pParticle->uvOffset[1] + 0.0f), VEC2(pParticle->uvOffset[0] + 0.0f, pParticle->uvOffset[1] + 1.0f), VEC2(pParticle->uvOffset[0] + 1.0f, pParticle->uvOffset[1] + 1.0f), VEC2(pParticle->uvOffset[0] + 1.0f, pParticle->uvOffset[1] + 0.0f), }; VEC3 localNormal, localBinormal; VEC3 worldNormal, worldBinormal; Vec3Set(&localNormal, 0.0f, 0.0f, 1.0f); Vec3Set(&localBinormal, 1.0f, 0.0f, 0.0f); Vec3MulMtx3x3(&worldNormal, &localNormal, &mtxTransform); Vec3MulMtx3x3(&worldBinormal, &localBinormal, &mtxTransform); Vec3MulMtx4x4(&desVertices[0], &srcVertices[0], &mtxTransform); Vec3MulMtx4x4(&desVertices[1], &srcVertices[1], &mtxTransform); Vec3MulMtx4x4(&desVertices[2], &srcVertices[2], &mtxTransform); Vec3MulMtx4x4(&desVertices[3], &srcVertices[3], &mtxTransform); Vec3Copy(&vertices[indexVertex].position, &desVertices[0]); Vec3Copy(&vertices[indexVertex].normal, &worldNormal); Vec3Copy(&vertices[indexVertex].binormal, &worldBinormal); Vec4Copy(&vertices[indexVertex].color, &pParticle->color); Vec2MulMtx4x4(&vertices[indexVertex].texCoordDiffuse, &texCoords[0], &mtxTexTransform); indexVertex++; Vec3Copy(&vertices[indexVertex].position, &desVertices[1]); Vec3Copy(&vertices[indexVertex].normal, &worldNormal); Vec3Copy(&vertices[indexVertex].binormal, &worldBinormal); Vec4Copy(&vertices[indexVertex].color, &pParticle->color); Vec2MulMtx4x4(&vertices[indexVertex].texCoordDiffuse, &texCoords[1], &mtxTexTransform); indexVertex++; Vec3Copy(&vertices[indexVertex].position, &desVertices[2]); Vec3Copy(&vertices[indexVertex].normal, &worldNormal); Vec3Copy(&vertices[indexVertex].binormal, &worldBinormal); Vec4Copy(&vertices[indexVertex].color, &pParticle->color); Vec2MulMtx4x4(&vertices[indexVertex].texCoordDiffuse, &texCoords[2], &mtxTexTransform); indexVertex++; Vec3Copy(&vertices[indexVertex].position, &desVertices[3]); Vec3Copy(&vertices[indexVertex].normal, &worldNormal); Vec3Copy(&vertices[indexVertex].binormal, &worldBinormal); Vec4Copy(&vertices[indexVertex].color, &pParticle->color); Vec2MulMtx4x4(&vertices[indexVertex].texCoordDiffuse, &texCoords[3], &mtxTexTransform); indexVertex++; pParticle = pParticle->pNext; } Renderer()->BindVBO(GL_ARRAY_BUFFER, m_vbo); Renderer()->UpdateVBO(GL_ARRAY_BUFFER, 0, 4 * numParticles * sizeof(*vertices), vertices); } SAFE_FREE(vertices); }
void InitializeMainMenu(void) { FILE *fp; Vec3 Tint; float xPos, yPos; //Animation variables initialize firstAnimated = TRUE; secondAnimated = FALSE; fadeOut = FALSE; firstMoveTimer = 0; secondMoveTimer = 0; firstStartLocation = rand() % 4; secondStartLocation = rand() % 4; firstTextureNum = MAX_TEXTURES + 1; secondTextureNum = MAX_TEXTURES + 1; // Reset the object list ResetObjectList(); deleteSave = FALSE; exitGame = FALSE; //Check if it is possible to load a game fp = fopen(GameData, "r"); if(fp) { canLoad = TRUE; fclose(fp); } else { canLoad = FALSE; } //Grabs the first starting location SetStartLocation(&xPos, &yPos, firstStartLocation); FirstBackground = (Sprite *) CreateSprite("TextureFiles/BlurFoxHall.png", 2560, 1440, 1, 1, 1, xPos, yPos); SecondBackground = (Sprite *) CreateSprite("TextureFiles/BlurFoxMansion.png", 2560, 1440, 1, 1, 1, xPos, yPos); //Randomizes the textures for the animation firstTextureNum = RandomNewTexture(FirstBackground, secondTextureNum); secondTextureNum = RandomNewTexture(SecondBackground, firstTextureNum); //Second background should not be seen SecondBackground->Alpha = 0.0f; //Nice looking things for the menu Overlay = (Sprite *) CreateSprite("TextureFiles/MenuOverlay.png", 1920, 1080, 2, 1, 1, 0, 0); Logo = (Sprite *) CreateSprite("TextureFiles/MansionMashersMainMenu.png", 1200, 675, 3, 1, 1, 0, 200); //Button backgrounds FoxScroll = (Sprite *) CreateSprite("TextureFiles/MenuBackFoxAnimationFix.png", 447, 500, 4, 18, 1, -300, -130); FoxScroll->AnimationSpeed = 2.0f; DogScroll = (Sprite *) CreateSprite("TextureFiles/MenuBackDogAnimationFix.png", 447, 500, 4, 18, 1, 300, -130); DogScroll->AnimationSpeed = 2.0f; //Sets the frame that the scrolls are on. prevFrame = FoxScroll->CurrentFrame; FoxScrollBottom = (Sprite *) CreateSprite("TextureFiles/ScrollBottom.png", 447, 44, 9, 1, 1, -300, 60); DogScrollBottom = (Sprite *) CreateSprite("TextureFiles/ScrollBottom.png", 447, 44, 9, 1, 1, 300, 60); //Menu buttons NewGameButton = CreateButton("TextureFiles/NewGameButton.png", 0, -130, 394, 394); LoadGameButton = CreateButton("TextureFiles/LoadGameButton.png", -290, -8, 439, 170); OptionsButton = CreateButton("TextureFiles/OptionsButton.png", 290, -8, 439, 170); CreditsButton = CreateButton("TextureFiles/CreditsButton.png", -290, -270, 439, 170); QuitGameButton = CreateButton("TextureFiles/QuitGameButton.png", 290, -270, 439, 170); //Update button Z index NewGameButton->ButtonSprite->ZIndex = 10; LoadGameButton->ButtonSprite->ZIndex = 8; OptionsButton->ButtonSprite->ZIndex = 8; CreditsButton->ButtonSprite->ZIndex = 8; QuitGameButton->ButtonSprite->ZIndex = 8; OptionsButton->ButtonSprite->Visible = FALSE; QuitGameButton->ButtonSprite->Visible = FALSE; CreditsButton->ButtonSprite->Visible = FALSE; LoadGameButton->ButtonSprite->Visible = FALSE; //Delete save game objects Vec3Set(&Tint, 0, 0, 0); BlackBackground = (Sprite *) CreateSprite("TextureFiles/BlankPlatform.png", 1920, 1080, 499, 1, 1, 0, 0); BlackBackground->Tint = Tint; BlackBackground->Alpha = 0.5f; DeleteText = (Sprite *) CreateSprite("TextureFiles/DeleteText.png", 651, 334, 500, 1, 1, 0, 100); YesButton = CreateButton("TextureFiles/DeleteButton.png", -300, -200, 400, 150); YesButton->ButtonSprite->ZIndex = 500; NoButton = CreateButton("TextureFiles/BackButton.png", 300, -200, 400, 150); NoButton->ButtonSprite->ZIndex = 500; //Exit Game Confirmation Vec3Set(&Tint, 0, 0, 0); ExitConfirm = (Sprite *) CreateSprite("TextureFiles/ExitConfirm.png", 639, 204, 500, 1, 1, 0, 100); ExitButton = CreateButton("TextureFiles/ExitButton.png", -300, -200, 400, 150); ExitButton->ButtonSprite->ZIndex = 500; //Should not be visible at the start BlackBackground->Visible = FALSE; DeleteText->Visible = FALSE; ExitConfirm->Visible = FALSE; YesButton->ButtonSprite->Visible = FALSE; NoButton->ButtonSprite->Visible = FALSE; ExitButton->ButtonSprite->Visible = FALSE; //Help out text GettingImpatientTimer = -2.5; TimerGoingUp = TRUE; Vec3Set(&Tint, 1, 1, 1); SillyGooseUseMouse = CreateText("Use the mouse to navigate the menu!", 0, -480, 100, Tint, Center, Border); ChangeTextZIndex(SillyGooseUseMouse, 600); ChangeTextAlpha(SillyGooseUseMouse, 0); ChangeTextVisibility(SillyGooseUseMouse); CreateBoundingBoxes(); // Set camera to (0,0) ResetCamera(); //Basically don't remake the sound because we only went to the options menu and came back if(GetPreviousState() != GS_Options) CreatePauseSound(&MenuBackSnd, "Sounds/MenuTheme.mp3", LargeSnd); }
void InitializePause(void (*DrawLevel)()) { float camX; Vec3 TextColor; CreatePauseSound(&BackgroundSnd, "Sounds/ShopTheme.mp3", LargeSnd); volumestring = (char *)MallocMyAlloc(5, sizeof(char)); volumestring[0] = '1'; volumestring[1] = '0'; volumestring[2] = '0'; volumestring[3] = (char)'%%'; volumestring[4] = '\0'; camX = GetCameraXPosition(); //printf("%f\n", camX); pause = TRUE; PauseText = (Sprite *) CreateSprite("TextureFiles/Paused.png", 450, 156, 4000, 1, 1, camX, 420); //Background Vec3Set(&TextColor, 0, 0, 0); PauseBackground = (Sprite *) CreateSprite("TextureFiles/BlankPlatform.png", 1920, 1080, 1499, 1, 1, camX, 0); PauseBackground->Alpha = 0.5; PauseBackground->Tint = TextColor; //Volume sliders SFXSliderGuide = (Sprite *) CreateSprite("TextureFiles/VolumeSliderGuide.png", 492, 92, 4001, 1, 1, camX, 200); BGMSliderGuide = (Sprite *) CreateSprite("TextureFiles/VolumeSliderGuide.png", 492, 92, 4001, 1, 1, camX, 0); SFXSliderBack = (Sprite *) CreateSprite("TextureFiles/VolumeSliderBack.png", 552, 152, 4000, 1, 1, camX, 200); BGMSliderBack = (Sprite *) CreateSprite("TextureFiles/VolumeSliderBack.png", 552, 152, 4000, 1, 1, camX, 0); SFXSliderPos = SFXSliderGuide->Position.x - SFXSliderGuide->Width / 2 + SFXSliderGuide->Width * SFXVolume; BGMSliderPos = BGMSliderGuide->Position.x - BGMSliderGuide->Width / 2 + BGMSliderGuide->Width * BGMVolume; SFXSlider = CreateButton("TextureFiles/fox_head.png", SFXSliderPos, 200, 80, 80); SFXSlider->ButtonSprite->ZIndex = 4002; SFXSlider->ButtonCollider.width *= 3; SFXSlider->ButtonCollider.height = SFXSliderBack->Height; BGMSlider = CreateButton("TextureFiles/fox_head.png", BGMSliderPos, 0, 80, 80); BGMSlider->ButtonSprite->ZIndex = 4002; BGMSlider->ButtonCollider.width *= 3; BGMSlider->ButtonCollider.height = BGMSliderBack->Height; Vec3Set(&TextColor, 1, 1, 1); SFXText = CreateText(volumestring, (SFXSliderBack->Position.x + (SFXSliderBack->Width / 2)) + 50, 200, 100, TextColor, Left, Border); volumestring = VolumetoString(volumestring, SFXVolume * 100); volumestring = strcat(volumestring, "%"); ChangeTextString(SFXText, volumestring); ChangeTextZIndex(SFXText, 4010); BGMText = CreateText(volumestring, (BGMSliderBack->Position.x + (BGMSliderBack->Width / 2)) + 50, 0, 100, TextColor, Left, Border); volumestring = VolumetoString(volumestring, BGMVolume * 100); volumestring = strcat(volumestring, "%"); ChangeTextString(BGMText, volumestring); ChangeTextZIndex(BGMText, 4010); ChangeTextVisibility(SFXText); ChangeTextVisibility(BGMText); //Cheats check mark EnableCheats = (Sprite *) CreateSprite("TextureFiles/EnableCheats.png", 592, 106.4f, 4000, 1, 1, 180 + camX, -150); CheatsButton = CreateButton("TextureFiles/CheckBox.png", -250 + camX, -150, 100, 100); CheatsButton->ButtonSprite->ZIndex = 4000; UpdateCollider(&CheatsButton->ButtonCollider, 800, CheatsButton->ButtonCollider.height); CheatsButton->ButtonCollider.Position.x = camX + 100; CheckMark = (Sprite *) CreateSprite("TextureFiles/CheckMark.png", 200, 200, 4001, 1, 1, -250 + camX, -150); if(!Cheats) CheckMark->Visible = FALSE; //Look at mouse check mark EnableLookAt = (Sprite *) CreateSprite("TextureFiles/FaceMouse.png", 592, 106.4f, 4000, 1, 1, 180 + camX, -280); LookAtButton = CreateButton("TextureFiles/CheckBox.png", -250 + camX, -280, 100, 100); LookAtButton->ButtonSprite->ZIndex = 4000; UpdateCollider(&LookAtButton->ButtonCollider, 800, LookAtButton->ButtonCollider.height); LookAtButton->ButtonCollider.Position.x = camX + 100; LookAtCheckMark = (Sprite *) CreateSprite("TextureFiles/CheckMark.png", 200, 200, 4001, 1, 1, -250 + camX, -280); if(!LookAtMouse) LookAtCheckMark->Visible = FALSE; LevelToDraw = DrawLevel; SFXLabel = CreateText("SFX", SFXSliderBack->Position.x - SFXSliderBack->Width / 2, 200, 100, TextColor, Right, Border); BGMLabel = CreateText("BGM", BGMSliderBack->Position.x - BGMSliderBack->Width / 2, 0, 100, TextColor, Right, Border); TextAllVisible(SFXLabel); TextAllVisible(BGMLabel); ChangeTextZIndex(SFXLabel, 4003); ChangeTextZIndex(BGMLabel, 4003); // Check if we pause the map level or not if(GetCurrentState() == GS_MapLevel) { ResumeButton = CreateButton("TextureFiles/ResumeButton.png", -250 + camX, -400, 300, 112.5f); MainMenuButton = CreateButton("TextureFiles/MainMenuButton.png", 250 + camX, -400, 300, 112.5f); } else { ResumeButton = CreateButton("TextureFiles/ResumeButton.png", -400 + camX, -400, 300, 112.5f); RestartButton = CreateButton("TextureFiles/RestartButton.png", camX, -400, 300, 112.5f); RestartButton->ButtonSprite->ZIndex = 4002; MainMenuButton = CreateButton("TextureFiles/GoToMapButton.png", 400 + camX, -400, 300, 112.5f); } ResumeButton->ButtonSprite->ZIndex = 4002; MainMenuButton->ButtonSprite->ZIndex = 4002; if(CurrentPlayer.PlayerActive) { CurrentPlayer.PlayerSpriteParts.Body->AnimationActive = 0; CurrentPlayer.PlayerSpriteParts.Body->CurrentFrame = 0; CurrentPlayer.PlayerSpriteParts.BlinkTimer = 0; } FoxInput_Update(); }
// // 获得光照参数 // BOOL CLightGrid::GetLightParams(DWORD dwChannel, const VEC3 *position, VEC4 *direction, VEC3 *ambient, VEC3 *diffuse, VEC3 *specular, VEC3 *rim, VEC3 *skyLower, VEC3 *skyUpper, VEC3 *indirectUp, VEC3 *indirectDown, VEC3 *indirectLeft, VEC3 *indirectRight, VEC3 *indirectFront, VEC3 *indirectBack) const { ASSERT(position); // // 1. 通道检查 // if ((LIGHT_CHANNEL & dwChannel) == 0) { return FALSE; } // // 2. 获得光照参数 // for (LightVolumeSet::const_iterator itVolume = m_volumes.begin(); itVolume != m_volumes.end(); ++itVolume) { const LIGHT_VOLUME *pVolume = *itVolume; ASSERT(pVolume); if (IsPointInAABB(&pVolume->aabb, (*position)[0], (*position)[1], (*position)[2])) { FLOAT posx = ((*position)[0] - pVolume->aabb.minVertex[0]) / pVolume->stepx; FLOAT posy = ((*position)[1] - pVolume->aabb.minVertex[1]) / pVolume->stepy; FLOAT posz = ((*position)[2] - pVolume->aabb.minVertex[2]) / pVolume->stepz; INT x = FastFloor(posx); INT y = FastFloor(posy); INT z = FastFloor(posz); FLOAT factor; FLOAT factorx = posx - x; FLOAT factory = posy - y; FLOAT factorz = posz - z; VEC3 _direction; VEC3 _ambient; VEC3 _diffuse; VEC3 _indirectUp; VEC3 _indirectDown; VEC3 _indirectLeft; VEC3 _indirectRight; VEC3 _indirectFront; VEC3 _indirectBack; Vec3Zero(&_direction); Vec3Zero(&_ambient); Vec3Zero(&_diffuse); Vec3Zero(&_indirectUp); Vec3Zero(&_indirectDown); Vec3Zero(&_indirectLeft); Vec3Zero(&_indirectRight); Vec3Zero(&_indirectFront); Vec3Zero(&_indirectBack); for (INT xx = 0; xx <= 1; xx++) { factorx = 1.0f - factorx; for (INT yy = 0; yy <= 1; yy++) { factory = 1.0f - factory; for (INT zz = 0; zz <= 1; zz++) { factorz = 1.0f - factorz; factor = factorx * factory * factorz; if (LIGHT_POINT *pLightPoint = &pVolume->pppLightPoints[x + xx][y + yy][z + zz]) { VEC3 __direction; VEC3 __ambient; VEC3 __diffuse; VEC3 __indirectUp; VEC3 __indirectDown; VEC3 __indirectLeft; VEC3 __indirectRight; VEC3 __indirectFront; VEC3 __indirectBack; Vec3LatLongToDirection(&__direction, pLightPoint->direction); Vec3BytesToColor(&__ambient, pLightPoint->ambient); Vec3BytesToColor(&__diffuse, pLightPoint->diffuse); Vec3BytesToColor(&__indirectUp, pLightPoint->indirectup); Vec3BytesToColor(&__indirectDown, pLightPoint->indirectdown); Vec3BytesToColor(&__indirectLeft, pLightPoint->indirectleft); Vec3BytesToColor(&__indirectRight, pLightPoint->indirectright); Vec3BytesToColor(&__indirectFront, pLightPoint->indirectfront); Vec3BytesToColor(&__indirectBack, pLightPoint->indirectback); Vec3Ma(&_direction, &_direction, &__direction, factor); Vec3Ma(&_ambient, &_ambient, &__ambient, factor); Vec3Ma(&_diffuse, &_diffuse, &__diffuse, factor); Vec3Ma(&_indirectUp, &_diffuse, &__indirectUp, factor); Vec3Ma(&_indirectDown, &_diffuse, &__indirectDown, factor); Vec3Ma(&_indirectLeft, &_diffuse, &__indirectLeft, factor); Vec3Ma(&_indirectRight, &_diffuse, &__indirectRight, factor); Vec3Ma(&_indirectFront, &_diffuse, &__indirectFront, factor); Vec3Ma(&_indirectBack, &_diffuse, &__indirectBack, factor); } } } } Vec3Normalize(&_direction); Vec3Clamp(&_ambient); Vec3Clamp(&_diffuse); Vec3Clamp(&_indirectUp); Vec3Clamp(&_indirectDown); Vec3Clamp(&_indirectLeft); Vec3Clamp(&_indirectRight); Vec3Clamp(&_indirectFront); Vec3Clamp(&_indirectBack); static const FLOAT specularFactor = 0.8f; static const FLOAT rimFactor = 0.2f; static const FLOAT skyLowerFactor = 0.2f; static const FLOAT skyUpperFactor = 0.4f; if (direction) Vec4Set(direction, _direction[0], _direction[1], _direction[2], 0.0f); if (ambient) Vec3Set(ambient, _ambient[0], _ambient[1], _ambient[2]); if (diffuse) Vec3Set(diffuse, _diffuse[0], _diffuse[1], _diffuse[2]); if (specular) Vec3Set(specular, specularFactor * _diffuse[0], specularFactor * _diffuse[1], specularFactor * _diffuse[2]); if (rim) Vec3Set(rim, rimFactor * _diffuse[0], rimFactor * _diffuse[1], rimFactor * _diffuse[2]); if (skyLower) Vec3Set(skyLower, skyLowerFactor * _diffuse[0], skyLowerFactor * _diffuse[1], skyLowerFactor * _diffuse[2]); if (skyUpper) Vec3Set(skyUpper, skyUpperFactor * _diffuse[0], skyUpperFactor * _diffuse[1], skyUpperFactor * _diffuse[2]); if (indirectUp) Vec3Set(indirectUp, _indirectUp[0], _indirectUp[1], _indirectUp[2]); if (indirectDown) Vec3Set(indirectDown, _indirectDown[0], _indirectDown[1], _indirectDown[2]); if (indirectLeft) Vec3Set(indirectLeft, _indirectLeft[0], _indirectLeft[1], _indirectLeft[2]); if (indirectRight) Vec3Set(indirectRight, _indirectRight[0], _indirectRight[1], _indirectRight[2]); if (indirectFront) Vec3Set(indirectFront, _indirectFront[0], _indirectFront[1], _indirectFront[2]); if (indirectBack) Vec3Set(indirectBack, _indirectBack[0], _indirectBack[1], _indirectBack[2]); return TRUE; } } return FALSE; }
// // 更新包围盒 // BOOL CSceneNode::UpdateAABB(BOOL bParentUpdate) { BOOL bUpdate = bParentUpdate || m_bNeedUpdateAABB ? TRUE : FALSE; // // 1. 可见性检查 // if (m_bVisible == FALSE) { return FALSE; } // // 2. 初始化包围盒 // BOOL bAABBCurrentValid = FALSE; BOOL bAABBCascadeValid = FALSE; Vec3Set(&m_aabbCurrent.minVertex, FLT_MAX, FLT_MAX, FLT_MAX); Vec3Set(&m_aabbCurrent.maxVertex, -FLT_MAX, -FLT_MAX, -FLT_MAX); Vec3Set(&m_aabbCascade.minVertex, FLT_MAX, FLT_MAX, FLT_MAX); Vec3Set(&m_aabbCascade.maxVertex, -FLT_MAX, -FLT_MAX, -FLT_MAX); // // 3. 更新当前节点包围盒 // if (bUpdate) { if (CEntity *pEntity = m_pEntityHead) { do { if (pEntity->IsRenderable()) { const AABB *pAABB = (pEntity->GetType() == CEntity::LIGHT) ? ((CEntityLight*)pEntity)->GetAABB() : ((CEntityRenderable*)pEntity)->GetAABB(); if (IsAABBValid(pAABB)) { bAABBCurrentValid = TRUE; if (m_aabbCurrent.minVertex[0] > pAABB->minVertex[0]) m_aabbCurrent.minVertex[0] = pAABB->minVertex[0]; if (m_aabbCurrent.minVertex[1] > pAABB->minVertex[1]) m_aabbCurrent.minVertex[1] = pAABB->minVertex[1]; if (m_aabbCurrent.minVertex[2] > pAABB->minVertex[2]) m_aabbCurrent.minVertex[2] = pAABB->minVertex[2]; if (m_aabbCurrent.maxVertex[0] < pAABB->maxVertex[0]) m_aabbCurrent.maxVertex[0] = pAABB->maxVertex[0]; if (m_aabbCurrent.maxVertex[1] < pAABB->maxVertex[1]) m_aabbCurrent.maxVertex[1] = pAABB->maxVertex[1]; if (m_aabbCurrent.maxVertex[2] < pAABB->maxVertex[2]) m_aabbCurrent.maxVertex[2] = pAABB->maxVertex[2]; } } } while (pEntity = pEntity->pNext); if (bAABBCurrentValid) { AABBNormalize(&m_aabbCurrent); Vec3Copy(&m_aabbCascade.minVertex, &m_aabbCurrent.minVertex); Vec3Copy(&m_aabbCascade.maxVertex, &m_aabbCurrent.maxVertex); } else { AABBZero(&m_aabbCurrent); } } } // // 4. 更新子节点包围盒 // if (CSceneNode *pNode = m_pNodeHead) { do { if (pNode->UpdateAABB(bUpdate)) { if (IsAABBValid(&pNode->m_aabbCascade)) { bAABBCascadeValid = TRUE; if (m_aabbCascade.minVertex[0] > pNode->m_aabbCascade.minVertex[0]) m_aabbCascade.minVertex[0] = pNode->m_aabbCascade.minVertex[0]; if (m_aabbCascade.minVertex[1] > pNode->m_aabbCascade.minVertex[1]) m_aabbCascade.minVertex[1] = pNode->m_aabbCascade.minVertex[1]; if (m_aabbCascade.minVertex[2] > pNode->m_aabbCascade.minVertex[2]) m_aabbCascade.minVertex[2] = pNode->m_aabbCascade.minVertex[2]; if (m_aabbCascade.maxVertex[0] < pNode->m_aabbCascade.maxVertex[0]) m_aabbCascade.maxVertex[0] = pNode->m_aabbCascade.maxVertex[0]; if (m_aabbCascade.maxVertex[1] < pNode->m_aabbCascade.maxVertex[1]) m_aabbCascade.maxVertex[1] = pNode->m_aabbCascade.maxVertex[1]; if (m_aabbCascade.maxVertex[2] < pNode->m_aabbCascade.maxVertex[2]) m_aabbCascade.maxVertex[2] = pNode->m_aabbCascade.maxVertex[2]; } } } while (pNode = pNode->pNext); if (bAABBCurrentValid || bAABBCascadeValid) { AABBNormalize(&m_aabbCascade); } else { AABBZero(&m_aabbCascade); } } // // 5. 恢复更新AABB // m_bNeedUpdateAABB = FALSE; return TRUE; }
void CreateUpgradeScreenObjects(void) { float camX = GetCameraXPosition(); Vec3 NewTint; lastUpgrades = -1; UpgradeComplete = FALSE; UpgradesToUpgrade = FALSE; allUpgradesFull = FALSE; //Particle Background HazeBackground = (Sprite *)CreateSprite("TextureFiles/MapHaze.png", 4000, 1080, 4000, 1, 1, 480, -200); HazeBackground->Alpha = 0; SystemOne = CreateFoxParticleSystem("TextureFiles/MapParticle.png", 0, -2000, 4001, -1, 15, 0.5f, 0, 100, 20.0f, 5.0f, 4000, 1080, 50, 2.0f, 2.0f); SystemOne->FadeIn = TRUE; //Title Vec3Set(&NewTint, 1, 1, 1); UpgradesName = CreateText("Upgrades Available!", 0, -2000, 140, NewTint, Center, Border); TextAllVisible(UpgradesName); ChangeTextZIndex(UpgradesName, 4003); //Upgrades remaining Vec3Set(&NewTint, 0.32f, 0.11f, 0.47f); UpgradesLeft = CreateText("Sweg", 0, -2000, 100, NewTint, Center, Border); TextAllVisible(UpgradesLeft); ChangeTextZIndex(UpgradesLeft, 4003); //Overlays Vec3Set(&NewTint, 0, 0, 0); BlackOverlay = (Sprite *) CreateSprite("TextureFiles/BlankPlatform.png", 1920, 1080, 4010, 1, 1, 0, 0); BlackOverlay->Tint = NewTint; BlackOverlay->Alpha = 0; Vec3Set(&NewTint, 0.9f, 0.9f, 0.9f); WhiteOverlay = (Sprite *) CreateSprite("TextureFiles/BlankPlatform.png", 1920, 1080, 3999, 1, 1, 0, 0); WhiteOverlay->Tint = NewTint; WhiteOverlay->Alpha = 0; //Upgrade buttons, all 3 (Not really sure why Agility is in the middle, but that is how the rest of the game is) UpgradeButton1 = CreateButton("TextureFiles/UpgradeButtonStr.png", 545 + camX, -2000, 347, 146); //Strength UpgradeButton1->ButtonSprite->ZIndex = 4003; UpgradeButton2 = CreateButton("TextureFiles/UpgradeButtonAgi.png", 545 + camX, -2000, 347, 146); //Agility UpgradeButton2->ButtonSprite->ZIndex = 4003; UpgradeButton3 = CreateButton("TextureFiles/UpgradeButtonDef.png", 545 + camX, -2000, 347, 146); //Defense UpgradeButton3->ButtonSprite->ZIndex = 4003; //Upgrade bars UpgradeBar1 = (Sprite *) CreateSprite("TextureFiles/UpgradeBar.png", 1920, 1080, 4003, 1, 1, 0, -2000); UpgradeBar2 = (Sprite *) CreateSprite("TextureFiles/UpgradeBar.png", 1920, 1080, 4003, 1, 1, 0, -2000); UpgradeBar3 = (Sprite *) CreateSprite("TextureFiles/UpgradeBar.png", 1920, 1080, 4003, 1, 1, 0, -2000); //Upgrade bar colors UpgradeBarColor1 = (Sprite *) CreateSprite("TextureFiles/UpgradeBarColor.png", 816, 85, 4002, 1, 1, 0, -2000); UpgradeBarColor2 = (Sprite *) CreateSprite("TextureFiles/UpgradeBarColor.png", 816, 85, 4002, 1, 1, 0, -2000); UpgradeBarColor3 = (Sprite *) CreateSprite("TextureFiles/UpgradeBarColor.png", 816, 85, 4002, 1, 1, 0, -2000); //How many upgrades have been used for each skill type Vec3Set(&NewTint, 0.32f, 0.11f, 0.47f); UpgradeAmount1 = CreateText("Swog", 0, -2000, 120, NewTint, Center, Border); TextAllVisible(UpgradeAmount1); ChangeTextZIndex(UpgradeAmount1, 4004); UpgradeAmount2 = CreateText("Swug", 0, -2000, 120, NewTint, Center, Border); TextAllVisible(UpgradeAmount2); ChangeTextZIndex(UpgradeAmount2, 4004); UpgradeAmount3 = CreateText("Swyg", 0, -2000, 120, NewTint, Center, Border); TextAllVisible(UpgradeAmount3); ChangeTextZIndex(UpgradeAmount3, 4004); //Done upgrading button MainMapButton = CreateButton("TextureFiles/GoToMapButton.png", 400 + camX, -2000, 300, 112.5f); MainMapButton->ButtonSprite->ZIndex = 4003; }
Weapon* CreateDroppedWeapon(int weaponType, int weaponRarity, float width, float height, float xPos, float yPos) { Weapon *CurrentWeapon = AddWeapon(); Vec2 ColliderPos; Vec3 TextTint; int nameLen, statsLen; Vec2Set(&ColliderPos, xPos, yPos); Vec3Set(&TextTint, 0, 0, 0); CurrentWeapon->WeaponFOF = DroppedWeapon; // Friend or Foe tag CurrentWeapon->objID = GetObjectID(); CurrentWeapon->WeaponRarity = weaponRarity; CurrentWeapon->WeaponType = weaponType; CurrentWeapon->WeaponName = (char *) CallocMyAlloc(MAX_NAME_LENGTH, sizeof(char)); CurrentWeapon->WeaponStatsString = (char *) CallocMyAlloc(MAX_NAME_LENGTH, sizeof(char)); CurrentWeapon->WeaponLength = 80.0f; if(CurrentWeapon->WeaponName) CreateWeaponName(&CurrentWeapon->WeaponName, CurrentWeapon->WeaponType, CurrentWeapon->WeaponRarity); else CurrentWeapon->WeaponName = "Error: Memory Allocation Failed!"; CreateWeaponStats(CurrentWeapon->WeaponType, CurrentWeapon->WeaponRarity, &CurrentWeapon->BonusStrength, &CurrentWeapon->BonusAgility, &CurrentWeapon->BonusDefense); Vec2Set(&CurrentWeapon->Position, xPos, yPos); CurrentWeapon->WeaponSprite = CreateWeaponSprite(CurrentWeapon->WeaponType, CurrentWeapon->WeaponRarity, xPos, yPos); // Special Weapon!! if (!strcmp(CurrentWeapon->WeaponName,"Sausage Sausage of sausage")) { CurrentWeapon->WeaponSprite->SpriteTexture = LoadTexture("TextureFiles/BattleAxe.png"); CurrentWeapon->WeaponType = Axe; CurrentWeapon->BonusAgility += 12; CurrentWeapon->BonusStrength += 12; CurrentWeapon->BonusDefense += 12; } CreateCollisionBox(&CurrentWeapon->WeaponPickup, &CurrentWeapon->Position, WeaponDrop, width / 2, height, CurrentWeapon->objID); CreateCollisionBox(&CurrentWeapon->WeaponAttack, &CurrentWeapon->Position, WeaponDrop, width / 3, height / 2, CurrentWeapon->objID); CurrentWeapon->WeaponGlyphs = CreateText(CurrentWeapon->WeaponName, CurrentWeapon->WeaponPickup.Position.x, CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f + 25, 50, TextTint, Center, Plain); CreateStatsString(CurrentWeapon->WeaponStatsString, CurrentWeapon->BonusStrength, CurrentWeapon->BonusAgility, CurrentWeapon->BonusDefense); CurrentWeapon->WeaponStatsGlyphs = CreateText(CurrentWeapon->WeaponStatsString, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f - 25), 50, TextTint, Center, Plain); ChangeTextZIndex(CurrentWeapon->WeaponGlyphs, 451); ChangeTextZIndex(CurrentWeapon->WeaponStatsGlyphs, 451); nameLen = strlen(CurrentWeapon->WeaponName); statsLen = strlen(CurrentWeapon->WeaponStatsString); if(nameLen >= statsLen) { CurrentWeapon->WeaponHoverBackground = (Sprite *) CreateSprite("TextureFiles/WeaponHoverBackground.png", nameLen * 25.0f, 180, 450, 1, 1, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f));// + CurrentWeapon->WeaponGlyphs->Glyph->Height)); } else { CurrentWeapon->WeaponHoverBackground = (Sprite *) CreateSprite("TextureFiles/WeaponHoverBackground.png", statsLen * 25.0f, 180, 450, 1, 1, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f));// + CurrentWeapon->WeaponGlyphs->Glyph->Height)); } CurrentWeapon->WeaponHoverBackground->Visible = FALSE; CurrentWeapon->WeaponParticle = CreateFoxParticleSystem("TextureFiles/ParticlePlatform.png", xPos, yPos, 9, -1, 3, .15f, 270, 0, 0.3f, 0, 110, 100, 50.0f, 1.0f, 0.7f); //Start off shopless CurrentWeapon->CurrentShop = NULL; CurrentWeapon->WeaponFalling = FALSE; return CurrentWeapon; }
void ComparisonTextUpdate(TextGlyphs* FirstLetter) { TextGlyphs* nextLetter = FirstLetter; float R, G, B; // Check if the strength is an improvement or not if(!nextLetter) return; if(nextLetter->letter == '+') { R = 0.0f; G = 0.7f; B = 0.0f; } else if(nextLetter->letter == '-') { R = 0.7f; G = 0.0f; B = 0.0f; } else { R = 0.0f; G = 0.0f; B = 0.0f; } // Updates the color while(nextLetter && nextLetter->letter != 32) { Vec3Set(&nextLetter->Glyph->Tint, R, G, B); nextLetter = nextLetter->NextLetter; } nextLetter = nextLetter->NextLetter; // Check if the agility is an improvement or not if(!nextLetter) return; if(nextLetter->letter == '+') { R = 0.0f; G = 0.7f; B = 0.0f; } else if(nextLetter->letter == '-') { R = 0.7f; G = 0.0f; B = 0.0f; } else { R = 0.0f; G = 0.0f; B = 0.0f; } // Updates the color while(nextLetter && nextLetter->letter != 32) { Vec3Set(&nextLetter->Glyph->Tint, R, G, B); nextLetter = nextLetter->NextLetter; } nextLetter = nextLetter->NextLetter; // Check if the defense is an improvement or not if(!nextLetter) return; if(nextLetter->letter == '+') { R = 0.0f; G = 0.7f; B = 0.0f; } else if(nextLetter->letter == '-') { R = 0.7f; G = 0.0f; B = 0.0f; } else { R = 0.0f; G = 0.0f; B = 0.0f; } // Updates the color while(nextLetter && nextLetter->letter != 32) { Vec3Set(&nextLetter->Glyph->Tint, R, G, B); nextLetter = nextLetter->NextLetter; } }