Simulator::Cell namespace

Cell stage functionality.

This namespace contains all the functionality of the Cell stage. The main classes are:

Most of cell stage is defined thorugh several files: .effectMap, .cell, .lootTable, etc. All these files have their representation in code as Simulator::Cell::cCellEffectMapResource, Simulator::Cell::cCellCellResource, etc The main file is CellGame.globals, which can be obtained in code with Simulator::Cell::GetGlobalsData()

Everything you see in the cell stage is considered a "cell", including rocks, bubbles, poison and food. Cells are represented by the Simulator::Cell::, and are stored in the Simulator::Cell::cCellGame::mCells object pool. Every cell is backed by a .cell file (Simulator::Cell::cCellCellResource) that defines all its properties, such as AI configuration, model, etc.

For many of the cells actions, it is just enough to change a variable to see changes, as the cell stage update method takes care of the rest. Such values are mTargetPosition, mTargetOrientation, mTargetOpacity, mTargetSize, etc. For example, changing mTargetPosition and setting mIsIdle to false, will not teleport the cell but make it swim towards the target position instead.

Code examples

Moving the player cell 10 units to the right. This does not teleport it immediately, but it makes it swim towards there.

auto cell = Simulator::Cell::GetPlayerCell();
cell->mTargetPosition.x += 10.0f;
cell->mIsIdle = false;

Creating a cell next to the player:

auto player = Simulator::Cell::GetPlayerCell();
auto cellIndex = Simulator::Cell::CreateCellObject(
    CellGame.mpCellQuery,
    player->mTransform.GetOffset() + Math::Vector3(4.0f, 0.0f, 0.0f),
    0.0f,
    player->mCellResource,
    player->mScale,
    1.0f,
    1.0f
);

Finding nearby cells and enlarging them:

auto player = Simulator::Cell::GetPlayerCell();
Simulator::cObjectPoolIndex cellIndices[400];
int numCells = Simulator::Cell::FindCellsInRadius(
    CellGame.mpCellQuery,
    player->GetPosition(), 5.0,  // center and radius of search
    cellIndices, 400);

for (int i = 0; i < numCells; i++)
{
    auto cell = CellGame.mCells.Get(cellIndices[i]);
    cell->mTargetSize *= 2.0f;
}

Make nearby cells chase the player:

auto player = Simulator::Cell::GetPlayerCell();

Simulator::cObjectPoolIndex cellIndices[400];
int numCells = Simulator::Cell::FindCellsInRadius(
    CellGame.mpCellQuery,
    player->GetPosition(), 20.0,  // center and radius of search
    cellIndices, 400);

for (int i = 0; i < numCells; i++)
{
    auto cell = CellGame.mCells.Get(cellIndices[i]);
    if (cell->IsCreature()) {
        cell->mChaseCellTime = 10.0f;
        cell->mChaseCellIndex = player->Index();
        // If we don't disable this, fleeing cells will not chase us
        cell->mFleeCellTime = 0.0f;
        cell->mFleeCellIndex = 0;
    }
}

Read data from a .cell file:

// Declare this as a static variable
Simulator::Cell::cCellCellResource::Reference* sCellChomperReference;

// In the initialize method, choose which `.cell` file we are reading
sCellChomperReference = Simulator::Cell::cCellCellResource::Reference::Create(id("cell_chomper"));

// To use the data
cCellCellResourcePtr cellResource;
auto cellData = Simulator::Cell::GetData(sCellChomperReference, cellResource);

Classes

class cAdvectResource
struct cCellAnimDefinition
struct cCellBackgroundMapResource
struct cCellCellResource
template<typename T>
struct cCellDataReference
struct cCellDataReference_
struct cCellEffectMapResource
class cCellGame
class cCellGFX
struct cCellGlobalsResource
struct cCellLookAlgorithmResource
struct cCellLookTableResource
struct cCellLootTableResource
struct cCellMission
struct cCellObjectData
struct cCellPopulateResource
struct cCellPowersResource
struct cCellQueryEntry
struct cCellQueryLinkedPool
Class used to quickly query cell positions.
struct cCellQueryLinkedPoolData
struct cCellRandomCreatureResource
class cCellResource
struct cCellScaleInfo
class cCellSerializableData
struct cCellStructureResource
class cCellUI
struct cCellUIRollover
struct cCellWorldResource
struct CellSerializer
struct CellSerializerField

Enums

enum class ScaleDifference { MuchSmaller = 0, Smaller = 1, Equal = 2, Larger = 3, MuchLarger = 4 }
enum class CellStageScale: int { None = -1, _0 = 0, _1 = 1, _2 = 2, _4 = 3, _10 = 4, _20 = 5, _40 = 6, _100 = 7, _200 = 8, _400 = 9, _1K = 10, _2K = 11, _4K = 12, _10K = 13, _20K = 14, _40K = 15, _100K = 16, _200K = 17, _400K = 18, _1M = 19 }
enum CellAnimations { kAnimIndexCellIdle = 0, kAnimIndexCellIdleBlink1 = 1, kAnimIndexCellIdleBlink2 = 2, kAnimIndexCellIdleBlink3 = 3, kAnimIndexCellMovFlg = 4, kAnimIndexCellMovFlgBlink = 5, kAnimIndexCellEatFilter = 6, kAnimIndexCellDmgSolidSpike = 7, kAnimIndexCellDmgSolidMand = 8, kAnimIndexCellDeathAvatar = 9, kAnimIndexCellDeathNpc = 10, kAnimIndexCellDeathNpcIdle = 11, kAnimIndexCellEatFilterNpc = 12, kAnimIndexCellEatMand = 13, kAnimIndexCellEatMandNpc = 14, kAnimIndexCellEatProb = 15, kAnimIndexCellTakeDmgElec = 16, kAnimIndexCellTakeDmgPoison = 17, kAnimIndexCellTakeDmgStab = 18, kAnimIndexCellMoveJet = 19, kAnimIndexCellMoveJetBlink = 20, kAnimIndexCellMovFlg2 = 21, kAnimIndexCellMoveNpcScared = 22, kAnimIndexCellMoveNpcMad = 23, kAnimIndexCellMoveNpcScared2 = 24, kAnimIndexCellMoveNpcMad2 = 25, kAnimIndexCellMoveJet2 = 26, kAnimIndexCellMoveJet3 = 27, kAnimIndexCellNpcScared = 28, kAnimIndexCellNpcMad = 29, kAnimIndexCellDeathNpcIdle2 = 30, kAnimIndexCellEatFilterFail = 31, kAnimIndexCellEatMandFail = 32, kAnimIndexCellGlanceMad = 33, kAnimIndexCellGlanceSpike = 34, kAnimIndexCellPunctureSpike = 35, kAnimIndexCellGrow = 36, kAnimIndexCellDeathAvatarIdle = 37, kAnimIndexCellElecRelease = 38, kAnimIndexCellBubblePop = 39, kAnimIndexCellEatProbStun = 40, kAnimIndexCellNpcStartled = 41, kAnimIndexCellPoked = 42, kAnimIndexCellTakeDmgElecNpc = 43, kAnimIndexCellTakeDmgPoisonNpc = 44, kAnimIndexCellTakeDmgStabNpc = 45, kAnimIndexCellGlanceSpikeOnSpike = 46, kAnimIndexCellEatProbRetractTrgt = 47, kAnimIndexCellEatProbRetract = 48, kAnimIndexCellEatMandNpcBig = 49, kAnimIndexCellIdleBig = 50, kAnimIndexCellIdleBlink1Big = 51, kAnimIndexCellIdleBlink2Big = 52, kAnimIndexCellIdleBlink3Big = 53, kAnimIndexCellMovFlgBig = 54, kAnimIndexCellMovFlgBigBlink = 55, kAnimIndexCellMovFlgBigMad = 56, kAnimIndexCellMovCilBig = 57, kAnimIndexCellMovCilBigBlink = 58, kAnimIndexCellMovCilBigMad = 59, kAnimIndexCellMovCilBig2 = 60, kAnimIndexCellMovCilBigBlink2 = 61, kAnimIndexCellMovCilBigMad2 = 62, kAnimIndexCellNpcMadBig = 63, kAnimIndexCellMovCil = 64, kAnimIndexCellMovCilBlink = 65, kAnimIndexCellMovPoisonRelease = 66, kAnimIndexCellMovCilMad = 67, kAnimIndexCellMovCilScared = 68, kAnimIndexCellDmgSolidDeath = 69, kAnimIndexCellPoisonRelease = 70, kAnimIndexCellHatchLayEgg = 71, kAnimIndexCellHatchEgg = 72, kAnimIndexCellHatchIce = 73, kAnimIndexCellGoToEditor = 74, kAnimIndexCellDeathEaten = 75, kAnimIndexCellDeathEatenNpc = 76, kAnimIndexCellTakeDmgMand = 77, kAnimIndexCellPartDiscover = 78, kAnimIndexCellEatFilterChew = 79, kAnimIndexCellEatMandChew = 80, kAnimIndexCellEatProbChew = 81, kAnimIndexCellDmgSolidMandNpc = 82, kAnimIndexCellDmgSolidDeathNpc = 83, kAnimIndexCellTakeDmgMandNpc = 84, kAnimIndexCellMovToBeach = 85, kAnimIndexCellGlanceMad2 = 86, kAnimIndexCellMovFlgBigMadBlink = 87, kAnimIndexCellGlanceProbOnProb = 88, kAnimIndexCellMovCil180 = 89, kAnimIndexCellMovCil180v2 = 90, kAnimIndexCellMovCil180v3 = 91, kAnimIndexCellMovCil180v4 = 92, kAnimIndexCellMovCil180v5 = 93, kAnimIndexCellMovFlgStart = 94, kAnimIndexCellMovFlgStart2 = 95, kAnimIndexCellMovCil2 = 96, kAnimIndexCellMoveJet4 = 97, kAnimIndexCellTakeDmgPoisonBig = 98, kAnimIndexCellMovBankLt = 99, kAnimIndexCellMovBankRt = 100, kAnimIndexCellBackgrndGuy = 101, kAnimIndexCellTakeDmgElecNpcBig = 102, kAnimIndexEpicCellEyePokeReact = 103, kAnimIndexEpicCellEyePokeClosedLF = 104, kAnimIndexEpicCellEyePokeClosedRF = 105, kAnimIndexEpicCellEyePokeClosedLC = 106, kAnimIndexEpicCellEyePokeClosedRC = 107, kAnimIndexEpicCellEyePokeClosedLB = 108, kAnimIndexEpicCellEyePokeClosedRB = 109, kAnimIndexEpicCellBiteRock = 110, kAnimIndexEpicCellElectrocuted = 111, kAnimIndexEpicCellChokes = 112, kAnimIndexEpicCellProboscised = 113, kAnimIndexEpicCellDeathTurnover = 114, kAnimIndexEpicCellDeathIdle = 115, kAnimIndexEpicCellEyePokeReactLt = 116, kAnimIndexEpicCellEyePokeReactRt = 117, kAnimIndexCellMate01 = 118, kAnimIndexCellMate02 = 119, kAnimIndexCellMatingCall = 120, kAnimIndexCellEatProbRetractTrgtNpc = 121, kAnimIndexCellEatProbRetractNpc = 122, kAnimIndexCellEatProbStunNpc = 123, kAnimIndexCellEatProbNpc = 124, kAnimIndexCellTakeDmgStabNpcBig = 125, kAnimIndexCellTakeDmgMandNpcBig = 126, kAnimIndexEpicCellPoked = 127, kAnimIndexEpicCellPoked2 = 128, kAnimIndexCellBrainUpgrade = 129, kAnimIndexCellHatchLayEggNpc = 130 }

Functions

auto Addresses(GameModeCell) -> namespace
ASSERT_SIZE(cCellGame, 0x51E4)
auto Addresses(cCellGame) -> namespace
ASSERT_SIZE(cCellGFX, 0x1625C)
auto Addresses(cCellGFX) -> namespace
ASSERT_SIZE(cCellObjectData, 0x398)
ASSERT_SIZE(cCellQueryEntry, 0x1C)
ASSERT_SIZE(cCellQueryLinkedPoolData, 0x18)
ASSERT_SIZE(cCellQueryLinkedPool, 16)
ASSERT_SIZE(CellSerializerField, 0x28)
ASSERT_SIZE(CellSerializer, 0x28)
ASSERT_SIZE(cCellResource, 0x20)
ASSERT_SIZE(cCellDataReference_, 0x10)
auto Addresses(cCellDataReference_) -> namespace
ASSERT_SIZE(cCellPowersResource, 0x8)
ASSERT_SIZE(cCellRandomCreatureResource, 8)
ASSERT_SIZE(cCellStructureResource, 0x1C)
ASSERT_SIZE(cCellPopulateResource, 0x10)
ASSERT_SIZE(cCellWorldResource, 0x10)
ASSERT_SIZE(cCellCellResource, 0x31C)
ASSERT_SIZE(cCellLootTableResource, 0x24)
ASSERT_SIZE(cCellLookTableResource, 8)
ASSERT_SIZE(cCellLookAlgorithmResource, 8)
ASSERT_SIZE(cCellEffectMapResource, 8)
ASSERT_SIZE(cCellBackgroundMapResource, 8)
ASSERT_SIZE(cCellGlobalsResource, 0x114)
ASSERT_SIZE(cAdvectResource, 0x20)
auto GetGlobalsData() -> cCellGlobalsResource*
template<typename T>
auto GetData(cCellDataReference_* reference, eastl::intrusive_ptr<cCellDataReference<T>>& dst) -> T*
Loads the data of a cell file reference, or returns the existing cached file.
ASSERT_SIZE(cCellScaleInfo, 0x1C)
ASSERT_SIZE(cCellMission, 0x10)
ASSERT_SIZE(cCellSerializableData, 0xEC)
auto Addresses(cCellSerializableData) -> namespace
ASSERT_SIZE(cCellUIRollover, 0x38)
ASSERT_SIZE(cCellUI, 0x944)
auto Addresses(cCellUI) -> namespace
ASSERT_SIZE(cCellAnimDefinition, 0x24)
auto GetGoalCards() -> GoalCard*
auto GetPlayerCell() -> cCellObjectData*
Returns the player cell.
auto GetCurrentAdvectInfo(CellStageScale& dst0, float& dstStrength, float& dstVariance, float& dstPeriod) -> uint32_t
Returns the info of the cCellWorldResource::cAdvectInfo of the current world and cell scale, based on the current food progression.
auto GetNextAdvectID() -> uint32_t
Returns the advect file ID for the next cell scale in the current world, based on the current food progression.
auto CreateCellObject(cCellQueryLinkedPool* query, const Math::Vector3& position, float elevation, cCellDataReference<cCellCellResource>* resource, CellStageScale scaleLevel, float sizeFactor, float cellSize, bool applySize = true, Math::Quaternion* pTargetOrientation = nullptr, int = 0) -> cObjectPoolIndex
auto MovePlayerToMousePosition(float deltaTime) -> void
auto GetScaleDifferenceWithPlayer(cCellObjectData* otherCell) -> ScaleDifference
Returns scale difference between the given cell and the player cell, telling whether it is smaller, larger or the same scale (level).
auto ShouldNotAttack(cCellObjectData* cell1, cCellObjectData* cell2) -> bool
Calculates whether the first cell will or will not attack the second cell.
auto GetDamageAmount(cCellObjectData* attackerCell, cCellObjectData* victimCell) -> int
Returns how much hp damage the victim cell takes when attacked by another cell.
auto FindCellsInRadius(cCellQueryLinkedPool* query, const Math::Vector3& position, float radius, cObjectPoolIndex* dst, int dstArraySize, void* dst2 = nullptr) -> int
Finds all the cells that are within a radius of a specific position.
auto PlayAnimation(cCellObjectData* cell, cCellObjectData* otherCell, CellAnimations targetAnim, CellAnimations currentAnim) -> void
Makes the cell play an animation.
auto GetModelKeyForCellResource(cCellDataReference<cCellCellResource>* cellResource) -> ResourceKey
Returns the main model key that must be used for a specific cell definition.

Enum documentation

enum class Simulator::Cell::ScaleDifference

Enumerators
MuchSmaller

Cell is 2 or more levels smaller than player cell.

Smaller

Cell is 1 level smaller than player cell.

Equal

Cell is same level as player cell.

Larger

Cell is 1 level larger than player cell.

MuchLarger

Cell is 2 or more levels larger than player cell.

enum Simulator::Cell::CellAnimations

Enumerators
kAnimIndexCellIdle

0xAAAA0015

kAnimIndexCellIdleBlink1

0xAAAA0016

kAnimIndexCellIdleBlink2

0xAAAA0017

kAnimIndexCellIdleBlink3

0xAAAA0018

kAnimIndexCellMovFlg

0xAAAA0019

kAnimIndexCellMovFlgBlink

0xAAAA0020

kAnimIndexCellEatFilter

0xAAAA0005

kAnimIndexCellDmgSolidSpike

0xAAAA0000

kAnimIndexCellDmgSolidMand

0xAAAA0001

kAnimIndexCellDeathAvatar

0xAAAA0002

kAnimIndexCellDeathNpc

0xAAAA0003

kAnimIndexCellDeathNpcIdle

0xAAAA0004

kAnimIndexCellEatFilterNpc

0xAAAA0006

kAnimIndexCellEatMand

0xAAAA0007

kAnimIndexCellEatMandNpc

0xAAAA0008

kAnimIndexCellEatProb

0xAAAA0009

kAnimIndexCellTakeDmgElec

0xAAAA0011

kAnimIndexCellTakeDmgPoison

0xAAAA0012

kAnimIndexCellTakeDmgStab

0xAAAA0013

kAnimIndexCellMoveJet

0xAAAA0021

kAnimIndexCellMoveJetBlink

0xAAAA0022

kAnimIndexCellMovFlg2

0xAAAA0019

kAnimIndexCellMoveNpcScared

0xAAAA0023

kAnimIndexCellMoveNpcMad

0xAAAA0024

kAnimIndexCellMoveNpcScared2

0xAAAA0023

kAnimIndexCellMoveNpcMad2

0xAAAA0024

kAnimIndexCellMoveJet2

0xAAAA0021

kAnimIndexCellMoveJet3

0xAAAA0021

kAnimIndexCellNpcScared

0xAAAA0025

kAnimIndexCellNpcMad

0xAAAA0026

kAnimIndexCellDeathNpcIdle2

0xAAAA0027

kAnimIndexCellEatFilterFail

0xAAAA0028

kAnimIndexCellEatMandFail

0xAAAA0029

kAnimIndexCellGlanceMad

0xAAAA0030

kAnimIndexCellGlanceSpike

0xAAAA0031

kAnimIndexCellPunctureSpike

0xAAAA0032

kAnimIndexCellGrow

0xAAAA0033

kAnimIndexCellDeathAvatarIdle

0xAAAA0036

kAnimIndexCellElecRelease

0xAAAA0037

kAnimIndexCellBubblePop

0xAAAA0038

kAnimIndexCellEatProbStun

0xAAAA0039

kAnimIndexCellNpcStartled

0xAAAA0040

kAnimIndexCellPoked

0xAAAA0041

kAnimIndexCellTakeDmgElecNpc

0xAAAA0042

kAnimIndexCellTakeDmgPoisonNpc

0xAAAA0043

kAnimIndexCellTakeDmgStabNpc

0xAAAA0044

kAnimIndexCellGlanceSpikeOnSpike

0xAAAA0045

kAnimIndexCellEatProbRetractTrgt

0xAAAA0046

kAnimIndexCellEatProbRetract

0xAAAA0047

kAnimIndexCellEatMandNpcBig

0xAAAA0048

kAnimIndexCellIdleBig

0xAAAA0049

kAnimIndexCellIdleBlink1Big

0xAAAA0050

kAnimIndexCellIdleBlink2Big

0xAAAA0051

kAnimIndexCellIdleBlink3Big

0xAAAA0052

kAnimIndexCellMovFlgBig

0xAAAA0053

kAnimIndexCellMovFlgBigBlink

0xAAAA0054

kAnimIndexCellMovFlgBigMad

0xAAAA0055

kAnimIndexCellMovCilBig

0xAAAA0056

kAnimIndexCellMovCilBigBlink

0xAAAA0057

kAnimIndexCellMovCilBigMad

0xAAAA0058

kAnimIndexCellMovCilBig2

0xAAAA0056

kAnimIndexCellMovCilBigBlink2

0xAAAA0057

kAnimIndexCellMovCilBigMad2

0xAAAA0058

kAnimIndexCellNpcMadBig

0xAAAA0059

kAnimIndexCellMovCil

0xAAAA0060

kAnimIndexCellMovCilBlink

0xAAAA0061

kAnimIndexCellMovPoisonRelease

0xAAAA0062

kAnimIndexCellMovCilMad

0xAAAA0063

kAnimIndexCellMovCilScared

0xAAAA0064

kAnimIndexCellDmgSolidDeath

0xAAAA0065

kAnimIndexCellPoisonRelease

0xAAAA0066

kAnimIndexCellHatchLayEgg

0xAAAA0067

kAnimIndexCellHatchEgg

0xAAAA0068

kAnimIndexCellHatchIce

0xAAAA0069

kAnimIndexCellGoToEditor

0xAAAA0070

kAnimIndexCellDeathEaten

0xAAAA0071

kAnimIndexCellDeathEatenNpc

0xAAAA0072

kAnimIndexCellTakeDmgMand

0xAAAA0073

kAnimIndexCellPartDiscover

0xAAAA0074

kAnimIndexCellEatFilterChew

0xAAAA0075

kAnimIndexCellEatMandChew

0xAAAA0076

kAnimIndexCellEatProbChew

0xAAAA0077

kAnimIndexCellDmgSolidMandNpc

0xAAAA0078

kAnimIndexCellDmgSolidDeathNpc

0xAAAA0079

kAnimIndexCellTakeDmgMandNpc

0xAAAA0080

kAnimIndexCellMovToBeach

0xAAAA0081

kAnimIndexCellGlanceMad2

0xAAAA0082

kAnimIndexCellMovFlgBigMadBlink

0xAAAA0083

kAnimIndexCellGlanceProbOnProb

0xAAAA0084

kAnimIndexCellMovCil180

0xAAAA0085

kAnimIndexCellMovCil180v2

0xAAAA0086

kAnimIndexCellMovCil180v3

0xAAAA0087

kAnimIndexCellMovCil180v4

0xAAAA0088

kAnimIndexCellMovCil180v5

0xAAAA0089

kAnimIndexCellMovFlgStart

0xAAAA0090

kAnimIndexCellMovFlgStart2

0xAAAA0090

kAnimIndexCellMovCil2

0xAAAA0091

kAnimIndexCellMoveJet4

0xAAAA0092

kAnimIndexCellTakeDmgPoisonBig

0xAAAA0093

kAnimIndexCellMovBankLt

0xAAAA0095

kAnimIndexCellMovBankRt

0xAAAA0096

kAnimIndexCellBackgrndGuy

0xAAAA0097

kAnimIndexCellTakeDmgElecNpcBig

0xAAAA0098

kAnimIndexEpicCellEyePokeReact

0xAAAA0099

kAnimIndexEpicCellEyePokeClosedLF

0xAAAA0100

kAnimIndexEpicCellEyePokeClosedRF

0xAAAA0101

kAnimIndexEpicCellEyePokeClosedLC

0xAAAA0102

kAnimIndexEpicCellEyePokeClosedRC

0xAAAA0103

kAnimIndexEpicCellEyePokeClosedLB

0xAAAA0104

kAnimIndexEpicCellEyePokeClosedRB

0xAAAA0105

kAnimIndexEpicCellBiteRock

0xAAAA0106

kAnimIndexEpicCellElectrocuted

0xAAAA0107

kAnimIndexEpicCellChokes

0xAAAA0108

kAnimIndexEpicCellProboscised

0xAAAA0109

kAnimIndexEpicCellDeathTurnover

0xAAAA0110

kAnimIndexEpicCellDeathIdle

0xAAAA0111

kAnimIndexEpicCellEyePokeReactLt

0xAAAA0112

kAnimIndexEpicCellEyePokeReactRt

0xAAAA0113

kAnimIndexCellMate01

0xAAAA0114

kAnimIndexCellMate02

0xAAAA0115

kAnimIndexCellMatingCall

0xAAAA0116

kAnimIndexCellEatProbRetractTrgtNpc

0xAAAA0117

kAnimIndexCellEatProbRetractNpc

0xAAAA0118

kAnimIndexCellEatProbStunNpc

0xAAAA0119

kAnimIndexCellEatProbNpc

0xAAAA0120

kAnimIndexCellTakeDmgStabNpcBig

0xAAAA0121

kAnimIndexCellTakeDmgMandNpcBig

0xAAAA0122

kAnimIndexEpicCellPoked

0xAAAA0123

kAnimIndexEpicCellPoked2

0xAAAA0123

kAnimIndexCellBrainUpgrade

0xAAAA0124

kAnimIndexCellHatchLayEggNpc

0xAAAA0125

Function documentation

template<typename T>
T* Simulator::Cell::GetData(cCellDataReference_* reference, eastl::intrusive_ptr<cCellDataReference<T>>& dst)

Loads the data of a cell file reference, or returns the existing cached file.

Parameters
reference
dst

cCellObjectData* Simulator::Cell::GetPlayerCell()

Returns the player cell.

uint32_t Simulator::Cell::GetCurrentAdvectInfo(CellStageScale& dst0, float& dstStrength, float& dstVariance, float& dstPeriod)

Returns the info of the cCellWorldResource::cAdvectInfo of the current world and cell scale, based on the current food progression.

Parameters
dst0 out
dstStrength out
dstVariance out
dstPeriod out
Returns The advect file ID

uint32_t Simulator::Cell::GetNextAdvectID()

Returns the advect file ID for the next cell scale in the current world, based on the current food progression.

cObjectPoolIndex Simulator::Cell::CreateCellObject(cCellQueryLinkedPool* query, const Math::Vector3& position, float elevation, cCellDataReference<cCellCellResource>* resource, CellStageScale scaleLevel, float sizeFactor, float cellSize, bool applySize = true, Math::Quaternion* pTargetOrientation = nullptr, int = 0)

ScaleDifference Simulator::Cell::GetScaleDifferenceWithPlayer(cCellObjectData* otherCell)

Returns scale difference between the given cell and the player cell, telling whether it is smaller, larger or the same scale (level).

Parameters
otherCell

bool Simulator::Cell::ShouldNotAttack(cCellObjectData* cell1, cCellObjectData* cell2)

Calculates whether the first cell will or will not attack the second cell.

Parameters
cell1
cell2
Returns True if cell 1 must not attack cell 2, false if it must attack.

This returns false when:

  • The two cells are the same type (the same .cell file)
  • field_112 is true for any of the cells
  • Cell 1 wontAttackPlayerWhenSmall is true, cell 2 is player, and the cell is smaller
  • Cell 1 wontAttackPlayer is true and cell 2 is player
  • Both cells have the same friendGroup and it's not 0

int Simulator::Cell::GetDamageAmount(cCellObjectData* attackerCell, cCellObjectData* victimCell)

Returns how much hp damage the victim cell takes when attacked by another cell.

Parameters
attackerCell
victimCell
Returns The amount of HP damage.

The maximum HP for all cells is 6.

int Simulator::Cell::FindCellsInRadius(cCellQueryLinkedPool* query, const Math::Vector3& position, float radius, cObjectPoolIndex* dst, int dstArraySize, void* dst2 = nullptr)

Finds all the cells that are within a radius of a specific position.

The caller must provide a buffer where For example, getting all the cells 10 units from the player:

Math::Vector3 position = Simulator::Cell::GetAvatarCell()->mTransform.GetOffset();
cObjectPoolIndex buffer[400];
int numCells = Simulator::Cell::FindCellsInRadius(CellGame.field_40FC, position, 10.0f, buffer, 400);

void Simulator::Cell::PlayAnimation(cCellObjectData* cell, cCellObjectData* otherCell, CellAnimations targetAnim, CellAnimations currentAnim)

Makes the cell play an animation.

Parameters
cell
otherCell
targetAnim
currentAnim

ResourceKey Simulator::Cell::GetModelKeyForCellResource(cCellDataReference<cCellCellResource>* cellResource)

Returns the main model key that must be used for a specific cell definition.

Parameters
cellResource

This looks at the structure field of the resource, and finds the first entry that is either:

  • Creature: returns the instance ID with .cll extension and group 0
  • RandomCreature: evaluates the random creature query and returns the key
  • PlayerCreature: returns the player model key For all other cases, it returns 0.