Turok
 
Loading...
Searching...
No Matches
t1_scriptAPI.cpp
Go to the documentation of this file.
7
23
35
37{
38 AF_SOLID = 1, ///< Can be collided
39 AF_DORMANT = 2, ///< if on then is asleep (won't be updated onTick) else is awake
40 AF_SNAPTOFLOOR = 4, ///< adjust z-axis to floor on spawn
41 AF_CLIMBWALLS = 8, ///< allows entering of wall sectors
42 AF_WOUNDEDMORTALLY = 16, ///< if on this actor will drop a mortal wound because it was hit by a super arrow shot
43 AF_CASTSHADOW = 32, ///< can cast a simple shadow
44 AF_TRIGGERSTUFF = 64, ///< NOT USED
45 AF_HIDDEN = 128, ///< don't draw but continue updating. can't be collided
46 AF_ACTIVATED = 256, ///< was triggered
47 AF_DISABLED = 512, ///< don't update animations
48 AF_ENTEREDAREAEVENT = 1024, ///< just entered a trigger sector
49 AF_REMOVEONCOMPLETION = 2048, ///< remove after finishing a special animation
50 AF_NOBLOOD = 4096, ///< don't spawn particles flagged as blood
51 AF_AVOIDWATER = 8192, ///< clip against edges linking to water sectors
52 AF_FLOATINWATERONDEATH = 16384, ///< rise to the surface while dead
53 AF_DEAD = 32768, ///< actor is dead. handle special cases for collision
54 AF_STATIONARY = 65536, ///< Sniper. don't update the animation's root motion
55 AF_ALIGNTOFLOOR = 131072, ///< rotate along slopes
56 AF_NODRAW = 262144, ///< don't render
57 AF_NONSHOOTABLE = 524288, ///< Fx won't hit actors if this flag is set.
58 AF_FULLVOLUME = 1048576, ///< all sounds coming from this actor will be heard at full volume
59 AF_CANBETOUCHED = 2097152, ///< allow invoking the OnTouch callback
60 AF_IGNORESOUNDEVENTS = 4194304, ///< don't call kexAnimState::Action_PlaySound
61 AF_TRIGGERANIMATION = 8388608, ///< play special animation on trigger/spawn
62 AF_HOLDTRIGGERANIM = 16777216, ///< pause special animation until triggered (is also invincible)
63 AF_TRIGGERNAIMDELAY = 33554432, ///< delay a bit before starting special animation
64 AF_STAYINWATER = 67108864, ///< can't exit water sectors
65 AF_ALWAYSACTIVE = 134217728, ///< never sleep or go dormant
66 AF_COLLIDEDWITHWALL = 268435456, ///< collided with an edge. cleared at every OnTick call
67 AF_INVINCIBLE = 536870912, ///< will not receive damage. OnDamage and OnDeath are never called
68 AF_ALLOWTINYENEMYCHEAT = 1073741824, ///< affected by tiny enemy game cheat
69 AF_NOMOVEMENT = -2147483648 ///< will not do collision movement
70};
71
73{
75 ASF1_PROJECTILEATTACK1 = 2, ///< High Priest Flame Attack (anim_aiRangeAttack1)
76 ASF1_LEADER = 4, ///< Flocker ai run toward Leaders to get attention.
78 ASF1_EXPLOSIONDEATH = 16, ///< NOT USED
80 ASF1_PROJECTILEATTACK2 = 64, ///< Pistol Fire (anim_aiRangeAttack2)
81 ASF1_NOREPEATEXPLOSION = 128, ///< NOT USED
82 ASF1_DIEONEXPLOSION = 256, ///< NOT USED
83 ASF1_FLOCKER = 512, ///< flocks to a leader kAI
84 ASF1_SLOW = 1024, ///< NOT USED
85 ASF1_RANDOMRESURRECTION = 2048, ///< NOT USED
86 ASF1_RANDOMFEIGNDEATH = 4096, ///< NOT USED
87 ASF1_KAMIKAZE = 8192, ///< if has no target then targets player and sets agitation to 300
88 ASF1_AVOIDPLAYERS = 16384, ///< NOT USED
89 ASF1_FLOATINWATERONDEATH = 32768, ///< kAI will float up to the top of the water when they are dead
90 ASF1_TELEPORT = 65536, ///< allows kAI to teleport on SetupAISpawnFlags
91 ASF1_CASTSHADOW = 131072, ///< sets AF_CASTSHADOW on SetSpawnParams
92 ASF1_TELEPORTWAIT = 262144, ///< allows enemy to move around for 1.5 - 4.5 seconds before teleporting back in.
93 ASF1_USESTRONGATTACKS = 524288, ///< anim_aiMelee1
94 ASF1_USEWEAKATTACKS = 1048576, ///< anim_aiAltMelee1
95 ASF1_SNIPER = 2097152,
96 ASF1_MELTONDEATH = 4194304, ///< allows melt effect and regeneration
97 ASF1_AVOIDWATER = 8388608, ///< sets AF_AVOIDWATER on SetSpawnParams
98 ASF1_FLYING = 16777216, ///< NOT USED
101 ASF1_TRIGGERSTUFF = 134217728, ///< Sets AF_TRIGGERSTUFF on SetupSpawnParams
102 ASF1_CANNOTCAUSEAFIGHT = 268435456, ///< if another actor was damaged by this actor with this flag set then other actor will not target this actor.
103 ASF1_NOWALLCOLLISION = 536870912, ///< NOT USED
104 ASF1_SCREENSHAKE = 1073741824, ///< Used in floor mover scripts to shake screen.
105 ASF1_RESPAWNANIMATION = -2147483648 ///< Enables respawning animation effect
106};
107
109{
110 ASF2_DROPITEM_MASK1 = 1, ///< Explosive shells
111 ASF2_DROPITEM_MASK2 = 2, ///< Grenade
112 ASF2_DROPITEM_MASK3 = 4, ///< Medium Health
113 ASF2_DROPITEM_MASK4 = 8, ///< Full Health
114 ASF2_DROPITEM_MASK5 = 16, ///< Ultra Health
115 ASF2_DROPITEM_MASK6 = 32, ///< Small Health
116 ASF2_DROPITEM_MASK7 = 64, ///< Large Health
117 ASF2_DROPITEM_MASK8 = 128, ///< Minigun ammo
118 ASF2_DROPITEM_MASK9 = 256, ///< Mortal Wound
119 ASF2_DROPITEM_MASK10 = 512, ///< 4 Rockets
120 ASF2_DROPITEM_MASK11 = 1024, ///< Shotgun Shells
121 ASF2_DROPITEM_MASK12 = 2048, ///< Energy Cell
122 ASF2_DROPITEM_MASK13 = 4096, ///< Large Energy Cell
123 ASF2_DROPITEM_MASK14 = 8192, ///< Clip
124 ASF2_REMOVEONCOMPLETION = 16384, ///< Sets AF_REMOVEONCOMPLETION
127 ASF2_PROJECTILEATTACK3 = 131072, ///< crouch rifle Fire (anim_aiRangeAttack7)
128 ASF2_PROJECTILEATTACK4 = 262144, ///< (anim_aiRangeAttack8)
129 ASF2_DROPITEMONDAMAGE = 524288, ///< NOT USED
130 ASF2_NOAUTOMAPDRAW = 1048576, ///< if map all or show enemies cheats are on then will not draw this actor on the automap.
131 ASF2_ALTERNATEMOVES = 2097152, ///< is for holding two handed weapons
132 ASF2_UNUSED1 = 4194304, ///< NOT USED
133 ASF2_UNUSED2 = 8388608, ///< NOT USED
134 ASF2_PROJECTILEATTACK5 = 16777216, ///< Stand Rifle Fire (anim_aiRangeAttack5)
135 ASF2_PROJECTILEATTACK6 = 33554432, ///< Pipe Blow (anim_aiRangeAttack6)
136 ASF2_MORTALWOUNDIMPACT = 67108864, ///< Can be hit by a super arrow shot and if ASF2_DROPITEM_MASK9 is on has a chance to drop a mortal wound
137 ASF2_STAYINWATER = 134217728, ///< sets AF_STAYINWATER on SetSpawnParams
138 ASF2_WARPDEATH = 268435456, ///< NOT USED
139 ASF2_STOREWARPRETURN = 536870912, ///< Used in portal scripts
140 ASF2_PROJECTILEATTACK7 = 1073741824, ///< Grenade Throw (anim_aiRangeAttack3)
141 ASF2_PROJECTILEATTACK8 = -2147483648 ///< High Priest Homing Blue Flame (anim_aiRangeAttack4)
142};
143
145{
146 ASF3_RETURNWARP = 1, ///< Used in portal scripts
147 ASF3_PLAYTRIGGERANIMONCE = 2, ///< MarkPersistentBit(false) when activated
148 ASF3_REGENERATEFROMSTART = 4, ///< Regen from starting position
149 ASF3_WALKINSTRAIGHTLINE = 8, ///< Set animation to Blend(ANIM_WALKING, (m_animSpeed * m_animScalar), 10, ANF_LOOP|ANF_ROOTMOTION); and do nothing else.
150 ASF3_KILLOUTSIDEOFVIEW = 16, ///< NOT USED
151 ASF3_NOTHINKER = 32, ///< AI will not function. Actors will not update movement. Actors OnBeginLevel will set their animation to ANIM_SPECIAL_EVENT.
152 ASF3_AVOIDPLAYERS2 = 64, ///< NOT USED
153 ASF3_NOVIOLENTDEATH = 128, ///< ANIM_AIDEATHSTAND and ANIM_DEATHSTANDALT will not play when kAI is killed.
154 ASF3_PROJECTILEATTACK9 = 256, ///< Demon chest Hadoken (anim_aiRangeAttack9)
155 ASF3_PROJECTILEATTACK10 = 512, ///< High Priest Lightning Red Flames (anim_aiRangeAttack10)
156 ASF3_MAKESPAWNANIMVISIBLE = 1024, ///< clears actor flags: ~(AF_HIDDEN|AF_DISABLED)
157 ASF3_NODRAWONCAMERA = 2048 ///< Will not draw this actor when viewing from camera unless camera flags has CMF_SHOW_HIDDEN_OBJECTS.
158};
159
161{
165 PF_GOD = 8, ///< Is reset when level beings
166 PF_JUMPING = 16, ///< is jumping (moving up). flag is off when reached max jump height or let go of jump button.
168 PF_INWARPAREA = 64, ///< in sector area with AAF_TELEPORT flag.
172 PF_PREVENTDEATHCAM = 1024, ///< will stop the death cinematic or the deadAnimView from triggering when the player dies.
173 PF_FIREDPROJECTILE = 2048, ///< set when FireProjectile is called. Cleared OnTick if weapon is not in WS_FIRE state and player is not locked.
174 PF_FALLINGDEATHPIT = 4096, ///< currently falling in a death pit. Cleared after level begins.
175 PF_WEAPONSTEAL = 8192, ///< on when campaigner steals weapon
176 PF_NOSECTORMUSIC = 16384, ///< disables music changes when changing sectors
177 PF_NOTOUCH = 32768, ///< disables invoking onTouch callbacks
178 PF_NOCEILINGGLIDE = 65536 ///< disables the ceiling glide glitch
179};
180
191
193{
194 GC_BIG_HEADS = 1 << 0,
200 GC_FLIGHT = 1 << 6,
201 GC_DISCO = 1 << 7,
203 GC_ALL_MAP = 1 << 9,
205 GC_NOCLIP = 1 << 11,
206};
207
209{
210 AIF_ATTACKING = 1, ///< playing an attacking animation
214 AIF_BLOWNAWAY = 16, ///< being blown away by explosion
220 AIF_NOCHASE = 1024, ///< disable chase logic
222 AIF_NOTHINK = 4096, ///< don't run ai logic
223 AIF_RUNNING = 8192, ///< Is playing running animation
228 AIF_TELEPORTAWAY = 262144, ///< playing teleport out animation
229 AIF_TELEPORTMOVESLOW = 524288, ///< chasing while underground
230 AIF_TELEPORTING = 1048576, ///< in teleport state. ignore all chase logic
231 AIF_TELEPORTIN = 2097152, ///< playing teleport in animation
232 AIF_WAITFORCYCLE = 4194304, ///< prevent other animations from interrupting until the current one finishes
233 AIF_DAMAGEPANIC = 8388608 ///< become aggressive when target is outside its active threshold (good for forcing AI to attack their target)
234};
235
249
257
259{
261 CRF_FLOOR = 1, ///< made contact with a floor
262 CRF_CEILING = 2, ///< made contact with a ceiling
263 CRF_WALL = 4, ///< made contact with an edge (sector edge that isn't linked to another sector)
264 CRF_OBJECT = 8, ///< made contact with an actor
265 CRF_MESH = 16, ///< made contact with a static object
266 CRF_ADJUST = 32, ///< z-axis was adjusted (ceiling or floor)
267 CRF_WALLRADIUS = 64 ///< made contact with an edge during the wall radius collision test
268};
269
271{
275 WS_FIRE = 3, ///< Is currently firing
276 WS_HOLDSTER = 4, ///< Set when dead (with no death cinematic) or when climbing. Should set weapon anim to ANIM_WEAPONSWAPOUT if you set this state manually.
277 WS_WALK = 5, ///< NOT USED
278 WS_RUN = 6, ///< NOT USED
279 WS_DISCHARGE = 7, ///< set after OnEndFire is called. If was in WS_FIRE state and not pressing the Attack button.
280 WS_FIREUNDERWATER = 8 ///< NOT USED
281};
282
298
314
344
358
366
368{
369 CF_CLIPEDGES = 1, ///< clip movement against edges that don't link to sectors
370 CF_IGNOREBLOCKERS = 2, ///< don't clip edges belonging to blocking sectors
371 CF_DROPOFF = 4, ///< allows passing through platforms or ledges
372 CF_NOENTERWATER = 8, ///< block all edges that links to a water sector
373 CF_NOEXITWATER = 16, ///< block all edges that links to a non-water sector
374 CF_NOCLIPSTATICS = 32, ///< don't collide with static models
375 CF_NOCLIPACTORS = 64, ///< don't collide with dynamic objects/actors
376 CF_WALKWALLS = 128, ///< don't restrict movement to steep slopes
377 CF_COLLIDEFLOORS = 256, ///< project and clip movement against non-flat floors
378 CF_HITSCAN = 512, ///< performs a single-pass trace. useful for hitscans
379 CF_ALLOWCLIMB = 1024, ///< collide with sectors flagged as climbable
380 CF_ALLOWCRAWL = 2048, ///< collide with sectors flagged as crawlable
381 CF_NOSTEPDOWN = 4096, ///< don't clamp z-axis when walking down slopes
382 CF_NOSLOPESTEP = 8192, ///< don't project z-axis movement along slopes
383 CF_COLLIDEHEIGHT = 16384, ///< clip against ceilings
384 CF_COLLIDECORPSES = 32768, ///< clip against actors flagged as dead
385 CF_NOEXITWALLS = 65536, ///< clip all edges, regardless if they link to another sector or not
386 CF_NOCOLLIDEFUNC = 131072, ///< don't invoke the OnCollide callback on the moving object
387 CF_NOFLOORADJUST = 262144, ///< don't keep z-axis above floor plane
388 CF_NOCEILINGADJUST = 524288, ///< don't keep z-axis below ceiling plane
389 CF_COLLIDEWATER = 1048576, ///< clip movement against the water surface
390 CF_USEWALLRADIUS = 2097152, ///< clip and project movement away from walls based on wall radius
391 CF_NOCLIPTARGETACTORS = 4194304, ///< don't clip actors that are targeted by moving object
392 CF_COLLIDETRIGGERS = 8388608, ///< block edges belonging to a trigger. Can't cross into sectors if sector has AAF_EVENT.
393 CF_STANDONOBJECTS = 16777216, ///< allow vertical clipping of objects
394 CF_GREASESLIDEOBJECTS = 33554432, ///< always keep movement projected away from collided objects
395 CF_ALLOWRESTRICTEDAREAS = 67108864, ///< don't collide with edges belonging to a restricted sector
396 CF_COLLIDECLIFFS = 134217728, ///< collide with non-walkable floors
397 CF_CHECKLINKEDBRIDGES = 268435456, ///< do extensive checks against overlapping bridge sectors
398 CF_POLYCOLLISION = 536870912 ///< clip movement against all model polygons of an object
399};
400
402{
403 WLT_INVALID = 0, ///< Not in water sectors
404 WLT_OVER = 1, ///< In water sector but over the water height
405 WLT_BETWEEN = 2, ///< In water sector and floating above the water
406 WLT_UNDER = 3 ///< In water sector and under the water height
407};
408
409/**
410 * @brief Lerp type when doing AutoPlayPositionTrack, AutoPlayRotationTrack, or AutoPlayBlendTrack.
411 * When a view has one of those active the view's time variable is then increased by GAME_DELTA_TIME.
412 */
414{
415 CMLT_NONE = 0, ///< time is set to time / speed.
416 CMLT_LINEAR = 1, ///< time is set to time / speed.
417 CMLT_LINEARLOOP = 2, ///< time is set to time / speed. If time is > 1.0 then time -= 1.0
418 CMLT_COSINE = 3, ///< time will never be higher than speed. time = CosTween(time * (1.0f / speed));
419 CMLT_COSINE_POW = 4 ///< time will never be higher than speed. time = CosTween(Pow(time * (1.0f / speed), 3));
420};
421
434
445
447{
450 AAF_TOGGLE = 4, ///< if on and AAF_BLOCK is on then sectors won't be marked on automap until it's unblocked. Used for door areas.
451 AAF_CLIFF = 8, ///< is a wall
452 AAF_CLIMB = 16, ///< climb up sectors faster than AAF_LADDER
453 AAF_ONESIDED = 32, ///< Bridge
456 AAF_ENTERCRAWL = 256, ///< Exactly the same as AAF_CRAWL
458 AAF_ENTERED = 1024, ///< Not shown in Editor. Used in kex editor only for fill sector commands. When map is saved in kex editor all sectors will have this flag off.
460 AAF_RESTRICTED = 4096, ///< kAI can't enter the area
461 AAF_SLOPETEST = 8192, ///< overrides AAF_CLIFF flag. If the sectors floor plane up direction is <= 0.5 then is a wall (a wall is the same as the AAF_CLIFF flag).
463 AAF_MAPPED = 32768,
464 AAF_EVENT = 65536,
465 AAF_REPEATABLE = 131072, ///< Unused
466 AAF_TELEPORT = 262144,
467 AAF_DAMAGE = 524288,
468 AAF_DRAWSKY = 1048576,
470 AAF_LAVA = 4194304,
471 AAF_EVENTSOUND = 8388608,
472 AAF_ANTIGRAVITY = 16777216,
473 AAF_LADDER = 33554432, ///< climb up sectors slower than AAF_CLIMB
474 AAF_CHECKPOINT = 67108864,
475 AAF_SAVEGAME = 134217728,
476 AAF_WARPRETURN = 268435456, ///< Unused
477 AAF_SHALLOWWATER = 536870912,
478 AAF_DRAWSUN = 1073741824,
479 AAF_STOREWARPRETURN = -2147483648 ///< Unused
480};
481
483{
484 SPF_FLOORVERTS = (1 << 0), ///< Changes sectors verts origin
485 SPF_CEILINGVERTS = (1 << 1), ///< Changes sectors verts heights
486 SPF_SAMEAREA = (1 << 2), ///< Effects sectors only with the same area as the starting sector
487 SPF_MOVEPLAYERINAIR = (1 << 3), ///< Player moves with the sectors even in the air
488 SPF_USEMOVETOFORPLAYER = (1 << 4), ///< Uses the MoveToPosition function to set the Players origin. else sets origin.
489 SPF_USEMOVETOFORAI = (1 << 5), ///< Uses the MoveToPosition function to set the AI origin. else sets origin.
490 SPF_USEMOVETOFOROTHER = (1 << 6), ///< Uses the MoveToPosition function to set other actors origin. else sets origin.
491 SPF_MOVEPLAYER = (1 << 7), ///< Moves player
492 SPF_MOVEAI = (1 << 8), ///< Moves AI
493 SPF_MOVEOTHERACTORS = (1 << 9), ///< Moves other actors on the sectors that are not the player or AI.
494
496};
497
515
516/**
517 * @class array<T>
518It is possible to declare array variables with the array identifier followed by the type of the elements within angle brackets.
519
520Example:
521
522@code{.cpp}
523 array<int> a, b, c;
524 array<Foo@> d;
525@endcode
526
527a, b, and c are now arrays of integers, and d is an array of handles to objects of the Foo type.
528
529When declaring arrays it is possible to define the initial size of the array by passing the length as a parameter to the constructor. The elements can also be individually initialized by specifying an initialization list. Example:
530
531@code{.cpp}
532 array<int> a; // A zero-length array of integers
533 array<int> b(3); // An array of integers with 3 elements
534 array<int> c(3, 1); // An array of integers with 3 elements, all set to 1 by default
535 array<int> d = {5,6,7}; // An array of integers with 3 elements with specific values
536@endcode
537
538Multidimensional arrays are supported as arrays of arrays, for example:
539
540@code{.cpp}
541 array<array<int>> a; // An empty array of arrays of integers
542 array<array<int>> b = {{1,2},{3,4}} // A 2 by 2 array with initialized values
543 array<array<int>> c(10, array<int>(10)); // A 10 by 10 array of integers with uninitialized values
544@endcode
545
546Each element in the array is accessed with the indexing operator. The indices are zero based, i.e. the range of valid indices are from 0 to length - 1.
547
548@code{.cpp}
549 a[0] = some_value;
550@endcode
551
552When the array stores handles the elements are assigned using the handle assignment.
553
554@code{.cpp}
555 // Declare an array with initial length 1
556 array<Foo@> arr(1);
557@endcode
558
559@code{.cpp}
560 // Set the first element to point to a new instance of Foo
561 @arr[0] = Foo();
562@endcode
563
564Arrays can also be created and initialized within expressions as anonymous objects.
565
566@code{.cpp}
567 // Call a function that expects an array of integers as input
568 foo(array<int> = {1,2,3,4});
569@endcode
570
571 */
572template <class T>
573class array // class array<T>
574{
575public:
576 void insertAt(uint index, const T&in value); ///< Inserts a new element into the array at the specified index.
577 void insertAt(uint index, const T[]&inout arr); ///< Inserts another array of elements into the array at the specified index.
578 void insertLast(const T&in value); ///< Appends an element at the end of the array.
579 void removeAt(uint index); ///< Removes the element at the specified index.
580 void removeLast(); ///< Removes the last element of the array.
581 void removeRange(uint start, uint count); ///< Removes count elements starting from start.
582 uint length() const; ///< Returns the length of the array.
583 void reserve(uint length);
584 void resize(uint length); ///< Sets the new length of the array.
585 void sortAsc(); ///< Sorts the elements in the array in ascending order. For object types, this will use the type's opCmp method.
586 void sortAsc(uint startAt, uint count); ///< Sorts only the elements starting at index startAt and the following count elements in the array in ascending order. For object types, this will use the type's opCmp method.
587 void sortDesc(); ///< Sorts the elements in the array in descending order. For object types, this will use the type's opCmp method.
588 void sortDesc(uint startAt, uint count); ///< Sorts only the elements starting at index startAt and the following count elements in the array in descending order. For object types, this will use the type's opCmp method.
589 void reverse(); ///< Reverses the order of the elements in the array.
590
591 /**
592 * @brief Returns the index of the first element that has the same value as the wanted value.
593 * For object types, this will use the type's opEquals or opCmp method to compare the value. For arrays of handles any null handle will be skipped.
594 * If no match is found will return a negative value.
595 */
596 int find(const T&in value) const;
597
598 /**
599 * @brief Returns the index of the first element that has the same value as the wanted value.
600 * For object types, this will use the type's opEquals or opCmp method to compare the value. For arrays of handles any null handle will be skipped.
601 * If no match is found will return a negative value.
602 */
603 int find(uint startAt, const T&in value) const;
604
605 /**
606 * @brief Searches for a matching address. These are especially useful for arrays of handles where specific instances of objects are desired, and not just objects that happen to have equal value.
607 * If no match is found will return a negative value.
608 */
609 int findByRef(const T&in value) const;
610
611 /**
612 * @brief Searches for a matching address. These are especially useful for arrays of handles where specific instances of objects are desired, and not just objects that happen to have equal value.
613 * If no match is found will return a negative value.
614 */
615 int findByRef(uint startAt, const T&in value) const;
616 bool isEmpty() const;
617 T& opIndex(uint index);
618 const T& opIndex(uint index) const;
619 T[]& opAssign(const T[]&in);
620 bool opEquals(const T[]&in) const;
621 funcdef bool less(const ?&in a, const ?&in b); ///< sorting function for sort
622 void sort(less&in, uint startAt = 0, uint count = uint ( - 1 )); ///< sorts array using the passed in less function
623};
624
625/**
626 * @class kStr
627 * @brief String class functions
628 */
629class kStr
630{
631public:
633 kStr(const kStr&in s);
634 uint Hash() const; ///< Returns HashID from this instance
635 kStr& ToUpper(); ///< Converts string to upper case characters
636 kStr& ToLower(); ///< Converts string to lower case characters
637 int Atoi() const; ///< Converts string to int
638 float Atof() const; ///< Converts string to float
639 bool Contains(const kStr&in) const; ///< contains the string
640 bool ContainsNoCase(const kStr&in) const; ///< contains the string ignoring case
641 bool IsEmpty() const; ///< length of string is 0
642 uint64 IndexOf(const kStr&in s) const; ///< Reports the zero-based index of the first occurrence of a specified string within this instance. The method returns uint64(-1) if the string is not found in this instance.
643 uint64 Length() const; ///< Returns the length of the string
644 kStr Substr(uint64 start, uint64 length) const; ///< Return a substring from the current string. Will return the current string if start or length indexes are out of range.
645 kStr ReplaceSubstr(const kStr &in from, const kStr &in to) const; ///< Returns a new kStr that replaced all occurrences of from with to.
646 bool StartsWith(const kStr &in s) const; ///< Returns true if this string starts with s
647 bool EndsWith(const kStr &in s) const; ///< Returns true if this string ends with s
648 const int8 opIndex(const uint64 i) const; ///< Returns the ASCII code of the character at the strings index
649 int8 &opIndex(const uint64 i); ///< Get/Set the ASCII code of the character at the strings index
650 bool opEquals(const kStr&in s) const;
651 kStr& opAssign(const kStr&in s);
652 kStr opAdd(const kStr&in s) const;
653 kStr opAdd(bool b) const;
654 kStr opAdd(int i) const;
655 kStr opAdd(uint i) const;
656 kStr opAdd(int64 i) const;
657 kStr opAdd(uint64 i) const;
658 kStr opAdd(int16 i) const;
659 kStr opAdd(uint16 i) const;
660 kStr opAdd(float f) const;
661 kStr& opAddAssign(const kStr&in s);
663};
664
665/**
666 * @class kAngle
667 * @brief Angle functions
668 */
670{
671public:
673 kAngle(float rads);
674 kAngle(const kAngle&in other);
675 float Diff(const float rads) const;
676 float Diff(const kAngle&in other) const;
677 float Interpolate(const float a, const float b) const;
678 kAngle opAdd(const float f) const;
679 kAngle& opAddAssign(const float f);
680 kAngle opSub(const float f) const;
681 kAngle& opSubAssign(const float f);
682 kAngle opAdd(const kAngle&in a) const;
684 kAngle opSub(const kAngle&in a) const;
686 kAngle& opAssign(const float f);
687 kAngle& opAssign(const kAngle&in a);
688 kAngle opNeg() const;
689 float opImplConv();
690};
691
692/**
693 * @class kVec3
694 * @brief Representation of 3D vectors and points.
695 */
696class kVec3
697{
698public:
700 kVec3(float x, float y, float z);
701 kVec3(const kVec3&in v);
702 kVec3& Normalize(); ///< Makes this vector have a magnitude of 1
703 kVec3 Cross(const kVec3&in v) const; ///< Cross Product of two vectors
704 float Dot(const kVec3&in v) const; ///< Dot Product of two vectors
705 float Length() const; ///< Returns the length of this vector. Exactly the same as Unit()
706 float LengthSq() const; ///< Returns the squared length of this vector. Exactly the same as UnitSq()
707 float DistanceSq(const kVec3&in other) const; ///< Returns the squared distance between this instance and other
708 float ToYaw(); ///< Returns the Yaw direction in Rads
709 float ToPitch(); ///< Returns the Pitch direction in Rads
710 void Clear(); ///< Sets x, y and z components to 0
711 void Set(const float x, const float y, const float z); ///< Set x, y and z components of this kVec3
712 kVec3 Lerp(const kVec3&in other, const float t) const; ///< Linearly interpolates between two vectors
713 kVec3& Lerp(const kVec3&in other, const float t); ///< Linearly interpolates between two vectors
714 kVec3& Project(const kVec3&in normal, const float value); ///< Projects a vector onto another vector
715 kVec3& Reflect(const kVec3&in normal, const float energyFactor); ///< Reflects a vector off the plane defined by a normal
716 kVec3& Randomize(const float value); ///< Randomizes x, y, z, components by value
717 kVec3& CubicCurve(const kVec3&in pt1, const float value, const kVec3&in pt2);
718 kVec3& QuadraticCurve(const kVec3&in pt1, const float value, const kVec3&in pt2, const kVec3&in pt3);
719 kVec3 opAdd(const kVec3&in v) const;
720 kVec3 opAdd(const float f) const;
721 kVec3& opAddAssign(const kVec3&in v);
722 kVec3& opAddAssign(const float f);
724 kVec3 opSub(const kVec3&in v) const;
725 kVec3 opSub(const float f) const;
726 kVec3& opSubAssign(const kVec3&in v);
727 kVec3& opSubAssign(const float f);
728 kVec3 opMul(const kVec3&in v);
729 kVec3 opMul(const float val);
730 kVec3& opMulAssign(const kVec3&in v);
731 kVec3& opMulAssign(const float f);
732 kVec3 opDiv(const kVec3&in v);
733 kVec3 opDiv(const float val);
734 kVec3& opDivAssign(const kVec3&in v);
735 kVec3& opDivAssign(const float f);
736 kVec3& opAssign(const kVec3&in v);
737 float opIndex(int i) const;
738 float& opIndex(int i);
739 float Distance(const kVec3&in other) const; ///< Returns the distance between this instance and other vector
741 kVec3 opMul(const kQuat&in rot) const;
742 kVec3& opMulAssign(const kQuat&in rot);
744 kQuat ToQuat() const;
745 float Unit() const; ///< Returns the length of this vector. Exactly the same as Length()
746 float UnitSq() const; ///< Returns the squared length of this vector. Exactly the same as LengthSq()
747 float x;
748 float y;
749 float z;
750};
751
752/**
753 * @class kQuat
754 * @brief Quaternions used to represent rotations
755 */
756class kQuat
757{
758public:
760 kQuat(float angle, float x, float y, float z);
761 kQuat(float angle, kVec3&in vector);
762 kQuat(float rotX, float rotY, float rotZ);
763 kQuat(const kQuat&in other);
766 kQuat Slerp(const kQuat&in rot, float t) const;
767 kQuat Inverse() const;
768 void GetAngles(float&out yaw, float&out pitch, float&out roll);
769 kQuat Diff(const kQuat&in rot) const;
770 void Set(const float x, const float y, const float z, const float w);
771 void Clear(); ///< x,y,z = 0.0 w = 1.0
772 kQuat opAdd(const kQuat&in rot);
773 kQuat opSub(const kQuat&in rot);
774 kQuat opMul(const kQuat&in rot);
775 kQuat& opAssign(const kQuat&in rot);
776 kQuat& opMulAssign(const kQuat&in rot);
777 kStr ToString() const;
778 float x;
779 float y;
780 float z;
781 float w;
782};
783
784/**
785 * @class kPlane
786 * @brief Plane functions
787 */
789{
790public:
792 kPlane(const float a, const float b, const float c, const float d);
793 kPlane(const kVec3&in a, const kVec3&in b, const kVec3&in c);
794 kPlane(const kVec3&in a, const kVec3&in b);
795 kPlane(const kAngle&in a);
796 const kVec3& Normal() const;
798 float Dot(const kVec3&in point) const;
799 float Dot(const kPlane&in plane) const;
800 float Distance(const kVec3&in point) const; ///< 0 = PSIDE_ON. > 0 is PSIDE_FRONT. < 0 PSIDE_BACK.
801 float ToYaw() const; ///< Yaw of this plane.
802
803 /**
804 * @brief Returns true if yaw is facing toward the plane. Usually used for climbing sectors.
805 * @code{.cpp}
806 * bool Climbable(const float yaw) const
807 * {
808 * return (floorPlane.c <= 0.5f && flags & AAF_CLIMB && floorPlane.IsFacing(yaw));
809 * }
810 * @endcode
811 */
812 bool IsFacing(const float yaw) const;
813 const int PointOnSide(const kVec3&in point) const; ///< Returns EnumPlaneSide. If point is in front, behind or on the plane.
814};
815
816class kColor ///< Not used (included automatically from kexengine)
817{
818public:
820 kColor(const kColor&in c);
821 kColor(uint8 r, uint8 g, uint8 b, uint8 a);
822 kColor(const kColor&in rgb, uint8 a);
823 kColor(uint8 rgb, uint8 a);
824 kColor(uint rgba);
825 kColor(float r, float g, float b);
826 uint DwColor() const;
827 kVec3 ToVec3() const;
828 void FromVec3(const kVec3&in v);
830 void FromVec3Linear(const kVec3&in v);
832 void SetSaturation(float);
833 void SetLuminance(float);
834 float GetSaturation() const;
835 float GetLuminance() const;
836 kColor& opAssign(const kColor&in c);
837 void LerpRGB(const kColor&in c, float t);
840 void RGBToHSV(float&out hue, float&out sat, float&out result) const;
841 void HSVToRGB(float hue, float sat, float val);
842 void RGBToHSL(float&out hue, float&out sat, float&out lit) const;
843 void HSLToRGB(float hue, float sat, float lit);
844 bool opEquals(const kColor&in c) const;
845 kColor opAdd(const kColor&in c) const;
846 kColor opSub(const kColor&in c) const;
847 kColor opMul(const kColor&in c) const;
848 kColor opMul(float f) const;
853 uint8 r;
854 uint8 g;
855 uint8 b;
856 uint8 a;
857};
858
859class kBitDelta ///< Not used (garbage included automatically from kexengine)
860{
861public:
862 bool WriteByte(const uint8 i);
863 uint8 ReadByte();
864};
865
866class kexTranslation ///< Not used (garbage included automatically from kexengine)
867{
868public:
869 uint GetGroupIndex(const kStr&in groupName);
870 kStr GetString(const kStr&in key, kexLocPlatform_e plat) const;
871 kStr GetString(int key, kexLocPlatform_e plat) const;
872 kStr GetGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
873 kStr GetGroupString(int key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
874 kStr TranslateString(const kStr&in key, kexLocPlatform_e plat) const;
875 kStr TranslateString(const kStr&in key) const; ///< Same as Game.GetLocalizedText
876 kStr TranslateGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
877 kStr TranslateStringWithArgs(const kStr&in key, const kDict&in pairs, uint plat) const; ///< plat: kexLocPlatform_e
878 kStr TranslateGroupStringWithArgs(const kStr&in key, const kDict&in pairs, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
879};
880
881class ref
882{
883public:
886 ref(const ref&in);
887 ref(const ?&in);
888 void opCast(?&out);
889 ref& opHndlAssign(const ref&in);
890 ref& opHndlAssign(const ?&in);
891 bool opEquals(const ref&in) const;
892 bool opEquals(const ?&in) const;
893};
894
896{
897public:
898 /**
899 * @brief Access to ScriptObject class script obj ref. Should never be null.
900 @code{.cpp}
901 TurokEnemy @enemyObj = cast<TurokEnemy@>(actor.ScriptObject().obj);
902 @endcode
903 */
905};
906
908{
909public:
910 /**
911 * @brief Access to ScriptObjectFx class script obj ref. Should never be null.
912 @code{.cpp}
913 MyCoolFx @coolFx = cast<MyCoolFx@>(fx.ScriptObject().obj);
914 @endcode
915 */
917};
918
919/**
920 * @class ScriptObject
921 * @brief Actor script classes must inherit from this class
922 * @code{.cpp}
923 * class TurokActor : ScriptObject
924 * {
925 * kActor @self;
926 * TurokActor(kActor @actor)
927 * {
928 * @self = actor;
929 * }
930 * }
931 * @endcode
932 */
934{
935public:
936 void OnSpawn(); ///< Required
937 void OnTick(); ///< Required
939 void OnRestore();
941 void OnSleep();
942 void OnWake();
943 void OnTouch(kActor @theActorThatTouchedMe); ///< called even if alseep
944 void OnCollide(kCModel@); ///< called even if alseep
945 void OnCollisionStart(); ///< Collision Movement Check is starting
946 void OnCollisionFinish(); ///< Collision Movement Check has ended
947 void OnMenuTick(); ///< called only when dummymenu active
948 void OnRemoved(); ///< called when actor is removed (Internally or through scripting). IsStale will return true immediately after this, RenderModel will be null, and the scriptobject will be destroyed.
950 void OnDeactivate(); ///< Never used
951 void OnPreDamage(kActor @instigator, kDictMem @damageDef, const int damage); ///< always called when damaged even after death. Call OverrideOnDamageValue on the actor if you need to override the damage value to prevent death.
952 void OnDeath(kActor @killer, kDictMem @damageDef); ///< called only when actor dies
953 void OnDamage(kActor @instigator, kDictMem @damageDef, const int damage); ///< always called even after death
955 void OnPreTick(); ///< For the player script only! Called right before all other actors are ticked
956 void OnPostTick(); ///< For the player script only! Called right after level script ticks
957};
958
959/**
960 * @class ScriptObjectWeapon
961 * @brief Weapon script classes must inherit from this class
962 * @code{.cpp}
963 * class TurokWeapon : ScriptObjectWeapon
964 * {
965 * kWeapon @self;
966 * TurokWeapon(kWeapon @actor)
967 * {
968 * @self = actor;
969 * }
970 * }
971 * @endcode
972 */
974{
975public:
976 void OnBeginFire(); ///< Required
977 void OnFire(); ///< Required
978 void OnEndFire(); ///< Required
979 void OnLower(); ///< Required
980 void OnRaise(); ///< Required
981 void OnHoldster(); ///< Required
982 void OnPreRaise() ///< Optional. Called right when the weapon state is set to raise.
983 void OnActorTick() ///< Optional. Called after the weapon calls OnTick for the kActor class (Should not use. Only here if needed)
984};
985
986/**
987 * @class ScriptObjectPlayer
988 * @brief Player script class must inherit from this class
989 * @code{.cpp}
990 * class TurokPlayer : ScriptObjectPlayer
991 * {
992 * kPuppet @self;
993 * TurokPlayer(kPuppet @actor)
994 * {
995 * @self = actor;
996 * }
997 * }
998 * @endcode
999 */
1001{
1002public:
1003 void OnPickup(kActor @pickup);
1004 void OnArmorDamage(kActor @instigator, kDictMem @damageDef, const int damage);
1006};
1007
1008/**
1009 * @class ScriptObjectFx
1010 * @brief Fx script class must inherit from this class
1011 * @code{.cpp}
1012 * class TurokFx : ScriptObjectFx
1013 * {
1014 * kFx @self;
1015 * TurokFx(kFx @fx)
1016 * {
1017 * @self = fx;
1018 * }
1019 * }
1020 * @endcode
1021 */
1023{
1024public:
1025 void OnTick(); ///< Required
1026 void OnRemoved(); ///< called when actor is removed (Internally or through scripting). IsStale will return true immediately after this.
1027 void OnCollisionStart(); ///< Collision Movement Check is starting
1028 void OnCollisionFinish(); ///< Collision Movement Check has ended
1029 void OnCollide(kCModel @pCModel); ///< Called just before any of the OnImpact functions (except water).
1030 void OnCollidePost(); ///< Called right after OnCollide and the OnImpact functions (except water).
1031 bool OnImpactWall(int impactType, const kVec3 &in normal);
1032 bool OnImpactFloor(int impactType, const kVec3 &in normal);
1033 bool OnImpactCeiling(int impactType, const kVec3 &in normal);
1034 bool OnImpactObject(int impactType, int impactDmgType, kActor@ actor, const kVec3 &in normal);
1035 void OnImpactWater(); ///< Called OnTick after Fx Movement update
1036 void OnExpire(); ///< Called OnTick
1037};
1038
1039/**
1040 * @class kDict
1041 * @brief Editable Dictionary object that holds keys and values
1042 */
1044{
1045public:
1046 void Add(const kStr&in key, const kStr&in value); ///< Adds a new key/value
1047 void Empty(); ///< Removes all keys/values
1048 void SetValue(const kStr&in key, const kStr&in value); ///< Sets the value for the specified key
1049 const bool HasKey(const kStr&in key); ///< Returns true if key exists
1050 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
1051 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
1052 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
1053 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
1054 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
1055};
1056
1057/**
1058 * @class kDictMem
1059 * @brief Read only Dictionary object that holds keys and values
1060 */
1062{
1063public:
1064 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
1065 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
1066 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
1067 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
1068 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
1069};
1070
1071/**
1072 * @class kSelectionListInt
1073 * @brief For selecting a int value based on weights
1074 */
1076{
1077public:
1079 void AddItem(int item, const int weight);
1080 int& Select(); ///< Returns a value based on item weights
1081 void Reset(); ///< clears all items in the list
1082 const uint GetNumEntries() const; ///< returns number of items in the list
1084};
1085
1086/**
1087 * @class kSelectionListFloat
1088 * @brief For selecting a float value based on weights
1089 */
1091{
1092public:
1094 void AddItem(float item, const int weight);
1095 float& Select(); ///< Returns a value based on item weights
1096 void Reset(); ///< clears all items in the list
1097 const uint GetNumEntries() const; ///< returns number of items in the list
1099};
1100
1102{
1103public:
1104 void SetModel(const kStr&in modelPath, const kStr&in modelAnimPath);
1105 void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z, const bool clearInterpolation = false);
1106 void SetRotationOffset(const int nodeIndex, const kQuat&in rotation, const bool clearInterpolation = false);
1107 void SetTexture(const int section, const int textureID);
1108 void SetVisibility(const int nodeIndex, const bool visible);
1109 void HideSection(const int nodeIndex, const int section, const bool hide); ///< section is the surface index. must be 0-31 and must not be >= number of surfaces or will do nothing.
1110 void AddTrailEffect(const kStr&in trailName, const int nodeIndex);
1111 void RemoveTrailEffect(); ///< Removes all trail effects
1115 const int GetNumNodes() const;
1116 kVec3 GetNodeOrigin(const int node, const kVec3&in offset); ///< Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
1117 kQuat GetNodeRotation(const int node); ///< Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
1118 kVec3 GetNodeScale(const int node);
1119 void ForceUpdateJoints(const float interpolatedFraction = 1.0f); ///< Force update node matrices and then call GetNodeOrigin/GetNodeRotation to get current value. interpolatedFraction should be in the range 0.0 (prev) to 1.0 (current). This is an expensive operation so use sparingly.
1122 const bool IsMorph() const;
1123
1124 /**
1125 * @brief Set Morph Updating.
1126 * @param bUpdate: Set to false to handle updating it yourself per ModelFile (not per Actor).
1127 *
1128 Default Tick code:
1129 @code{.cpp}
1130 if(time >= 1.0f)
1131 {
1132 time = 0;
1133 frame++;
1134
1135 if(frame >= maxFrames)
1136 {
1137 frame = 2;
1138 }
1139 nextFrame = frame + 1;
1140 }
1141 time += GAME_DELTA_TIME * 7.5f;
1142 @endcode
1143 */
1144 void SetMorphUpdating(const bool bUpdate);
1145
1146 /**
1147 * @brief Get Morph frame info
1148 * @param frame: 1=Init Frame, 2=Start Loop Frame. >= maxFrames then 1.
1149 * @param nextFrame: 2=Init Frame, 3=Start Loop Frame. >= maxFrames then 2.
1150 * @param maxFrames
1151 * @param time: 0..1 (lerp time between frame and nextFrame meshes)
1152 */
1153 void GetMorphFrame(int&out frame, int&out nextFrame, int&out maxFrames, float&out time) const;
1154 void SetMorphFrame(const int frame, const int nextFrame, const float time);
1155 void ColorOverride(const int node, const float r = 1.0f, const float g = 1.0f, const float b = 1.0f, const float a = 1.0f); ///< color values range from -1.0f to 1.0f. Call ColorOverrideSections to enable the override for sections on the node.
1156 void ColorOverrideSections(const int node, const int sectionMask = -1); ///< enable the color override for specific sections(materials) on the node by setting each bit. -1 = All, 0 = Stop override
1157 void ScaleOverride(const int node, const kVec3 &in scale);
1158};
1159
1161{
1162public:
1163 void Blend(const int animID, float speed, float blend, int flags); ///< EnumAnimStateFlags
1164 void Blend(const int animID, float speed, float blend, int flags, const int frame, const bool runActions = true, const bool noSoundActions = false); ///< EnumAnimStateFlags. Blends the animation to the frame while optionally running all previous actions
1165 void Set(const int animID, float speed, int flags); ///< EnumAnimStateFlags
1166 void Set(const int animID, float speed, int flags, const int frame, const bool runActions = true, const bool noSoundActions = false); ///< EnumAnimStateFlags. Sets the animation to the frame while optionally running all previous actions
1167 const int CurrentFrame(); ///< current frame playing for the current animation. Must have an animation action keyframe for this to work, otherwise use TrackFrame() instead. This should be named more like last frame an action was checked to execute.
1168 const int NumFrames(); ///< number of frames in this animation. Returns -1 if no animation set.
1169 const int NumNodes(); ///< number of nodes in this animation. Returns -1 if no animation set.
1170 const float PlayTime(); ///< increases by GAME_DELTA_TIME if not stopped or paused.
1171 const float TrackTime(); ///< time from 0(on first frame) to 1(on last frame).
1172 bool IsPlaying(const int animID); ///< Returns true if current animations ID is animID and the animation is not stopped.
1173 bool CheckAnimID(const int animID); ///< checks if animID exists
1174 const int PlayingID() const; ///< the current animations ID
1175 void Stop(); ///< flags |= ANF_STOPPED; flags &= ~ANF_LOOP;
1176 void Pause(); ///< flags |= ANF_PAUSED;
1177 void Resume(); ///< flags &= ~ANF_PAUSED;
1178 const bool Stopped() const; ///< (flags & ANF_STOPPED) != 0
1179 const bool Blending() const; ///< (flags & ANF_BLEND) != 0
1180 const bool Looping() const; ///< (flags & ANF_LOOP) != 0
1181 const bool CycleCompleted() const; ///< (flags & ANF_CYCLECOMPLETED) != 0
1182 void ChangeSpeed(const float speed); ///< Scales speed of the current animation where 1.0 = 15fps and 4.0 = 60fps
1183 void SetLastFrame(const bool execActions = false); ///< if execActions is true, runs all key frame actions in the animation except Footstep(55) and PlaySound(248). applies the stop flag (flags |= ANF_STOPPED).
1184 void SetPlayTime(const float time); ///< The total time in seconds this animation has been playing
1185 void SetTrackTime(const float time); ///< 0.0(first frame) to 1.0(last frame)
1186 const int TrackFrame(void) const; ///< current frame playing for the current animation.
1187 const int TrackNextFrame(void) const; ///< next frame to play for the current animation.
1188 kQuat GetRotation(const int animID, int nodeNum, int frame);
1189 kVec3 GetOrigin(const int animID, int nodeNum, int frame);
1190 const int GetAnimNumFrames(const int animID);
1191 const int LoopFrame(); ///< The frame the animation loops back to when it reaches the last frame. Returns -1 if no animation set.
1192 int flags; ///< EnumAnimStateFlags
1193
1194 /**
1195 * @brief is somewhat the Z position of the root node. It's calculated as follows whenever the
1196 * root motion is updated (ANF_ROOTMOTION must be set).
1197 * @code{.cpp}
1198 * // vBlendPos: is the blended position of the root node (node 0) from the prev frame to the current frame.
1199 * // m_pOwner->BaseHeight(): is the Height of the actor when it spawned (or when SetSpawnParams is called on non map actors).
1200 * baseOffset = vBlendPos.z * m_pOwner->Scale().z;
1201 * baseOffset -= m_pOwner->BaseHeight() * 0.6f;
1202 * if(baseOffset < 0) baseOffset = 0;
1203 * @endcode
1204 */
1206 kVec3 rootMotion; ///< the move direction of the root node from the prev frame to the current frame.
1207};
1208
1209/**
1210 * @class kActor
1211 * @brief Base type used by all actors.
1212 */
1214{
1215public:
1216 const bool IsStale() const; ///< Actor is marked as removed and is waiting to be freed from memory when it next checks if there are no more references to this actor.
1220 kVec3& Origin(); ///< Position in world space
1223 void SetTarget(kActor@ actor);
1225 void SetSector(const uint sectorIndex);
1226 void Remove(); ///< Removes the actor and sets stale to true. Actor will only internally be removed when there are no references to this actor.
1230 int16& Health();
1231 int& Type(); ///< The actors Type ID
1232 int& ImpactType(); ///< EnumImpactType
1233 int& ImpactTypeDmg(); ///< EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
1234 bool &IgnoreSectorHeightChange(void); ///< if true will not change position(or velocity and movement) when sector height changes.
1235 bool &IgnoreSectorPlatformChange(void); ///< if true this actor will not change position(or velocity and movement) when sector platform moves.
1238 uint& Flags(); ///< EnumActorFlags
1239 const uint SpawnFlags1() const; ///< EnumActorSpawnFlags1
1240 const uint SpawnFlags2() const; ///< EnumActorSpawnFlags2
1241 const uint SpawnFlags3() const; ///< EnumActorSpawnFlags3
1242 const int TID() const;
1243 float& Radius();
1244 float& Height();
1245 float& StepHeight(); ///< AKA Dead Height. Used for moving up steps, figuring out if in waterheight, and the height of the actor when they are dead so you can still shoot them.
1246 float& WallRadius();
1247 float& Gravity();
1248 float& Friction();
1249 float& AnimSpeed();
1250 float& BounceDamp();
1251 float& FloorHeight();
1253 const int SectorIndex();
1254 const int AreaID() const;
1255 bool InstanceOf(const kStr&in className) const; ///< example: InstanceOf("kexPuppet")
1256 void PlaySound(const kStr&in soundPath);
1257 void PlaySoundWithLookupID(const int soundID);
1260 const int GameTicks() const;
1263 const bool InWater() const;
1264 bool CheckPosition(const kVec3&in origin); ///< checks if the actor can move to this location
1265 bool CheckPosition(const float angle, const float distance); ///< calls CheckPosition(kVec3 origin) with origin being: Actor.Origin() + (angle*distance*Actor.Radius())
1266 float GetTurnYaw(const kVec3&in lookAtLocation) const;
1267 float GetAvoidanceAngle(const kVec3&in lookAtLocation, const float distance);
1268 const float GetWaterHeight() const;
1269 const bool CanSee(kActor@ actor, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1270 uint& ClipFlags(); ///< EnumClipFlags
1271 kDictMem@ Definition(); ///< get actors def data
1272 bool OnGround() const;
1273 int GetWaterLevel() const; ///< EnumWaterLevel
1274 kActor@ CastToActor(); ///< Casts to a kActor. Only used for kPuppet Actor().
1275 kAI@ CastToAI(); ///< Casts to kAI. returns null if isn't a kAI.
1276 kFx @SpawnProjectile(const kStr&in fxPath, const kVec3&in pos, const kVec3&in targetLocation, const float maxAngle); ///< Returns the first Fx spawned. targetLocation.z gets added by GAME_SCALE * 3.0f
1277 void MeleeObject(const kStr&in damageType, const kVec3&in offset, const float radius);
1278 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in pos);
1279 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in pos, const kQuat&in rot);
1281 float DistanceToPoint(const kVec3&in point) const; ///< calls DistanceToPoint(x,y,z)
1282 float DistanceToPoint(const float x, const float y, const float z) const; ///< actors point is in the center
1283 void InflictGenericDamage(kActor@ inflictor, const int damage);
1284 void InflictGenericDamage(kActor@ inflictor, const kexStr &damageDef, const int damage); ///< Can pass in a damage def. The damageDef keys used are mainly for custom scripting purposes only. Only the following keys are used internally when calling this function: bImpact, impactDamp, impactFalloff, bKnockback, knockBackForce
1285 void InflictDamage(kActor@ inflictor, const kStr&in damageDef);
1286 /**
1287 * @brief Calls a script function on all actors that are in the AreaNodes (KD-Tree search) contained inside a bounds. The bounds is calculated as: pos + this actors bounds(model bounds) + this actors radius. This will call for actors not necessarily in the bounds of the actor so checking distance is required in your script function.
1288 * @param pos The world position of where to check for actors
1289 * @param callbackFunc a function on this actors script class that will be called (if it exists) for each actor in range. function header must be: void callbackFunc(kActor@ actor, const float arg1, const float arg2, const float arg3, const float arg4)
1290 */
1291 void InteractActorsAtPosition(const kVec3&in pos, const kStr&in callbackFunc, const float arg1 = 0, const float arg2 = 0, const float arg3 = 0, const float arg4 = 0);
1292 kScriptObject@ ScriptObject(); ///< Returns the ScriptObject that holds the obj ref to the custom script. Will return null if actor doesn't have a custom script or the actor was removed.
1293 const bool MoveToPosition(const float x, const float y); ///< Returns True if new position is in the same sector as the actor else returns false and it set a new sector. Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1294 const bool MoveToPosition(const float x, const float y, uint clipFlags); ///< EnumClipFlags to use. Returns True if new position is in the same sector as the actor else returns false and it set a new sector. Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1295 bool RandomDecision(const int randomBit) const; ///< randomBit should be >= 2. if a random value has the bit set and actors GameTicks also has the bit set then returns true.
1296 void SetPosition(const kVec3&in pos, const bool clearInterpolation = true); ///< best way to set an actors position (if you don't know the sector), will also set the sector and optionally clear interpolation
1297
1298 /**
1299 * @brief Get a map actors param value
1300 * @param paramID
1301 * (0) Target ID -32768..32767
1302 * (1) Trigger Anim 0..255
1303 * (2) Health -32768..32767
1304 * (3) Max Regenerations -32768..32767
1305 * (4) Attach Chance 0..255
1306 * (5) Texture -128..127
1307 * (6) Params 2 -128..127
1308 * (7) Params 1 -128..127
1309 */
1310 const int16 SpawnParams(const int paramID) const;
1311 const float GetCeilingHeight() const; ///< calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
1312 const float GetFloorHeight() const; ///< calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
1313 void RunFxEvent(const kStr&in fxEventName); ///< Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");
1314 void ClearFxEvent(); ///< Clears all data for the actors ActorFx on this actor
1315 bool FxEventActive(); ///< Returns true if ActorFx is running
1316 const int GetSectorIndexAtLocation(const kVec3&in pos, uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1317 void MarkPersistentBit(const bool clear);
1321 void AutomapToggle(const bool show); ///< Use with Game.AutomapCustom(true);
1322 void SetAutomapColor(const int r, const int g, const int b);
1323
1324 /**
1325 * @brief Sets the actors param value. all params are int16.
1326 * @param param
1327 * (0) Target ID -32768..32767
1328 * (1) Trigger Anim 0..255
1329 * (2) Health -32768..32767
1330 * (3) Max Regenerations -32768..32767
1331 * (4) Attach Chance 0..255
1332 * (5) Texture -128..127
1333 * (6) Params 2 -128..127
1334 * (7) Params 1 -128..127
1335 * @param value
1336 */
1337 void SetSpawnParams(const int param, const int16 value);
1338 void SetSpawnFlags1(const uint flags); ///< EnumActorSpawnFlags1
1339 void SetSpawnFlags2(const uint flags); ///< EnumActorSpawnFlags2
1340 void SetSpawnFlags3(const uint flags); ///< EnumActorSpawnFlags3
1341 void SetupSpawnParams(); ///< call after setting your actors spawnflags for them to take effect on the kActor
1342 void SetCustomDeadHeight(const bool bUse, const float height); ///< Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
1343 const float GetCustomDeadHeight();
1345 const bool OverridingKeyTouchTID(); ///< used only for key pickups
1346 const int16 GetOverrideKeyTouchTID(); ///< used only for key pickups
1347 void OverrideKeyTouchTID(const bool bOverride, const int16 tid); ///< used only for key pickups to tell what key it is in the hub
1348 bool& SkipKeyTouchCinema(); ///< used only for key pickups
1349 void SetModel(kStr&in modelFile, kStr&in animFile); ///< a way to set the model/anim for actors that had no model set previously
1350 bool& TriggerInvincibility(); ///< Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
1351 bool &DrawDelay(); ///< Don't draw until has ticked once.
1352 void GetBoundsMinMax(kVec3&out min, kVec3&out max) const; ///< actor must not be sleeping and have a model set and not be a pickup. otherwise will return default min/max values of (-128, -128, -128) (128, 128, 128). Sets the min and max kVec3 values (the actors origin is added to the values)
1353 const int MapActorIndex() const; ///< Returns -1 if not a map actor
1354 int& DifficultyMode(); ///< The difficulty this actor is currently set to
1355 void OverrideOnDamageValue(const int damage, const bool bOverride = true); ///< call in OnPreDamage
1356 bool& NoKnockBack(); ///< Will not receive knock back movement from things like the alien weapon for example.
1357 const float BaseHeight() const; ///< height of actor when spawned or when kAI regenerated
1358 void RunAction(const int funcID, const float w = 0.0f, const float x = 0.0f, const float y = 0.0f, const float z = 0.0f); ///< run a function on the actor defined in defs/animActions.txt
1359 float& AirFriction(); ///< default = 1.0f
1360 float& WaterFriction(); ///< default = 0.5f (same as Friction)
1361 float& Mass(); ///< default = GAME_SCALE * 1.0f
1362 const float GetSkyHeight() const;
1363 bool &ChildOfTarget(void); ///< if this actors Target is an actor that belongs to the owner of the Fx, explosion or melee attack then won't collide/get damaged.
1364 kVec3 DamageOrigin(void) const; ///< The Origin point of the attacker (Fx, Actor, or null (returns this actors origin in that case)) who damaged this actor last. Gets set before OnPreDamage.
1365 kVec3 DamageVelocity(void) const; ///< The Velocity of the attacker (Fx, Actor, or null (returns this actors velocity in that case)) who damaged this actor last. Gets set before OnPreDamage.
1366 const bool CanSee(kPuppet@ puppet, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags). Note: This function that takes in the kPuppet arg is only available for kActor, not for kPuppet or kAI or kWeapon.
1373 const int RefCount() const; ///< Returns the number of references there are to this actor. If actor is stale and RefCount is 0 then it will be removed after the actor ticks.
1374 bool HasCustomRef(void) const;
1375 void AddCustomRef(void); ///< Keeps the actor from getting freed from memory.
1376 void ClearCustomRef(void); ///< Allows the actor to get freed from memory if it has no references. This will be called automatically when level is unloaded.
1377 void SetupHeadTrack(const kStr &in headTrackDef); ///< Sets a headtrack
1378 float &SoundPitchModify(); ///< Override the final pitch of sounds owned by this actor. A value of 1000 raises the pitch by the amount tiny cheat does. A value of -1000 lowers the pitch by the amount the big head cheat does. Set to 0 to stop overriding. if less than 1 will override with no pitch change so tiny and big head mode don't affect it.
1379 void RotateAroundOrigin(const kAngle &in angle, const kVec3 &in platformOrigin, const bool setPos = true); ///< The angle amount to rotate this actors position. if setPos is true will use SetPosition to position the actor else will use MoveToPosition.
1380 void LinkArea(); ///< Links the actor to an area node so that internally the actor can be found in quick searches (similar to a kd-tree) for explosive damage radius checks, when InteractActorsAtPosition is called, kAI GetAttention checks, and collision checks against actors. Should only call whenever you set the actors Origin() directly. Calling MoveToPosition or SetPosition or when the actors movement is updated by velocity changes or by gravity then LinkArea will be called internally.
1381 void CheckLinkArea(); ///< If origin or radius changed since the last LinkArea then calls LinkArea else does nothing. Links the Actor to an area node so that internally the Actor can be found in quick searches (similar to a kd-tree).
1382 float SoundPlayTime(const kStr &in file, const uint index = 0); ///< returns -1.0f if sound is not playing. Returns the amount of time in seconds the sound has been playing for. file is the path to the .ksnd file. use index to specify which sound to check for in the ksnd starting at 0.
1383 bool &RemoveTrailsOnAnimChange(); ///< Will remove all model trails on this actor when animation is set/blend
1384 const float GetCurrentGameSpeed(void) const; ///< Gamespeed of this Actor (default 1.0f)
1385 void SetCurrentGameSpeed(const float speed); ///< Set Gamespeed of this Actor (default 1.0f)
1386 bool &IgnoreGameSpeed(); ///< GameSpeed used for this actor will be CurrentGameSpeed. (Default is true for kPuppet and kPlayerWeapon. Default is False for every other actor)
1387 bool &IgnoreFxGameSpeed(); ///< GameSpeed used for Fx whose source is this actor will always be CurrentGameSpeed. (Default is false)
1388 const float GetGameSpeed() const; ///< Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns CurrentGameSpeed * GlobalGameSpeed.
1389 kFx @DamageFx() const; ///< The kFx that hit this actor. Will be null if no Fx hit this actor. Only use in OnPreDamage/OnDamage/OnDeath. Do not use anywhere else or it could be pointing to a random place in memory then the game will crash!
1390 const float DecayTime(void); ///< Value used to melt kAI when they regen. Values range from 0.0 (normal) to 60.0 (fully melted).
1391 void SetDecayTime(const float value); ///< Used to melt kAI when they regen. Value range should be 0 (normal) to 60 (fully melted).
1392 float RadiusDamageFactor(const kVec3 &in origin, const float radius) const;
1393 bool &UseNewExplosiveRadiusCheck(void); ///< (default False) Set to true to enable explosive damage checks from radius to actor cylinder(more accurate) instead of radius to actors center point.
1394};
1395
1396/**
1397 * @class kActorIterator
1398 * @brief The way to iterate through all actors in the map. Example code:
1399 * @code{.cpp}
1400 * kActorIterator it;
1401 * kActor @actor;
1402 * while((@actor = it.Get()) !is null)
1403 * {
1404 * // Do something with actor
1405 * }
1406 * @endcode
1407 */
1409{
1410public:
1412 kActor@ Get(); ///< Returns the next actor in the iterator
1413 void Reset(); ///< Resets the iterator back to the first actor
1414};
1415
1416class kWeapon : public kActor
1417{
1418public:
1419 kVec3 TransformToOwnerPosition(); ///< returns the OffsetPosition() * the players matrix.
1420 kVec3 TransformToOwnerPosition(const kVec3&in vector); ///< returns the (OffsetPosition() + vector) * the players matrix.
1421
1422 /**
1423 * @brief SpawnsFx at the players at the position passed in * players rotation, then adds the
1424 * viewHeight + landingViewOffset to the z position. Sets PF_FIREDPROJECTILE PlayerFlags.
1425 * adjustToPerspective will change the position you pass in like this:
1426 * @code{.cpp}
1427 * float d = kexMath::Pow(47.5f / fov, fov / 60.0f);
1428 * vOrigin.y *= d;
1429 * vOrigin.z += (1.0f - d) * 2.0f;
1430 * @endcode
1431 */
1432 kFx @FireProjectile(const kStr&in fxPath, const float x, const float y, const float z, const bool adjustToPerspective = false);
1433 bool& PreventFire(); ///< Use in OnBeginFire to internally prevent from entering its Fire state.
1434 bool &NoGenericBobbing(); ///< Disables the generic weapon bobbing menu option from affecting this weapon
1435 kVec3& OffsetPosition(); ///< Offset position of weapon
1436 int& State(); ///< EnumWeaponStates
1437 bool &AllowUnderwater(); ///< Set to true to allow the weapon underwater. Gets reset back to the weapons def value after OnBeginLevel.
1439 bool &ClearInterpolationOffsetPosition(); ///< Set to true to clear the OffsetPosition interpolation after the weapon ticks, then it gets set back to false.
1440 float &PlaySpeed(); ///< Get/Set speed of weapon animations (default = 4.0f)
1441 float &PlaySpeedSwapIn(); ///< Get/Set speed of weapon lower animation (default = 4.0f)
1442 float &PlaySpeedSwapOut(); ///< Get/Set speed of weapon raise animation (default = 3.0f)
1443 float &FOV(); ///< Get/Set weapon FOV (default = 47.5f)
1444 bool &NoWalkAnim(); ///< Get/Set the usage of the walk anim. Run animation will be used instead.
1446
1447};
1448
1449class kAI : public kActor
1450{
1451public:
1452 uint& AIFlags(); ///< EnumAIFlags
1453 void SetupAISpawnFlags(); ///< call after setting your actors spawnflags for them to take effect on the kAI
1454 int& AttackChance(); ///< 0-100
1455 float& AttackRange(); ///< squared
1456 float& MeleeRange(); ///< squared
1457 float& LeashRadius(); ///< squared
1458 float& SightRange(); ///< squared
1459 float& LoudRange(); ///< squared
1460 float& QuietRange(); ///< squared
1461 float& FlyHeight(); ///< squared
1462 float& SightFOV(); ///< in rads
1463 int& Agitation(); ///< 0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE
1464 float& AnimScalar(); ///< default = 1.0f
1465 float& BlendScalar(); ///< default = 10.0f
1466 int &Regenerate(); ///< get/set current number of times the enemy will regenerate value. Regenerate is set right after OnBeginLevel is called and is set to a random value from 0 to the mapActors maxRegenerations value or the actors def ai.maxRegenerations value(for non map actors).
1467};
1468
1469class kPuppet : public kActor
1470{
1471public:
1472 float& ViewHeight(); ///< set from the players def "player.viewHeight". Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1473 float& RecoilPitch(); ///< used for weapon recoil that modifies the players pitch.
1474 const float LandingViewOffset() const; ///< LandingViewOffset changes when jumping and falling. Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1475 uint& PlayerFlags(); ///< EnumPlayerFlags
1478 void SetGroundForwardSpeed(const float speed); ///< default = 10.24f
1479 void SetGroundBackwardSpeed(const float speed); ///< default = -10.24f
1480 void SetGroundStrafeSpeed(const float speed); ///< default = 10.24f
1481 void SetGroundForwardAccel(const float accel); ///< default = 0.05f
1482 void SetGroundBackwardAccel(const float accel); ///< default = 0.05f
1483 void SetGroundStrafeAccel(const float accel); ///< default = 0.05f
1484 void SetGroundDeaccel(const float accel); ///< default = 0.5f
1485 void SetSwimForwardSpeed(const float speed); ///< default = 10.24f
1486 void SetSwimBackwardSpeed(const float speed); ///< default = -10.24f
1487 void SetSwimStrafeSpeed(const float speed); ///< default = 10.24f
1488 void SetSwimForwardAccel(const float accel); ///< default = 0.05f
1489 void SetSwimBackwardAccel(const float accel); ///< default = 0.05f
1490 void SetSwimStrafeAccel(const float accel); ///< default = 0.05f
1491 void SetSwimDeaccel(const float accel); ///< default = 0.5f
1492 void SetJumpMinSpeed(const float speed); ///< default = GAME_SCALE * 0.855f
1493 void SetJumpMaxSpeed(const float speed); ///< default = GAME_SCALE * 1.667f
1494 void SetWalkMaxSpeed(const float speed); ///< default = 4.0f
1495 void SetJumpClimbSpeed(const float speed); ///< default = GAME_SCALE * 0.2875f
1496 void SetOverrideShadow(const int value); ///< 0=none(default), 1=Force Disable shadow, 2=Force Enable shadow
1497 void SetOverrideWalkRun(const int value); ///< 0=none(default), 1=Force Disable Walk
1498 float& Oxygen(); ///< Time in seconds. 0: full oxygen. >= 55: shows air bar. >= 70: OxygenOut is set to true.
1499 bool& OxygenOut(); ///< if true will damage player if underwater
1500 float& OverrideFOV(); ///< set to 1-179. anything else will stop overriding the fov and will use the r_fov cvar.
1501 void SetCrawl(const bool crawl); ///< use this to manually set if the player is crawling instead of setting PF_CRAWLING directly.
1502 const float GroundForwardSpeed() const; ///< default = 10.24f
1503 const float GroundBackwardSpeed() const; ///< default = -10.24f
1504 const float GroundStrafeSpeed() const; ///< default = 10.24f
1505 const float GroundForwardAccel() const; ///< default = 0.05f
1506 const float GroundBackwardAccel() const; ///< default = 0.05f
1507 const float GroundStrafeAccel() const; ///< default = 0.05f
1508 const float GroundDeaccel() const; ///< default = 0.5f
1509 const float SwimForwardSpeed() const; ///< default = 10.24f
1510 const float SwimBackwardSpeed() const; ///< default = -10.24f
1511 const float SwimStrafeSpeed() const; ///< default = 10.24f
1512 const float SwimForwardAccel() const; ///< default = 0.05f
1513 const float SwimBackwardAccel() const; ///< default = 0.05f
1514 const float SwimStrafeAccel() const; ///< default = 0.05f
1515 const float SwimDeaccel() const; ///< default = 0.5f
1516 const float JumpMinSpeed() const; ///< default = GAME_SCALE * 0.855f
1517 const float JumpMaxSpeed() const; ///< default = GAME_SCALE * 1.667f
1518 const float WalkMaxSpeed() const; ///< default = 4.0f
1519 const float ClimbJumpAmount() const; ///< default = GAME_SCALE * 0.2875f
1520 const int OverrideShadow() const; ///< default = 0
1521 const int OverrideWalkRun() const; ///< default = 0
1522 const int GetState(void) const; ///< EnumPlayerStates
1523 float &MaxFallVelocity(void); ///< default = -200.0f
1524 bool &NoWallJump(void); ///< default = false
1525 bool &CustomViewEnable(); ///< Set to true to enable the custom view
1526 bool &CustomViewUnderwater(); ///< whether the custom view is underwater or not
1531 void SetHeadBobScale(const float scale);
1532 void SetTurnBobScale(const float scale);
1533 void SetStrafeBobScale(const float scale);
1534 void SetUnderwaterBobScale(const float scale);
1535 void SetJumpBobScale(const float scale);
1536 void SetOverrideWeaponOnTopFix(const int value); ///< 0=none(default), 1=Force disable fix, 2=Force enable fix (can use console command "g_weaponontopfix" 1 to turn it on as well)
1537 void SetMaxLives(const int value); ///< Max lives allowed from gaining Lifeforces
1538 void SetMaxLifeforces(const int value); ///< Amount of Lifeforces needed to get an extra life
1539 const float HeadBobScale() const;
1540 const float TurnBobScale() const;
1541 const float StrafeBobScale() const;
1542 const float UnderwaterBobScale() const;
1543 const float JumpBobScale() const;
1544 const int OverrideWeaponOnTopFix() const;
1545 const int GetMaxLives() const;
1546 const int GetMaxLifeforces() const;
1547};
1548
1549/**
1550 * @class kActorFactory
1551 * @brief For Spawning Actors
1552 */
1554{
1555public:
1556 kActor@ Spawn(const int actorID, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1557 kActor@ Spawn(const kStr&in actorName, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1558};
1559
1560/**
1561 * @class kFx
1562 */
1563class kFx
1564{
1565public:
1566 const bool IsStale() const; ///< Fx is marked as removed and is waiting to be freed from memory when it next checks if there are no more references to this fx (after OnTick is called).
1567 kAngle& Yaw(); ///< Not used by the Fx
1568 kAngle& Pitch(); ///< Not used by the Fx
1569 kAngle& Roll(); ///< Not used by the Fx
1573 void SetTarget(kActor@ actor);
1575 void SetSector(const uint sectorIndex);
1579 int &ImpactType(); ///< EnumImpactType
1580 int &ImpactTypeDmg(); ///< EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
1582 float &Radius(); ///< (Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
1583 float &Height(); ///< (Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
1584 float &WallRadius();
1585 float &Gravity();
1586 float &Friction();
1587 float &BounceDamp();
1588 float &FloorHeight();
1590 const int SectorIndex();
1591 const int AreaID() const;
1592 bool InstanceOf(const kStr &in className) const; ///< example: InstanceOf("kexFx")
1593 void PlaySound(const kStr &in soundPath);
1594 void PlaySoundWithLookupID(const int soundID);
1597 const float GetWaterHeight() const;
1598 const bool CanSee(kActor@ actor, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1599 bool OnGround() const;
1600 int GetWaterLevel() const; ///< EnumWaterLevel
1601 float DistanceToPoint(const kVec3 &in point) const; ///< calls DistanceToPoint(x,y,z)
1602 float DistanceToPoint(const float x, const float y, const float z) const; ///< Fx point is in the center
1603 const bool MoveToPosition(const float x, const float y); ///< Returns True if new position is in the same sector as the actor else returns false and it set a new sector. Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1604 const bool MoveToPosition(const float x, const float y, uint clipFlags); ///< EnumClipFlags to use. Returns True if new position is in the same sector as the actor else returns false and it set a new sector. Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1605 void SetPosition(const kVec3 &in pos, const bool clearInterpolation = true); ///< best way to set an Fx position without knowing the sector, will also find/set the sector and optionally clear interpolation
1606 const float GetCeilingHeight() const; ///< calculates the ceiling height from the Fx sector and origin. Returns 0 if not in a sector.
1607 const float GetFloorHeight() const; ///< calculates the floor height from the Fx sector and origin. Returns 0 if not in a sector.
1608 const int GetSectorIndexAtLocation(const kVec3 &in pos, uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1609 float &AirFriction();
1611 float &Mass();
1612 const float GetSkyHeight() const;
1613 bool &ChildOfTarget(); ///< Unused. Only used for kActors.
1614 void LinkArea(); ///< Links the Fx to an area node so that internally the fx can be found in quick searches (similar to a kd-tree). Use with Game.GetFxInBounds. Should only call whenever you set the actors Origin() directly and then want to call Game.GetFxInBounds right after. LinkArea will be called automatically in OnTick internally so outside of that case you never need to worry about calling this.
1615 void CheckLinkArea(); ///< If origin or radius changed since the last LinkArea then calls LinkArea else does nothing. Links the Fx to an area node so that internally the Fx can be found in quick searches (similar to a kd-tree). Use with Game.GetFxInBounds. Should only call whenever you set the actors Origin() directly and then want to call Game.GetFxInBounds right after. CheckLinkArea will be called automatically in OnTick internally so outside of that case you never need to worry about calling this.
1616 void Remove(); ///< Removes the Fx and sets stale to true. Fx will only internally be removed when there are no references to this Fx.
1617 const int GameTicks() const;
1618 float RadiusDamageFactor(const kVec3 &in origin, const float radius) const;
1619 bool InWater();
1620 kScriptObjectFx @ScriptObject(); ///< Returns the ScriptObject that holds the obj ref to the custom script. Will return null if kFx doesn't have a custom script.
1622 const bool DrawDelay() const;
1623 const float GetCurrentGameSpeed(void) const; ///< Gamespeed of this Fx (default 1.0f)
1624 void SetCurrentGameSpeed(const float speed); ///< Set the Gamespeed of this Fx (default 1.0f)
1625 const float GetGameSpeed() const; ///< Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns the CurrentGameSpeed * GlobalGameSpeed.
1626 const int RefCount() const; ///< Returns the number of references there are to this Fx. If this Fx is stale and RefCount is 0 then it will be removed after the Fx ticks.
1627 bool HasCustomRef() const;
1628 void AddCustomRef(); ///< Keeps the Fx from getting freed from memory.
1629 void ClearCustomRef(); ///< Allows the Fx to get freed from memory if it has no references. This will be called automatically when level is unloaded.
1630 const int BounceCount() const;
1633 bool &IgnoreGameSpeed(); ///< GameSpeed used for this Fx will always be CurrentGameSpeed. (Default = false)
1634 kActor @GetOwnerAsActor(); ///< Returns null if is not an Actor
1635 kFx @GetOwnerAsFx(); ///< Returns null if is not an Fx
1639 void SetParentFx(kFx@ fx);
1642 const float Distance() const; ///< Distance to the center of the View (Player or Camera) at the time the Fx spawned.
1643 const float Restart() const; ///< Current delay time before the Fx will start ticking
1644 int &Frame(); ///< The sprite frame. Make sure this value is < MaxFrames().
1645 const uint MaxFrames() const; ///< MaxFrames the sprite has. Frame should be < this value.
1646 float &DrawScale(); ///< Current scale of the sprite
1647 float &DrawScaleDest(); ///< When the Fx is updating its scale OnTick, the current draw scale will increase to this value in different ways depending if bScaleLerp is true in the fx file.
1648 float &MaxDrawScale(); ///< The highest value the DrawScale() can become when the Fx is updating its scale OnTick.
1649 float &RotationOffset(); ///< Current Rotation Offset around the Y Axis. kQuat(RotationOffset(), 0.0f, 1.0f, 0.0f);
1650 float &RotationSpeed(); ///< Adds this value * (0.25 * GameSpeed) to RotationOffset() when updating rotation OnTick. This value is set on spawn.
1651 kVec3 &VelocityOffset(); ///< When Fx spawns this is set to the starting velocity of the Fx. And adds to velocity if bAddOffset is true. Has no other use.
1652 void SetColor1(float r, float g, float b, float a); ///< Values range from 0.0 to 1.0. Color and alpha of sprite.
1653 void SetColor2(float r, float g, float b, float a); ///< Values range from 0.0 to 1.0. Environment color of the sprite (used in shaders to blend color1 and color2 together). Alpha is always set to the same as Color1.
1654 void GetColor1(float &out r, float &out g, float &out b, float &out a); ///< Get the color values
1655 void GetColor2(float &out r, float &out g, float &out b, float &out a); ///< Get the color values
1656 const bool SwapBloodColor() const; ///< Is true if fx has bBlood set to true and games blood menu option is set to Green(1). When RandomizeColors() is called which is done automatically when the Fx spawns.
1657 float &Speed(); ///< Initial forward moving speed, set on spawn from forwardSpeed and forwardSpeedRandom in the fx file.
1658 float &MovingForce(); ///< initial velocity.Length() value. if bBullet is true then while updating movement OnTick, if the velocity.length() of the fx is below MovingForce() * 0.65f then removes the Fx.
1660 const int Instances() const; ///< Same as the instances value in the fx file.
1661 float &FrameTime(); ///< The current time left before the Fx sprite tries going to the next frame in the sprite.
1663 const int FxIndex() const; ///< The index in the fx file array
1664 const int InstanceIndex() const;
1665 bool &DoUpdateTickEvents(); ///< If set to false the Fx will not call Tick or WaterTick events.
1666 bool &DoUpdateSpriteAnimation(); ///< If set to false the Fx will not update sprite frame
1667 bool &DoUpdateRotation(); ///< If set to false the Fx will not update rotation offset
1668 bool &DoUpdateScaling(); ///< If set to false the Fx will not update draw scale
1669 bool &DoUpdateFading(); ///< If set to false the Fx will not update color1 and color2 alpha value
1670 bool &DoUpdateMovement(); ///< If set to false the Fx will not move
1671 bool &DoUpdateExpireCheck(); ///< If set to false the Fx will not expire and get removed when lifetime is over
1672 bool &OnCollideForceSetOriginToLast(); ///< If set to true the Fx will set it's origin and sector to what it was before OnCollide was called.
1673 bool &OnCollideForceNoSetOriginToLast(); ///< If set to true the Fx will never set it's origin and sector to what it was before OnCollide was called.
1674 void SpawnImpactFx(const int impactType, const kVec3 &in normal, const bool bUseEvent = true, const bool bBlood = true);
1677 const int FxID() const;
1678 bool InfoFadeout(void) const;
1683 bool InfoLensFlares() const;
1684 bool InfoBlood() const;
1685 bool InfoAddOffset() const;
1686 bool InfoDepthBuffer() const;
1687 bool InfoScaleLerp() const;
1688 bool InfoActorInstance() const;
1689 bool InfoNoDirection() const;
1690 bool InfoFlash() const;
1691 bool InfoProjectile() const;
1693 bool InfoStickOnTarget() const;
1694 bool InfoBullet() const;
1695 bool InfoWeaponView() const;
1696 bool InfoFullScreen() const;
1697 bool InfoDecalOffset() const;
1698 bool InfoNoSpawnNear() const;
1699 bool InfoNoSpawnFar() const;
1702 bool InfoAttachSource() const;
1704 bool InfoDrawOnBottom() const;
1705 bool InfoSparkle() const;
1706 bool InfoCrossFade() const;
1707 bool InfoImpactEffect() const;
1708 bool InfoRestrictAim() const;
1709 bool InfoNoWallSpawn() const;
1710 bool InfoNoGroundSpawn() const;
1711 bool InfoNoHitSource() const;
1713 bool InfoMuzzleEffect() const;
1714 bool InfoDrawDelay() const;
1715 bool InfoBounceImpact() const;
1718 float InfoMass() const;
1721 float InfoGravity() const;
1722 float InfoFriction() const;
1723 float InfoAirFriction() const;
1724 float InfoWaterFriction() const;
1725 float InfoAnimFriction() const;
1727 float InfoScale() const;
1728 float InfoScaleDest() const;
1729 float InfoMaxscale() const;
1730 float InfoForward() const;
1732 float InfoRotationOffset() const;
1733 float InfoRotationSpeed() const;
1734 float InfoRotationPivotX() const;
1735 float InfoRotationPivotY() const;
1736 int InfoLifetime() const;
1738 float InfoRestart() const;
1739 int InfoAnimspeed() const;
1743 int InfoDrawType() const;
1744 int InfoAnimType() const;
1748 float InfoHueRandom() const;
1751 int InfoFadeinTime() const;
1752 int InfoFadeoutTime() const;
1754 int InfoMaxInstances() const;
1755 float InfoSpawnDistOffset() const;
1756 kStr InfoModelName() const; ///< Custom use
1757 kStr InfoAnimName() const; ///< Custom use
1758 kStr InfoUserString() const; ///< Custom use
1759 int InfoUserID() const; ///< Custom use
1760};
1761
1763{
1764public:
1765 void StartCinematic(const uint flags = 12); ///< EnumCameraFlags
1766 void StopCinematic(const bool noFade = false); ///< if noFade is true will stop the cinematic immediately without fading out.
1767 const int CinematicState() const; ///< EnumCameraStates
1770 void SetRotateEyeVector(const kVec3&in vector); ///< The focus position that is used when AutoPlayRotationTrack is called if there is no LookAtActor set.
1771 void SetFinalView(const int view); ///< the view to use for the camera origin and direction. view must be in range 0-2
1772 void SetRotationTrack(const int view, const float startAngle, const float destAngle, const float startDist, const float destDist, const float startEyeZOffset = 0, const float destEyeZOffset = 0, const float startFocusZOffset = 0, const float destFocusZOffset = 0); ///< Use with TweenRotationTrack and AutoPlayRotationTrack.
1773 void SetPositionTrack(const int view, const kVec3&in startEye, const kVec3&in destEye, const kVec3&in startFocus, const kVec3&in endFocus); ///< Sets eye and focus start and dest positions for use with TweenPositionTrack and AutoPlayPositionTrack.
1774 void TweenPositionTrack(const int view, const float time); ///< Lerps eye and focus positions to the start and dest positions using the time param (clamped 0..1). Call SetPositionTrack to set the start and dest positions.
1775 void TweenRotationTrack(const int view, const kVec3&in pos, const float time); ///< Lerps all variables set when SetRotationTrack was called using the time param (clamped 0..1).
1776 void AutoPlayPositionTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenPositionTrack on the view using speed and lerpType
1777 void AutoPlayRotationTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenRotationTrack on the view using speed and lerpType
1778 void AutoPlayBlendTrack(const int viewA, const int viewB, const int viewC, const float speed, const int lerpType); ///< EnumCameraLerpType. Blends between viewB and viewC eye and focus. and sets the results to viewA.
1779 void SetEyeView(const kVec3&in position); ///< position of camera (finalview). finalview must be set or will do nothing.
1780 void SetFocusView(const kVec3&in position); ///< position of where the camera (finalview) is looking at. (Sets look direction from eye and focus positions). finalview must be set or will do nothing.
1781 void ZoomEyeViewToPosition(const kVec3&in position, const float speed); ///< linear lerp finalview eye position to position using speed. finalview must be set or will do nothing.
1782 void ZoomFocusViewToPosition(const kVec3&in position, const float speed); ///< linear lerp finalview focus position to position using speed. finalview must be set or will do nothing.
1783 kVec3 GetEyeView(); ///< position of camera (finalview). finalview must be set or will return vecZero.
1784 kVec3 GetFocusView(); ///< position of where the camera (finalview) is looking at. finalview must be set or will return vecZero.
1785 void ClearFinalView(); ///< finalview is set to null
1786 void ClearViewTracks(); ///< views 0-2 all variables are set to 0
1787 const bool UserInterrupted() const; ///< User pressed left click or escape key or any controller button. While CinematicState() == CAMS_ACTIVE and used EnumCameraFlags CMF_LOCK_PLAYER
1788 void SetUserInterrupted(const bool toggle); ///< set to false to set the user interrupted to false.
1789 const bool Active() const;
1790 const bool Enabled() const; ///< CinematicState() >= CAMS_FADEOUT (Not Idle)
1791 const bool ViewingFromCamera() const; ///< CinematicState() >= CAMS_FADEIN && CinematicState() <= CAMS_ACTIVE_TO_FADEOUT
1792 kVec3& Tremor(); ///< x = adds to yaw, y = adds to pitch, z = adds to roll. lerps to vecZero using lerpTime of GAME_FRAME_TIME.
1793 void SetSector(const uint sectorIndex);
1794 const int SectorIndex();
1795 const int AreaID() const;
1797 const uint Flags() const; ///< EnumCameraFlags
1798 kVec3 origin; ///< current position of camera. if a finalview is set then the origin will be set to the finalview's eye position.
1799 kAngle yaw; ///< if a finalview is set then the yaw will be set to the finalview's look direction.
1800 kAngle pitch; ///< if a finalview is set then the pitch will be set to the finalview's look direction.
1801 kAngle roll; ///< if a finalview is set then the roll will be set to 0.
1802 float fov; ///< Camera FOV (default is 74.0)
1803 float lookZOffset; ///< Used only if LookAtActor has been set.
1804 bool &ClearInterpolationOnTick(void); ///< set to false to handle interpolation yourself
1805 bool &AllowMenusWhenActive(void); ///< set to true to allow the pause menu to be opened during a cinematic
1806};
1807
1808/**
1809 * @class kCModel
1810 * @brief The kCModel(CModel) global stores collision results when certain actor methods are called. Those methods are as follows:
1811 * GetSectorIndexAtLocation
1812 * const bool CanSee(kActor@, const uint = 0)
1813 * MoveToPosition
1814 * SpawnProjectile
1815 * bool CheckPosition(const kVec3 &in)
1816 */
1818{
1819public:
1820 kVec3& InterceptVector(); ///< Returns the vector that intersected the collided geometry
1821 kVec3& ContactNormal(); ///< Returns the normalized vector of the collided surface
1822 const float& Fraction(); ///< returns the 0.0 - 1.0 range of the point of intersection from start to end trace. (If fraction is == 1.0 then no intersection occured.)
1823 const uint ClipResult(); ///< specifies the type of intersection (flags)
1824 kActor@ ContactActor(); ///< handle pointer to actor that was collided (null if none was collided)
1825 kVec3& MoveDirection(); ///< Movement vector of the object
1826};
1827
1829{
1830public:
1831 const int Ticks() const; ///< affected by gamespeed (Ticksf truncated)
1832 const float Ticksf(void) const; ///< affected by gamespeed
1833 const int UnscaledTicks() const; ///< Not affected by GameSpeed
1836 void CheckKeys(); ///< Prints HUD messages to tell the player how many keys they've found on the current HUBID
1837 void ChangeMap(const kStr&in mapName);
1838 void StartWarp(kActor@ actor, const int tagID, const int mapID);
1839 void StartFreeWarp(kActor@ actor, const kVec3&in origin, const float yaw, const int sectorIndex, const int mapID);
1840 void HandlePlayerDeath(const bool loseLife = true); ///< if loseLife is true and infinite lives cheat is off then player loses a life. if player lives is < 0 then GameOver is called. If has >= 0 lives left then will ChangeMap to the current set check point, or use the current map if no check point is set.
1841 const bool CheckWarping(); ///< Checks if Warping or FreeWarping is in progress.
1842 const bool CanOpenPauseMenu(); ///< Checks if it's okay to be able to open a menu
1843 const bool CanOpenSaveMenu(); ///< Checks if it's okay to be able to open the save menu
1844 const int NewMapWarpTID(); ///< Returns the warp TID the player warped to from another map. Returns -1 of didn't warp from another map. Check before OnPostBeginLevel.
1845 void ClearWarpInterpolation(void); ///< Clearing the interpolation for kPuppet will also clear the warp interpolation.
1846};
1847
1848class kSys
1849{
1850public:
1851 void Print(const kStr&in message);
1852 void Warning(const kStr&in message);
1855 int Mouse_X();
1856 int Mouse_Y();
1857 const bool GetCvarValue(const kStr&in cvarName, kStr&out result);
1858 void MouseToHUD(float&out x, float&out y); ///< Returns the HUD position of the mouse
1859 void MouseToHUDNoStretch(float&out x, float&out y); ///< Returns the HUD position of the mouse
1860};
1861
1863{
1864public:
1865 kActor@ GetActorByTID(const int tagID, const int typeFilter = - 1) const; ///< if typeFilter is -1 checks any type otherwise only returns the actor of that type
1866 bool TriggerActorsByTID(kActor@ instigator, const int tagID); ///< Triggers an actor (that is not the instigator) that has the same tagID. Returns true if triggered an actor.
1867 void ChangeAreaFlag(const int areaID, const uint flags, const bool active); ///< (EnumAreaFlags) Only sets the areaID flags and not the sector flags. Should most likely prefer using FloodMatchingAreaFlags so the sectors get set as well.
1868 void FloodFillAreaFlags(const int sectorIndex, const uint flags, const bool active); ///< (EnumAreaFlags) Sets flags on all adjacent sectors until it finds a sector that has the flags already set (or cleared if active is false)
1869 void FloodFillAreaFlags(const kVec3&in origin, const uint flags, const bool active); ///< (EnumAreaFlags) Calls FloodMatchingAreaFlags with FindNextClosestSector(origin) sector.
1870 void FloodMatchingAreaFlags(const int sectorIndex, const uint flags, const bool active); ///< (EnumAreaFlags) Sets flags on all adjacent sectors with matching areaID.
1871 const uint GetAreaFlags(const int areaID) const; ///< EnumAreaFlags
1872 const int GetAreaFloorImpact(const int areaID) const; ///< EnumImpactType
1873 const int GetAreaWallImpact(const int areaID) const; ///< EnumImpactType
1874 void ChangeAreaFloorImpact(const int areaID, const int value); ///< value: EnumImpactType
1875 void ChangeAreaWallImpact(const int areaID, const int value); ///< value: EnumImpactType
1876 void ChangeAreaWaterHeight(const int areaID, const float height); ///< WaterHeight is stored per area, not per sector or per vertex.
1877
1878 /**
1879 * @brief Returns an area arg value
1880 * @param areaID
1881 * @param arg
1882 @code{.cpp}
1883
1884 though args can be used for anything, they are typically used in this fashion:
1885 0: warp ID
1886 1: warp level ID or trigger sound ID
1887 2: checkpoint ID
1888 3: tag ID
1889 4: floor damage hit points
1890 5: floor damage rate
1891
1892 Hardcoded:
1893 0: AAF_TELEPORT: WarpID
1894 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1895 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1896 3: AAF_EVENT: tag ID
1897 4: Not used
1898 5: AAF_SECRET: the secret index value (set automatically when level loads starting at 0. Conflicts with AAF_DAMAGE (so I guess no secrets should be placed on damage sectors))
1899
1900 Default Scripts:
1901 0: Not used
1902 1: Not used
1903 2: Not used
1904 3: Not used
1905 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1906 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1907 @endcode
1908 */
1909 const int16 GetAreaArg(const int areaID, const int arg) const;
1910
1911 /**
1912 * @brief
1913 * @param areaID
1914 * @param arg
1915 @code{.cpp}
1916
1917 though args can be used for anything, they are typically used in this fashion:
1918 0: warp ID
1919 1: warp level ID or trigger sound ID
1920 2: checkpoint ID
1921 3: tag ID
1922 4: floor damage hit points
1923 5: floor damage rate
1924
1925 Hardcoded:
1926 0: AAF_TELEPORT: WarpID
1927 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1928 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1929 3: AAF_EVENT: tag ID
1930 4: Not used
1931 5: AAF_SECRET: the secret index value (set automatically when level loads starting at 0. Conflicts with AAF_DAMAGE (so I guess no secrets should be placed on damage sectors))
1932
1933 Default Scripts:
1934 0: Not used
1935 1: Not used
1936 2: Not used
1937 3: Not used
1938 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1939 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1940 @endcode
1941 * @param value
1942 */
1943 void ChangeAreaArg(const int areaID, const int arg, const int16 value);
1944 void ChangeSectorHeight(const int sectorIndex, const float height); ///< Changes all sectors floor vertices with the same areaID to the height
1945 void ChangeSectorCeilingHeight(const int sectorIndex, const float height); ///< Changes all sectors ceiling vertices with the same areaID to the height
1946 void ChangeSectorCeilingHeightVertices(const int sectorIndex, const float height, const int ptMask = 7); ///< Changes only the sector ceiling vertices(specified using the ptMask) to the height.
1947 void ChangeSectorHeightVertices(const int sectorIndex, const float height, const int ptMask = 7); ///< Changes only the sector floor vertices(specified using the ptMask) to the height.
1948 const int FindNextClosestSector(const kVec3&in origin); ///< Returns the sector that this point is best in. Returns -1 if not inside and above/on a sector.
1949 const int FindClosestSectorByDistance(const kVec3&in origin); ///< Returns the closest sector. Will return -1 only if the map contains no sectors.
1950
1951 /**
1952 * @brief Get the Sectors vertex position and height
1953 * Link 1 is pt1 to pt3
1954 * Link 2 is pt2 to pt1
1955 * Link 3 is pt3 to pt2
1956 * @param sectorIndex
1957 * @param pt1
1958 * @param pt2
1959 * @param pt3
1960 * @param heights: x is the height of pt1, y is the height of pt2, z is the height of pt3.
1961 */
1962 void GetSectorCorners(const int sectorIndex, kVec3&out pt1, kVec3&out pt2, kVec3&out pt3, kVec3&out heights) const;
1963
1964 /**
1965 * @brief Get the Sectors vertex indices. If invalid sectorIndex is passed in will return all -1.
1966 * @param sectorIndex
1967 * @param v1
1968 * @param v2
1969 * @param v3
1970 */
1971 void GetSectorVertIndices(const int sectorIndex, int &v1, int &v2, int &v3) const;
1972
1973 /**
1974 * @brief Get the 3 sectors links. -1 means there was no sector linked to that edge.
1975 * Link 1 is pt1 to pt3
1976 * Link 2 is pt2 to pt1
1977 * Link 3 is pt3 to pt2
1978 * @param sectorIndex
1979 * @param sectorIndex1
1980 * @param sectorIndex2
1981 * @param sectorIndex3
1982 */
1983 void GetSectorLinks(const int sectorIndex, int&out sectorIndex1, int&out sectorIndex2, int&out sectorIndex3) const; ///< a sectorIndex with -1 is no sector.
1984 const uint GetSectorNumBridges(const int sectorIndex) const; ///< number of bridge sectors this sector has
1985 const int GetSectorBridge(const int sectorIndex, const uint bridge) const; ///< Get the sector of the bridge. Use GetSectorNumBridges to loop through them all.
1986 const int GetSectorAreaID(const int sectorIndex) const;
1987 const int GetNumSectors() const;
1988 const int GetNumAreas() const;
1989 const int GetNumActors() const; ///< number of actors that are in the current maps data
1990 const int GetSectorFlags(const int sectorIndex) const; ///< Returns a 16 bit unsigned integer. Only the first 16 area flags (up to AAF_MAPPED) are used for sectors.
1991 void SetSectorFlags(const int sectorIndex, const int flags); ///< Keep in mind sector flags are a 16 bit unsigned integer and only the first 16 area flags (up to AAF_MAPPED) are used for sector flags.
1992 const kStr GetSkyMaterial() const;
1993 void OverrideSkyMaterial(const kStr &in path); ///< Example path: "skies/skyMaterials/sky_brown" You can clear the sky with an empty string: "" Do not pass in invalid paths!
1994 void OverrideFogColor(const int r, const int g, const int b); ///< rgb values are 0-255
1995 void ClearOverrideFogColor(); ///< Stops overriding and uses the sector color
1996 void OverrideWaterFogColor(const int r, const int g, const int b); ///< rgb values are 0-255
1997 void ClearOverrideWaterFogColor(); ///< Stops overriding and uses the sector color
1998 const int FindClosestSectorByDistance(const kVec3&in origin);
1999 const float GetAreaWaterHeight(const int area) const;
2000 const float GetAreaFogZFar(const int area) const;
2001 void SetAreaFogZFar(const int area, const float zfar);
2002 const float GetAreaWaterZFar(const int area) const;
2003 void SetAreaWaterZFar(const int area, const float zfar);
2004 const kVec3 GetAreaFogColor(const int area) const; ///< color values are in range 0-255
2005 void SetAreaFogColor(const int area, const kVec3 &in color); ///< color values are in range 0-255
2006 const kVec3 GetAreaWaterColor(const int area) const; ///< color values are in range 0-255
2007 void SetAreaWaterColor(const int area, const kVec3 &in color); ///< color values are in range 0-255
2008 const float GetAreaSkyHeight(const int area) const;
2009 void SetAreaSkyHeight(const int area, const float height);
2010 const float GetAreaSkySpeed(const int area) const; ///< speed scale is this value / 100. 100 is normal speed.
2011 void SetAreaSkySpeed(const int area, const float speed); ///< speed scale is this value / 100. 100 is normal speed.
2012 const float GetAreaBlendLength(const int area) const; ///< the speed to interpolate the fog color/start/zfar values when they change
2013 void SetAreaBlendLength(const int area, const float blendLength); ///< a blendLength value of 1.0 interpolates the fog color/start/zfar values at 0.066666 (1/15) per tick.
2014 const int GetAreaAmbience(const int area) const;
2015 void SetAreaAmbience(const int area, const int ambience);
2016 const int GetAreaMapColor(const int area) const;
2017 void SetAreaMapColor(const int area, const int color);
2018 const int GetAreaMusic(const int area) const;
2019 void SetAreaMusic(const int area, const int music);
2020 const int GetAreaCullBits(const int area) const; ///< if any staticmeshes cullBits have any of the area cullBits set then it will draw. (default callbits is 255)
2021 void SetAreaCullBits(const int area, const int bits); ///< if any staticmeshes cullBits have any of the area cullBits set then it will draw. (default callbits is 255)
2022 const int GetSectorDrawOrder(const int sectorIndex) const; ///< lowest draw order (0) draws the sectors on the automap last
2023 void SetSectorDrawOrder(const int sectorIndex, const int drawOrder); ///< lowest draw order (0) draws the sectors on the automap last
2024 void MoveSectorPlatform(const int sectorIndex, const kVec3 &in moveDelta, const uint flags = SPF_DEFAULT); ///< EnumSectorPlatformFlags. Moves bridge sectors vertices not connected to non bridge sectors by moveDelta amount affecting actors
2025 const bool PointInsideSector(const int sectorIndex, const kVec3 &in point) const; ///< Returns true if point is inside the sector (XY only)
2026};
2027
2029{
2030public:
2031 void CallDelayedMapScript(const kStr&in funcName, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
2032 void CallDelayedMapScript(const int scriptID, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
2033 void CallMapScript(const int scriptID, kActor@ instigator); ///< Use to call map script right away
2034 void HaltMapScript(const int scriptID);
2035 void PlaySound(const kStr&in path);
2036 void PlaySoundID(const int soundID);
2037 void PlayMusic(const kStr&in path, const bool loop); ///< Use PlayMusicID instead.
2042 float MusicPlayTime(); ///< Returns the amount of time the music has been playing for in seconds. Doesn't reset back to 0 when looping. if no music is playing returns -1.0
2044 void MusicPitch(const float pitch);
2045
2046 /**
2047 * @brief Start controller vibration from tactile sound file. Returns a handle.
2048 * @param path the path to the .bnvib file
2049 * @param channel kexVibrationPlayer::channel_e
2050 * @param pos kexVibrationPlayer::position_e
2051 */
2052 int PlayTactile(const kStr&in path, int channel, int pos);
2053 bool IsTactilePlaying(int vibHandle);
2054 bool IsTactilePlaying(int vibHandle, const kStr&in path);
2056 void StopTactile(int vibHandle);
2058 void Restart();
2059
2060 /**
2061 * @brief Print a message to the HUD
2062 * @param text
2063 * @param lineNumber must be in range 0..7
2064 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
2065 */
2066 void PrintLine(const kStr&in text, const int lineNumber, const int ticks = 120);
2067 /**
2068 * @brief Print a message to the HUD on the next line.
2069 * @param text
2070 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
2071 */
2072 void Print(const kStr &in text, const int ticks = 120);
2073 void PrintHelp(const kStr&in text, const bool endGame = false);
2077 void ChangeMap(const kStr&in path);
2078 void ShowMainMenu(const bool mouseCenter = true);
2079 const int GetMapNumberFromName(const kStr&in mapName); ///< This returns the HUB number NOT the map number. mapName is the HUB name such as "Map_Jungle". Returns -1 if not found.
2080 const int GetMapIDFromName(const kStr &in mapName); ///< This returns the mapID from the mapName. Returns -1 if not found.
2081 const int GetCurrentMapID();
2082 const int GetDifficulty(); ///< EnumDifficulty. Internally calls GameVariables.GetInt("g_difficulty")
2083 void SetDifficulty(const int value); ///< EnumDifficulty
2085
2086 /**
2087 * @brief Sets the current GameSpeed. kPuppet and kPlayerWeapon are not affected by GameSpeed.
2088 * @param speed 0..1
2089 * @param blendSpeed must be >= 1.0. This is the time it takes to lerp from current speed to the new speed. (lerp time = 1.0 / blendSpeed)
2090 */
2091 void SetGameSpeed(const float speed, const float blendSpeed);
2092 bool GetHubKeyInfo(const uint hubID, int&out nKeys, int&out remainingKeys, int&out keyBits);
2093 bool SetHubKey(const uint hubID, int key);
2094 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
2095 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
2096 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const kQuat&in rotation);
2097 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const kQuat&in rotation);
2098 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const float yaw, const float pitch);
2099 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const float yaw, const float pitch);
2100 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in origin, const int sectorIndex);
2102 const bool AutomapEnabled(); ///< is the automap displaying on screen
2103 const bool AutomapDeactived();
2104 void AutomapToggle(const bool toggle); ///< show/hide the automap.
2105 void AutomapDeactive(const bool toggle); ///< permanently deactivates the automap.
2106 void AutomapCustom(const bool toggle); ///< allow actors with custom automap colors to be drawn to the automap. (for mods)
2107 void LifeForcePulse(); ///< Shows the LifeForces on the HUD
2108 void LivesPulse(); ///< Shows the Lives on the HUD
2109 void RunWalkPulse(); ///< Shows the RunWalk graphic on the HUD
2110 void WeaponWheelPulse(); ///< Shows the WeaponWheel on the HUD
2111 bool SetWeaponWheelPic(const int weapon, const kStr&in imagePath);
2112 bool ClearWeaponWheelPic(const int weapon);
2113 void SetLivesPic(const kStr&in imagePath);
2115 void SetLifeForcePic(const kStr&in imagePath);
2117 void MessageBox(const kStr&in msg1, const kStr&in msg2);
2118
2119 /**
2120 * @brief
2121 * @param msg1 top line
2122 * @param msg2 bottom line
2123 @code{.cpp}
2124 // Usage:
2125 Game.ConfirmMenu("Confirm This", "Is that correct?");
2126
2127 // Then check for result on Tick:
2128
2129 int result;
2130 GameVariables.GetInt("ConfirmMenuResult", result);
2131 switch(result)
2132 {
2133 case 1:
2134 Sys.Print("Selected No");
2135 GameVariables.SetValue("ConfirmMenuResult", "0");
2136 break;
2137 case 2:
2138 Sys.Print("Selected Yes");
2139 GameVariables.SetValue("ConfirmMenuResult", "0");
2140 break;
2141 default: // There's no ConfirmMenuResult waiting
2142 break;
2143 }
2144 @endcode
2145 */
2146 void ConfirmMenu(const kStr&in msg1, const kStr&in msg2);
2147 void SaveMenu(); ///< Opens the save game menu. Should always check if(PlayLoop.CanOpenSaveMenu())
2148 void LoadMenu(); ///< Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
2149 void SetDamageFlash(); ///< Shows the damage screen flash
2150 void SetPickupFlash(); ///< Shows the pickup screen flash
2151 void SetArmorFlash(); ///< Shows the armor damage screen flash
2152 const uint ConButtons(); ///< EnumPlayerConButtons
2153 uint MenuButtons(void) ///< EnumGameButtonEvents
2154 const int64 GetTimestamp();
2155 void GetDateAndTime(int&out seconds, int&out minutes, int&out hours, int&out day, int&out month, int&out year, kStr&out text);
2158
2159 /**
2160 * @brief add custom text to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
2161 * if the id already exists then simply sets all its variables.
2162 * @param font EnumGameFontType
2163 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2164 */
2165 void AddText(const int id, const int font, const kStr &in text, const float x, const float y,
2166 const int edge = 0, const float scale = 1.0f, const bool center = false, const bool shadow = false,
2167 const int r = 255, const int g = 255, const int b = 255, const int a = 255,
2168 const int r2 = 255, const int g2 = 255, const int b2 = 255, const int a2 = 255);
2169 bool SetTextMsg(const int id, const kStr &in text);
2170 bool SetTextOrigin(const int id, const float x, const float y);
2171 bool SetTextColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2172 bool SetTextColors(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255, const int r2 = 255, const int g2 = 255, const int b2 = 255, const int a2 = 255);
2173
2174 /**
2175 * @brief Set the text scale, font, edge, center, shadow
2176 * @param font EnumGameFontType
2177 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2178 */
2179 bool SetTextProps(const int id, const float scale, const int font = 0, const int edge = 0, const bool center = false, const bool shadow = false);
2180 void SetTextOrder(const int id, const int order);
2181 void ClearTextInterpolation(const int id);
2182 bool RemoveText(const int id);
2184 void GetTextSize(const kStr &in text, const int font, const float scale, float &out width, float &out height); ///< EnumGameFontType
2185 float GetHUDOffset(const bool user = false); ///< if user is false will return the width to the edge of the screen (negative value). if true will return the width from the menu option "HUD Position".
2186 float GetHUDOffsetNoStretch(const bool user = false); ///< if user is false will return the width to the edge of the screen (negative value). if true will return the width from the menu option "HUD Position".
2187
2188 /**
2189 * @brief add custom image to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
2190 * if the id already exists then simply sets all its variables.
2191 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2192 */
2193 bool AddPic(const int id, const kStr &in path, const float x, const float y, const float w, const float h, const int edge = 0,
2194 const float s1 = 0.0f, const float t1 = 0.0f, const float s2 = 1.0f, const float t2 = 1.0f,
2195 const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2196 bool SetPicTex(const int id, const kStr &in path);
2197 bool SetPicOrigin(const int id, const float x, const float y);
2198 bool SetPicEdge(const int id, const int edge); ///< edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2199 bool SetPicAngle(const int id, const float angle); ///< in rads
2200 bool SetPicWH(const int id, const float w, const float h);
2201 bool SetPicUV(const int id, const float s1 = 0.0f, const float t1 = 0.0f, const float s2 = 1.0f, const float t2 = 1.0f);
2202 bool SetPicColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2203 void SetPicOrder(const int id, const int order);
2204 void ClearPicInterpolation(const int id);
2205 bool RemovePic(const int id);
2206 void ClearPics(const bool clearImageCache = false);
2207 bool& HideHealth(); ///< Hide health display on the HUD
2208 bool& HideAmmo(); ///< Hide ammo display on the HUD
2209 bool& HideLifeForces(); ///< Hide LifeForces display on the HUD
2210 bool& HideRunWalk(); ///< Hide RunWalk display on the HUD
2211 bool& HideLives(); ///< Hide Lives display on the HUD
2212 bool& HideBossBar(); ///< Hide BossBar display on the HUD
2213 bool& HideAirBar(); ///< Hide AirBar display on the HUD
2214 bool& HideWeaponWheel(); ///< Hide WeaponWheel display on the HUD
2215 bool& HideCrosshair(); ///< Hide Crosshair display on the HUD
2216 bool& HideHelpMessages(); ///< Hide HelpMessages display on the HUD
2217 bool& HideMessages(); ///< Hide Messages display on the HUD
2218 bool& HideTimers(); ///< Hide Timers display on the HUD
2219 const float GetMaxZDrawDistance(); ///< Returns GetExtraZFar + the max z-draw distance from the active map def.
2220 const float GetExtraZFar(); ///< a custom amount for modders to add to the zfar value
2221 void SetExtraZFar(const float zfar); ///< affects actors, ai, particles, fog and underwater. (works normally unlike the cvar r_zfarextent)
2222 const float ShakeIntensity();
2224 bool SphereInView(const kVec3&in origin, const float radius);
2225 bool BoxInView(const kVec3&in min, const kVec3&in max);
2226 const float ViewZFar();
2227 void SaveModFile(const kStr&in filename); ///< Saves a custom save file. make sure to call GameModFileData.Empty() before adding key/values to save
2228 bool LoadModFile(const kStr&in filename); ///< Loads a custom save file. make sure to call GameModFileData.Empty() after you're done loading
2229 bool LoadModDataFile(const kStr&in filename); ///< Load any file in your mod that is a kDict binary. Use the python T1_json2modbin.py on the main scripting manual page to convert a json file to a kDict binary. Returns false if couldn't load file. Clears and Sets GameModFileData with the contents of the loaded file.
2230 void SetNoModSelect(const bool bToggle = true); ///< Disable the mod select menu when selecting new game for workshop mods only. (seta g_nomodselect "1")
2231 void PlayMovie(const kStr&in filename, const bool skippable = true); ///< Only .ogv or .webm files (replaces/adds extension to filename automatically). Can not read from kpfs.
2232
2233 /**
2234 * @brief Returns the key bind name of action. Returns empty string if nothing is bound.
2235 * @param action EnumInputActions
2236 * @param first if is false returns a string of all the bound keys separated by the ; character.
2237 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
2238 */
2239 kStr GetActionBind(const int action, const bool first = true, const bool sort = true);
2240
2241 /**
2242 * @brief Returns the key bind name of the console command. Returns empty string if nothing is bound.
2243 * @param command the name of the console command.
2244 @code{.cpp}
2245 "weapon 0" to "weapon 13"
2246 "automap"
2247 "changeammotype"
2248 "runwalktoggle"
2249 "menu_up"
2250 "menu_down"
2251 "menu_left"
2252 "menu_right"
2253 "*menu_select"
2254 "menu_back"
2255 "menu_cancel"
2256 "menu_activate"
2257 @endcode
2258 * @param first if is false returns a string of all the bound keys separated by the ; character.
2259 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
2260 */
2261 kStr GetCommandBind(const kStr&in command, const bool first = true, const bool sort = true);
2262 bool IsJoystickActive(); ///< if true the players last input was from a controller.
2263 kStr GetInputImagePath(const kStr&in bindName);
2264 bool InputImageExists(const kStr&in path);
2265 void SetCursorHotPos(int x, int y); ///< change the mouses cursors click point (default is 0, 0)
2266 void SetModBindings(const bool show = true); ///< Shows custom mod bindings in menu Bindings > Actions
2267 kStr PlayerName(); ///< Returns "Player" if could not get name
2268 void MarkActorPersistentBit(const int actorIndex, const bool clear = false, const int hubID = -1, const int mapNum = 0); ///< an invalid hub or map uses current maps persistent data.
2269 const bool IsActorPersistentMarked(const int actorIndex, const int hubID = -1, const int mapNum = 0); ///< an invalid hub or map uses current maps persistent data.
2271 void SetPreventOpenPauseMenu(const bool value);
2272 void ShowPauseMenu(); ///< Should always check if(PlayLoop.CanOpenPauseMenu())
2273 void OverrideSkyHeight(const float height); ///< Set to 0 to stop overriding
2274 const int BossDamageScaler(const int difficulty, const int damage);
2275 int PurgeUnusedModels(); ///< Returns number of models freed
2280 void SetWorldSunLightColor(const float r, const float g, const float b);
2281 void SetWorldSunAmbientColor(const float r, const float g, const float b);
2282 void SetWorldSunDirection(const float x, const float y, const float z);
2283 bool IsWorkshop(); ///< Returns true if game was run through the steam workshop (ran with command arg -workshop)
2284 void OverridePerPolyCollision(const int value); ///< 0=none, 1=force disable, 2=force enable
2285 void OverrideBloom(const int value); ///< 0=none, 1=force disable, 2=force enable
2286 void DisableLegalText(); ///< Removes the text at the bottom of the title screen
2287 void OverrideFogType(const int value); ///< 0=none, 1=force Radial, 2=force Plane
2288 void ClearInterpolationOnGameObjects(); ///< Clears Interpolation on all gameobjects and the camera if it's active
2289 void ShowDummyMenu(void); ///< Actors OnMenuTick function will now be processed. Call ClearDummyMenu to close the dummy menu.
2290 void ClearDummyMenu(bool bClearAll = false);
2291 void ToggleCursor(bool b = false);
2293 void OpenOptionsMenu(); ///< saves config file when exiting this menu
2304 bool EnemiesAlwaysDropItems(); ///< Returns the gameplay menu option value
2305 void OverrideRespawningEnemies(const int value); ///< Set: Game.OverrideRespawningEnemies(); Get: GameVariables.GetInt("OverrideRespawningEnemies", result); 0=none, 1=force disable, 2=force enable
2306 void PlayMusicID(const int musicID, const int fadeTimeMS = 500, const bool loop = true); ///< MusicID -2 plays previous track, -1 stops the music.
2308 bool IsRunningMapScript(const int scriptID);
2309 kStr GetMapNameFromID(const int mapID); ///< Finds the name of the map with the mapID
2310 const float GetMaxZDrawDistance(); ///< Returns GetExtraZFar + the max z-draw distance from the active map def.
2311 bool IsCheatActive(const int cheatBits); ///< EnumCheatFlags. Returns true if cheats are active
2312 void SetWaterReflectionAlpha(const float alpha); ///< Default is 1.0f
2313 void EnableWaterReflectionViewPoint(const bool enable);
2314 void SetWaterReflectionViewPoint(const kVec3 &in point);
2315 void NextSoundVolumeScale(const float volume); ///< The next play sound will scale the volume by this much
2316 void NextSoundPitchScale(const float pitch); ///< The next play sound will scale the pitch by this much
2317 kDictMem @GetActorDef(const kStr &in name); ///< Returns the Actors Def by name
2318 kDictMem @GetActorDef(const int type); ///< Returns the Actors Def by it's type
2319 void GetActorInBounds(const kVec3 &in min, const kVec3 &in max); ///< The array of actors is stored in Game.GetActorResult. (KD-Tree search). Each actors bounds is calculated as MAX(radius, height) + position.
2320 void GetFxInBounds(const kVec3 &in min, const kVec3 &in max); ///< The array of Fx is stored in Game.GetFxResult. (KD-Tree search). Each Fx bounds is calculated as MAX(radius, height) + position.
2321 void GetSectorInBounds(const kVec3 &in min, const kVec3 &in max); ///< The array of sectors is stored in Game.GetSectorResult. (KD-Tree search)
2322 uint GetActorResultsLength(); ///< Use after calling Game.GetActorInBounds
2323 uint GetFxResultsLength(); ///< Use after calling Game.GetFxInBounds
2324 uint GetSectorResultsLength(); ///< Use after calling Game.GetSectorInBounds
2325 kActor @GetActorResult(const uint index); ///< Use after calling Game.GetActorInBounds. Do not use at any other point!
2326 kFx @GetFxResult(const uint index); ///< Use after calling Game.GetFxInBounds. Do not use at any other point!
2327 int @GetSectorResult(const uint index); ///< Use after calling Game.GetSectorInBounds. Do not use at any other point!
2328 void NextSpawnFxSetResults(); ///< On the next call to SpawnFx or any other function that calls SpawnFx (such as SpawnProjectile and FireProjectile), all the Fx that were spawned will be stored in Game.GetFxResult. Do not make nested calls to this!
2329 kStr GetFxFile(const int fxID); ///< Returns the file path to the Fx by ID value as defined in defs/fileLookup.txt
2330 bool &UseCustomNoStretch(); ///< Set to true to use the non stretch Hud fix for Custom Text and Pics
2331 bool CanUseCustomNoStretch(); ///< Returns true if aspect ratio is 4:3 or bigger width
2332 void ScreenPointToHUD(float sx, float sy, float&out x, float&out y); ///< Returns the HUD position of the screen point
2333 void ScreenPointToHUDNoStretch(float sx, float sy, float&out x, float&out y); ///< Returns the HUD position of the screen point
2334 bool &NoDamageFlash(void);
2335 bool &NoPickupFlash(void);
2336 bool &NoArmorFlash(void);
2337 void SetAllSoundsPitchScale(const float pitchScale); ///< Sets all playing sounds pitch scale
2338 void SetGlobalSoundPitch(const float pitch); ///< When sounds begin to play their pitch is scaled by this value
2339};
2340
2341/**
2342 * @class kFxIterator
2343 * @brief The way to iterate through all Fx in the map. Example code:
2344 * @code{.cpp}
2345 * kFxIterator it;
2346 * kFx @fx;
2347 * while((@fx = it.Get()) !is null)
2348 * {
2349 * // Do something with fx
2350 * }
2351 * @endcode
2352 */
2354{
2355public:
2357 kFx@ Get(); ///< Returns the next Fx in the iterator
2358 void Reset(); ///< Resets the iterator back to the first Fx
2359};
2360
2362{
2363public:
2364 const uint16 Buttons() const; ///< returns EnumPlayerButtons
2365 uint ButtonHeldTime(const int btn); ///< btn type is EnumInputActions
2367 void ConsumeAmmo(const int ammo, const bool preferredAmmo = true);
2368 void ConsumeAltAmmo(const int ammo);
2369 const int GetAmmo(const int weaponID) const;
2370 const int GetAltAmmo(const int weaponID) const;
2371 const bool HasAmmo(const int weaponID, const bool checkAlt = true) const; ///< if checkAlt is false only checks primary ammo
2372 const bool HasAltAmmo(const int weaponID) const;
2373 const bool HasAltAmmo() const;
2374 const bool HasWeapon(const int weaponID) const;
2375 bool& UseAltAmmo();
2376 const int CurrentWeapon() const;
2377 bool GiveWeapon(const int weaponID, const int ammo, const bool switchNewWeapon = true); ///< returns true if gave ammo else returns false because already has full primary ammo. if switchNewWeapon is false it will not auto switch to the weapon.
2378 bool RemoveWeapon(const int weapon);
2379 void Lock();
2380 void Unlock();
2381 int16& Armor();
2382 void Victory(const int warpActorID = - 1, const int mapID = - 1);
2383 const bool Locked() const;
2384 const int Lives() const;
2385 void SetLives(const int amount);
2386 const int LifeForces();
2387 void SetLifeForces(const int amount);
2388 bool& Backpack();
2389 bool& RunWalkToggle(); ///< if true walking is enabled. (saves)
2390 bool& NoLandClearVel(); ///< if true, when doing a hard landing you will not lose your velocity (saves)
2391 bool &NoWeaponSwitchOnWaterLand(); ///< will not auto switch weapon when entering/exiting water. (saves)
2392 bool GiveAmmo(const int weapon, const int amount, const bool altAmmo); ///< set amount to negative values to take ammo
2393 const int CurrentCheckPoint(); ///< returns warpTID
2395 void SetCheckPoint(const int warpTID, const int map);
2396 const kVec3 GetButtonAngles() const;
2398 const bool WeaponUsingAltAmmo(const int weapon) const;
2399 const bool SetWeaponUseAltAmmo(const int weapon, const bool bToggle);
2400 const bool WeaponAllowUnderwater(const int weapon) const;
2401 void ChangeWeapon(const int weapon);
2402 const int PendingWeapon() const;
2403 void CycleNextWeapon(const bool bCheckAmmo = false);
2404 void CyclePrevWeapon(const bool bCheckAmmo = false);
2405 kWeapon@ GetWeaponActor(const int weapon);
2406 int16& MaxHealth(); ///< should be >= MaxExtraHealth and ExtraHealth
2407 int16& MaxExtraHealth(); ///< should be <= MaxHealth
2408 int16& ExtraHealth(); ///< should be <= MaxExtraHealth
2409 bool GiveHealth(const int amount, const bool bMortalWound); ///< Takes into account extra health, and max health values. 0 is full health, negative amounts give extra health. if bMortalWound is true which is for 2 and ultra health then health goes up to maxExtraHealth.
2410 void CancelSpiritualTime(float blendTime = 1.0f); ///< if in spirit mode then will set gamespeed back to 1.0f using the passed in blendTime
2411 void SetSpiritualTime(const float time, const float blend); ///< time = time until cancels the effect. Should SetGameSpeed after calling this.
2412 const float GetSpiritualTime() const;
2413 const int GetWeaponGroup(const int weapon);
2414
2415 /**
2416 * @brief Binds this weapon to another weapons index. Example: you made a new pistol weapon at index 14 and want to group it with default pistol that has the index 2.
2417 * then set your new pistols(14) group to 2 and whenever the user presses the key assigned to the original pistol 2 it will cycle between them. instead of the user having to cycle to the new weapon with next/prev weapon inputs. The group can also be set in weaponInfo.txt def file with the key "group"
2418 */
2419 void SetWeaponGroup(const int weapon, const int group);
2420 bool &SilentCheckPoints(void); ///< if true won't show checkpoint message or play sound when on a checkpoint area. Gets set back to false when level starts.
2421 float &LookSensScale(); ///< Scales mouse/controller/gyro sensitivity (default = 1.0f)
2422};
2423
2424namespace Math
2425{
2426 float Sin(float f); ///< Returns the sine of angle f in radians
2427 float Cos(float f); ///< Returns the cosine of angle f in radians
2428 float Tan(float f); ///< Returns the tangent of angle f in radians.
2429 float ATan2(float y, float x); ///< Returns the angle in radians whose Tan is y/x
2430 float Fabs(float f); ///< Returns the absolute value of f
2431 float ACos(float f); ///< Returns the arc-cosine of f - the angle in radians whose cosine is f
2432 float Sqrt(float f); ///< Returns square root of f
2433 int Abs(int i); ///< Returns the absolute value of i.
2434 float Ceil(float f); ///< Returns the smallest integer greater to or equal to f
2435 float Floor(float f); ///< Returns the largest integer smaller to or equal to f
2436 float Log(float f); ///< Returns the natural (base e) logarithm of a specified number
2437 float Pow(float x, float y); ///< Returns f raised to power p
2438 float Deg2Rad(float degs); ///< Degrees-to-radians conversion
2439 float Rad2Deg(float rads); ///< Radians-to-Degrees conversion
2440 float InvSqrt(float f); ///< Returns inverse square root of f
2441 float IncMax(const float val, const float inc, const float dest); ///< returns val +(or minus) inc and never goes above or below dest value
2442 int SysRand(); ///< Range 0..32767
2443 int Rand(); ///< Range 0..32767
2444 uint8 RandByte(); ///< Range 0..255
2445 int RandMax(const int max); ///< Range 0..max-1
2446 float NLerp(const float a, const float b, const float t); ///< Calculates the linear parameter t that produces the interpolant value within the range [a, b]
2447 float Accelerate(const float val, const float accel, const float max); ///< return val that increases by accel in a weird way to the max value.
2448 float RandFloat(); ///< Range 0..1
2449 float RandCFloat(); ///< Range -1..1
2450 float RandRange(const float min, const float max); ///< Returns a random float number between and min [inclusive] and max [inclusive]
2451 int Clamp(const int i, const int min, const int max); ///< Returns clamped value between min and max
2452 float Clampf(const float f, const float min, const float max); ///< Returns clamped value between min and max
2453 float Lerp(float start, const float end, const float time); ///< Linearly interpolates between start and end by time.
2454 float CosTween(const float t); ///< return (0.5f - (Cos(t * pi) * 0.5f));
2455 float CosArc(const float t); ///< return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
2456 float SmoothStep(const float from, const float to, const float t); ///< Interpolates between min and max with smoothing at the limits.
2457 float HermiteBlend(const float a, const float b, const float t);
2458 float Min(const float a, const float b); ///< Returns the smallest of the two values
2459 float Max(const float a, const float b); ///< Returns the largest of the two values
2460 const int f2i(const float f); ///< IEEE 754 float to int
2461 const float i2f(const int i); ///< int to IEEE 754 float
2462 const float pi = 3.1415927f;
2463 const float tau = 6.2831855f; ///< pi * 2
2464 const kVec3 vecZero(0.0f, 0.0f, 0.0f);
2465}
2466
2467namespace kexColors ///< Not used (garbage included automatically from kexengine)
2468{
2469 const kColor white; ///< 255, 255, 255, 255
2470 const kColor gray; ///< 127, 127, 127, 255
2471 const kColor black; ///< 0, 0, 0, 255
2472 const kColor red; ///< 255, 0, 0, 255
2473 const kColor green; ///< 0, 255, 0, 255
2474 const kColor blue; ///< 0, 0, 255, 255
2475 const kColor yellow; ///< 255, 255, 0, 255
2476 const kColor orange; ///< 255, 127, 0, 255
2477 const kColor cyan; ///< 0, 255, 255, 255
2478 const kColor magenta; ///< 255, 0, 255, 255
2479 const kColor transparent; ///< 0, 0, 0, 0
2500}
2501
2502/**
2503 * @brief
2504 * @param s the string you want to split
2505 * @param sep the separators you want to use to split the string
2506 @code{.cpp}
2507 kStr myString = "Hello,World!";
2508 kStrSplit(myString, ",");
2509 for(uint i = 0; i < kStrSplitLength(); i++)
2510 {
2511 kStr stringPart = kStrSplitGet(i);
2512 Sys.Print("SplitStrings[" + i + "] len=" + stringPart.Length() + ": " + stringPart);
2513 }
2514 kStrSplitClear();
2515 @endcode
2516 */
2517void kStrSplit(const kStr &in s, const kStr &in sep);
2518kStr kStrSplitGet(const int index); ///< returns the string at index
2519uint kStrSplitLength(); ///< returns the amount of strings that were split
2520void kStrSplitClear(); ///< clear the list of split strings after your done. Not required to call because it gets cleared when you call kStrSplit but if you don't want those strings still hanging around you can clear them now.
2521kColor kexColor_FromHSL(float hue, float sat, float lit); ///< Not used. (garbage from kexengine)
2522kColor kexColor_Random(); ///< Not used. (garbage from kexengine)
2523kColor kexColor_Tab20(uint i); ///< Not used. (garbage from kexengine)
2524kColor kexColor_Tab20Dark(uint i); ///< Not used. (garbage from kexengine)
2525kColor kexColor_Tab20Light(uint i); ///< Not used. (garbage from kexengine)
2526kColor kexColor_ViridisScale(float v); ///< Not used. (garbage from kexengine)
2527kColor kexColor_LerpRGB(const kColor&in from, const kColor&in to, float time); ///< Not used. (garbage from kexengine)
2528int kexRandInt(); ///< Range -2147483648..2147483647
2529uint kexRandUInt() ///< Range 0..4294967295
2530void delay(const float time); ///< used in map scripts to delay execution of script
2531const float GAME_FRAME_TIME = 0.25f;
2532const float GAME_DELTA_TIME = 0.016666668f;
2533const float GAME_FRAME_UNIT = 4.0f;
2534const float GAME_SECONDS = 0.06666667f;
2535const float GAME_SCALE = 10.24f;
2538kDict GameModFileData; ///< Use with Game.SaveModFile, Game.LoadModFile, and Game.LoadModDataFile
void kStrSplit(const kStr &in s, const kStr &in sep)
EnumPlayerConButtons
@ CBC_AUTOMAP
@ CBC_WEAPON14
@ CBC_MENUACTIVATE
@ CBC_WEAPON9
@ CBC_WEAPON5
@ CBC_WEAPON11
@ CBC_RUNWALK
@ CBC_WEAPON6
@ CBC_MENUCANCEL
@ CBC_WEAPON1
@ CBC_WEAPON10
@ CBC_MENULEFT
@ CBC_WEAPON3
@ CBC_WEAPON13
@ CBC_MENURIGHT
@ CBC_WEAPON4
@ CBC_WEAPON12
@ CBC_MENUDESELECT
@ CBC_MENUUP
@ CBC_MENUDOWN
@ CBC_WEAPON7
@ CBC_WEAPON8
@ CBC_CHANGEAMMO
@ CBC_MENUSELECT
@ CBC_MENUBACK
@ CBC_WEAPON2
EnumCheatFlags
@ GC_INVINCIBILITY
@ GC_FLIGHT
@ GC_PURDY_COLORS
@ GC_TINY_ENEMY
@ GC_ALL_MAP
@ GC_INFINITE_AMMO
@ GC_SPIRIT_MODE
@ GC_BIG_HEADS
@ GC_DISCO
@ GC_NOCLIP
@ GC_INFINITE_LIVES
@ GC_SHOW_ENEMIES
kSys Sys
EnumGameFontType
@ GFT_BIG
@ GFT_SMALL
@ GFT_NUMBERS
@ GFT_TTF
kGame Game
kColor kexColor_ViridisScale(float v)
Not used. (garbage from kexengine)
EnumCameraLerpType
Lerp type when doing AutoPlayPositionTrack, AutoPlayRotationTrack, or AutoPlayBlendTrack....
@ CMLT_COSINE
time will never be higher than speed. time = CosTween(time * (1.0f / speed));
@ CMLT_LINEARLOOP
time is set to time / speed. If time is > 1.0 then time -= 1.0
@ CMLT_COSINE_POW
time will never be higher than speed. time = CosTween(Pow(time * (1.0f / speed), 3));
@ CMLT_LINEAR
time is set to time / speed.
@ CMLT_NONE
time is set to time / speed.
const float GAME_DELTA_TIME
kColor kexColor_Tab20(uint i)
Not used. (garbage from kexengine)
EnumActorSpawnFlags3
@ ASF3_MAKESPAWNANIMVISIBLE
clears actor flags: ~(AF_HIDDEN|AF_DISABLED)
@ ASF3_PROJECTILEATTACK9
Demon chest Hadoken (anim_aiRangeAttack9)
@ ASF3_NOTHINKER
AI will not function. Actors will not update movement. Actors OnBeginLevel will set their animation t...
@ ASF3_PLAYTRIGGERANIMONCE
MarkPersistentBit(false) when activated.
@ ASF3_KILLOUTSIDEOFVIEW
NOT USED.
@ ASF3_PROJECTILEATTACK10
High Priest Lightning Red Flames (anim_aiRangeAttack10)
@ ASF3_RETURNWARP
Used in portal scripts.
@ ASF3_WALKINSTRAIGHTLINE
Set animation to Blend(ANIM_WALKING, (m_animSpeed * m_animScalar), 10, ANF_LOOP|ANF_ROOTMOTION); and ...
@ ASF3_AVOIDPLAYERS2
NOT USED.
@ ASF3_REGENERATEFROMSTART
Regen from starting position.
@ ASF3_NOVIOLENTDEATH
ANIM_AIDEATHSTAND and ANIM_DEATHSTANDALT will not play when kAI is killed.
@ ASF3_NODRAWONCAMERA
Will not draw this actor when viewing from camera unless camera flags has CMF_SHOW_HIDDEN_OBJECTS.
kColor kexColor_Tab20Light(uint i)
Not used. (garbage from kexengine)
EnumClipResultFlags
@ CRF_NOCOLLISION
@ CRF_MESH
made contact with a static object
@ CRF_ADJUST
z-axis was adjusted (ceiling or floor)
@ CRF_FLOOR
made contact with a floor
@ CRF_WALL
made contact with an edge (sector edge that isn't linked to another sector)
@ CRF_CEILING
made contact with a ceiling
@ CRF_WALLRADIUS
made contact with an edge during the wall radius collision test
@ CRF_OBJECT
made contact with an actor
kDict GameModFileData
Use with Game.SaveModFile, Game.LoadModFile, and Game.LoadModDataFile.
EnumClipFlags
@ CF_HITSCAN
performs a single-pass trace. useful for hitscans
@ CF_CHECKLINKEDBRIDGES
do extensive checks against overlapping bridge sectors
@ CF_NOCLIPTARGETACTORS
don't clip actors that are targeted by moving object
@ CF_ALLOWCRAWL
collide with sectors flagged as crawlable
@ CF_STANDONOBJECTS
allow vertical clipping of objects
@ CF_ALLOWRESTRICTEDAREAS
don't collide with edges belonging to a restricted sector
@ CF_COLLIDEFLOORS
project and clip movement against non-flat floors
@ CF_USEWALLRADIUS
clip and project movement away from walls based on wall radius
@ CF_DROPOFF
allows passing through platforms or ledges
@ CF_NOCLIPSTATICS
don't collide with static models
@ CF_ALLOWCLIMB
collide with sectors flagged as climbable
@ CF_NOEXITWATER
block all edges that links to a non-water sector
@ CF_WALKWALLS
don't restrict movement to steep slopes
@ CF_NOCOLLIDEFUNC
don't invoke the OnCollide callback on the moving object
@ CF_COLLIDETRIGGERS
block edges belonging to a trigger. Can't cross into sectors if sector has AAF_EVENT.
@ CF_NOEXITWALLS
clip all edges, regardless if they link to another sector or not
@ CF_COLLIDECORPSES
clip against actors flagged as dead
@ CF_POLYCOLLISION
clip movement against all model polygons of an object
@ CF_NOSTEPDOWN
don't clamp z-axis when walking down slopes
@ CF_NOENTERWATER
block all edges that links to a water sector
@ CF_NOCLIPACTORS
don't collide with dynamic objects/actors
@ CF_COLLIDEHEIGHT
clip against ceilings
@ CF_COLLIDECLIFFS
collide with non-walkable floors
@ CF_NOFLOORADJUST
don't keep z-axis above floor plane
@ CF_NOCEILINGADJUST
don't keep z-axis below ceiling plane
@ CF_NOSLOPESTEP
don't project z-axis movement along slopes
@ CF_IGNOREBLOCKERS
don't clip edges belonging to blocking sectors
@ CF_CLIPEDGES
clip movement against edges that don't link to sectors
@ CF_COLLIDEWATER
clip movement against the water surface
@ CF_GREASESLIDEOBJECTS
always keep movement projected away from collided objects
kCamera Camera
EnumAnimStateFlags
@ ANF_ROOTMOTION
@ ANF_LOOP
@ ANF_NOINTERRUPT
@ ANF_PAUSED
@ ANF_BLEND
@ ANF_STOPPED
@ ANF_LINEARBLEND
@ ANF_CYCLECOMPLETED
const float GAME_FRAME_UNIT
EnumPlaneSide
@ PSIDE_BACK
@ PSIDE_ON
@ PSIDE_FRONT
EnumInputActions
@ IA_JUMP
@ IA_CUSTOM2
@ IA_FORWARD
@ IA_ATTACK
@ IA_STRAFELEFT
@ IA_WEAPNEXT
@ IA_MAPZOOMIN
@ IA_WEAPPREV
@ IA_CUSTOM1
@ IA_STRAFERIGHT
@ IA_BACKWARD
@ IA_MAPZOOMOUT
kPlayer Player
EnumSectorPlatformFlags
@ SPF_FLOORVERTS
Changes sectors verts origin.
@ SPF_MOVEPLAYER
Moves player.
@ SPF_USEMOVETOFORPLAYER
Uses the MoveToPosition function to set the Players origin. else sets origin.
@ SPF_MOVEOTHERACTORS
Moves other actors on the sectors that are not the player or AI.
@ SPF_MOVEAI
Moves AI.
@ SPF_SAMEAREA
Effects sectors only with the same area as the starting sector.
@ SPF_DEFAULT
@ SPF_USEMOVETOFORAI
Uses the MoveToPosition function to set the AI origin. else sets origin.
@ SPF_MOVEPLAYERINAIR
Player moves with the sectors even in the air.
@ SPF_USEMOVETOFOROTHER
Uses the MoveToPosition function to set other actors origin. else sets origin.
@ SPF_CEILINGVERTS
Changes sectors verts heights.
kexLocPlatform_e
< Not used (garbage included automatically from kexengine)
@ LocPlatform_XboxSeries
@ LocPlatform_Current
@ LocPlatform_PlayStation5
@ LocPlatform_XboxOne
@ LocPlatform_Mac
@ LocPlatform_Switch
@ LocPlatform_WindowsStore
@ LocPlatform_Linux
@ LocPlatform_Windows
@ LocPlatform_PlayStation4
@ LocPlatform_UserPlatformCount
@ LocPlatform_FirstUserPlatform
EnumWaterLevel
@ WLT_BETWEEN
In water sector and floating above the water.
@ WLT_INVALID
Not in water sectors.
@ WLT_OVER
In water sector but over the water height.
@ WLT_UNDER
In water sector and under the water height.
kColor kexColor_Random()
Not used. (garbage from kexengine)
uint kStrSplitLength()
returns the amount of strings that were split
EnumImpactType
@ IT_STONE
@ IT_DEFAULT
@ IT_FORCEFIELD
@ IT_SLIME
@ IT_FLESH_CREATURE
@ IT_LAVA
@ IT_FLESH_HUMAN
@ IT_WATER
@ IT_FLESH_UNDEAD
AKA IT_FLESH_WATER.
@ IT_METAL
kCModel CModel
const float GAME_SECONDS
kColor kexColor_LerpRGB(const kColor &in from, const kColor &in to, float time)
Not used. (garbage from kexengine)
EnumWeaponStates
@ WS_LOWER
@ WS_FIRE
Is currently firing.
@ WS_FIREUNDERWATER
NOT USED.
@ WS_RAISE
@ WS_RUN
NOT USED.
@ WS_WALK
NOT USED.
@ WS_IDLE
@ WS_HOLDSTER
Set when dead (with no death cinematic) or when climbing. Should set weapon anim to ANIM_WEAPONSWAPOU...
@ WS_DISCHARGE
set after OnEndFire is called. If was in WS_FIRE state and not pressing the Attack button.
kColor kexColor_FromHSL(float hue, float sat, float lit)
Not used. (garbage from kexengine)
EnumPlayerFlags
@ PF_NOTOUCH
disables invoking onTouch callbacks
@ PF_GOD
Is reset when level beings.
@ PF_FALLINGDEATHPIT
currently falling in a death pit. Cleared after level begins.
@ PF_WEAPONSTEAL
on when campaigner steals weapon
@ PF_CRAWLING
@ PF_JUMPING
is jumping (moving up). flag is off when reached max jump height or let go of jump button.
@ PF_NOCLIP
@ PF_HASJUMPED
@ PF_FIREDPROJECTILE
set when FireProjectile is called. Cleared OnTick if weapon is not in WS_FIRE state and player is not...
@ PF_NOSECTORMUSIC
disables music changes when changing sectors
@ PF_NOCEILINGGLIDE
disables the ceiling glide glitch
@ PF_DEAD
@ PF_INWARPAREA
in sector area with AAF_TELEPORT flag.
@ PF_FLY
@ PF_PREVENTDEATHCAM
will stop the death cinematic or the deadAnimView from triggering when the player dies.
@ PF_CLIMBTHRUST
@ PF_NOAIRFRICTION
const float GAME_FRAME_TIME
EnumGameButtonEvents
@ GBE_MENU_SELECT
@ GBE_MENU_DESELECT
@ GBE_MENU_DOWN
@ GBE_MENU_UP
@ GBE_MENU_ACTIVATE
@ GBE_MENU_LEFT
@ GBE_MENU_CANCEL
@ GBE_MENU_MOUSESELECT
@ GBE_MENU_RIGHT
@ GBE_MENU_BACK
EnumActorFlags
@ AF_NOMOVEMENT
will not do collision movement
@ AF_CLIMBWALLS
allows entering of wall sectors
@ AF_REMOVEONCOMPLETION
remove after finishing a special animation
@ AF_SNAPTOFLOOR
adjust z-axis to floor on spawn
@ AF_ALWAYSACTIVE
never sleep or go dormant
@ AF_HIDDEN
don't draw but continue updating. can't be collided
@ AF_TRIGGERSTUFF
NOT USED.
@ AF_COLLIDEDWITHWALL
collided with an edge. cleared at every OnTick call
@ AF_WOUNDEDMORTALLY
if on this actor will drop a mortal wound because it was hit by a super arrow shot
@ AF_CANBETOUCHED
allow invoking the OnTouch callback
@ AF_IGNORESOUNDEVENTS
don't call kexAnimState::Action_PlaySound
@ AF_NODRAW
don't render
@ AF_DISABLED
don't update animations
@ AF_DEAD
actor is dead. handle special cases for collision
@ AF_CASTSHADOW
can cast a simple shadow
@ AF_ALLOWTINYENEMYCHEAT
affected by tiny enemy game cheat
@ AF_SOLID
Can be collided.
@ AF_STAYINWATER
can't exit water sectors
@ AF_ALIGNTOFLOOR
rotate along slopes
@ AF_INVINCIBLE
will not receive damage. OnDamage and OnDeath are never called
@ AF_AVOIDWATER
clip against edges linking to water sectors
@ AF_NONSHOOTABLE
Fx won't hit actors if this flag is set.
@ AF_FLOATINWATERONDEATH
rise to the surface while dead
@ AF_ACTIVATED
was triggered
@ AF_NOBLOOD
don't spawn particles flagged as blood
@ AF_ENTEREDAREAEVENT
just entered a trigger sector
@ AF_DORMANT
if on then is asleep (won't be updated onTick) else is awake
@ AF_TRIGGERANIMATION
play special animation on trigger/spawn
@ AF_TRIGGERNAIMDELAY
delay a bit before starting special animation
@ AF_HOLDTRIGGERANIM
pause special animation until triggered (is also invincible)
@ AF_STATIONARY
Sniper. don't update the animation's root motion.
@ AF_FULLVOLUME
all sounds coming from this actor will be heard at full volume
EnumActorSpawnFlags1
@ ASF1_CLIMBWALLS
@ ASF1_SNAPTOFLOOR
@ ASF1_CASTSHADOW
sets AF_CASTSHADOW on SetSpawnParams
@ ASF1_FLOATINWATERONDEATH
kAI will float up to the top of the water when they are dead
@ ASF1_RANDOMFEIGNDEATH
NOT USED.
@ ASF1_SCREENSHAKE
Used in floor mover scripts to shake screen.
@ ASF1_PROJECTILEATTACK2
Pistol Fire (anim_aiRangeAttack2)
@ ASF1_KAMIKAZE
if has no target then targets player and sets agitation to 300
@ ASF1_AVOIDPLAYERS
NOT USED.
@ ASF1_TELEPORTAVOIDCLIFFS
@ ASF1_NOWALLCOLLISION
NOT USED.
@ ASF1_FLOCKER
flocks to a leader kAI
@ ASF1_CANNOTCAUSEAFIGHT
if another actor was damaged by this actor with this flag set then other actor will not target this a...
@ ASF1_FLYING
NOT USED.
@ ASF1_USEWEAKATTACKS
anim_aiAltMelee1
@ ASF1_LEADER
Flocker ai run toward Leaders to get attention.
@ ASF1_SOLID
@ ASF1_RANDOMRESURRECTION
NOT USED.
@ ASF1_DIEONEXPLOSION
NOT USED.
@ ASF1_PROJECTILEATTACK1
High Priest Flame Attack (anim_aiRangeAttack1)
@ ASF1_SNIPER
@ ASF1_NOREPEATEXPLOSION
NOT USED.
@ ASF1_EXPLOSIONDEATH
NOT USED.
@ ASF1_AVOIDWATER
sets AF_AVOIDWATER on SetSpawnParams
@ ASF1_MELTONDEATH
allows melt effect and regeneration
@ ASF1_RESPAWNANIMATION
Enables respawning animation effect.
@ ASF1_TELEPORTAVOIDWATER
@ ASF1_TELEPORTWAIT
allows enemy to move around for 1.5 - 4.5 seconds before teleporting back in.
@ ASF1_TRIGGERSTUFF
Sets AF_TRIGGERSTUFF on SetupSpawnParams.
@ ASF1_USESTRONGATTACKS
anim_aiMelee1
@ ASF1_TELEPORT
allows kAI to teleport on SetupAISpawnFlags
@ ASF1_SLOW
NOT USED.
EnumAreaFlags
@ AAF_CHECKPOINT
@ AAF_EVENT
@ AAF_CLIFF
is a wall
@ AAF_LAVA
@ AAF_ENTERCRAWL
Exactly the same as AAF_CRAWL.
@ AAF_DAMAGE
@ AAF_SHALLOWWATER
@ AAF_CRAWL
@ AAF_BLOCK
@ AAF_REPEATABLE
Unused.
@ AAF_CLIMB
climb up sectors faster than AAF_LADDER
@ AAF_ANTIGRAVITY
@ AAF_MAPPED
@ AAF_DEATHPIT
@ AAF_ONESIDED
Bridge.
@ AAF_ENTERED
Not shown in Editor. Used in kex editor only for fill sector commands. When map is saved in kex edito...
@ AAF_SAVEGAME
@ AAF_DRAWSKY
@ AAF_TELEPORTAIR
@ AAF_WARPRETURN
Unused.
@ AAF_LADDER
climb up sectors slower than AAF_CLIMB
@ AAF_EVENTSOUND
@ AAF_RESTRICTED
kAI can't enter the area
@ AAF_CEILING
@ AAF_TELEPORT
@ AAF_SECRET
@ AAF_STOREWARPRETURN
Unused.
@ AAF_DRAWSUN
@ AAF_SLOPETEST
overrides AAF_CLIFF flag. If the sectors floor plane up direction is <= 0.5 then is a wall (a wall is...
@ AAF_TOGGLE
if on and AAF_BLOCK is on then sectors won't be marked on automap until it's unblocked....
@ AAF_WATER
@ AAF_HIDDEN
kColor kexColor_Tab20Dark(uint i)
Not used. (garbage from kexengine)
EnumPlayerStates
@ PS_SWIMMING
@ PS_JUMPING
@ PS_FALLDEATH
@ PS_CLIMBING
@ PS_UNDERWATER
@ PS_WALKING
@ PS_ANTIGRAVITY
int kexRandInt()
Range -2147483648..2147483647.
kPlayLoop PlayLoop
EnumPlayerButtons
@ BC_WEAPONRIGHT
@ BC_CUSTOM2
@ BC_ATTACK
@ BC_MAPZOOMOUT
@ BC_JUMP
@ BC_STRAFERIGHT
@ BC_BACKWARD
@ BC_STRAFELEFT
@ BC_CUSTOM1
@ BC_FORWARD
@ BC_MAPZOOMIN
@ BC_WEAPONLEFT
const float GAME_SCALE
EnumActorSpawnFlags2
@ ASF2_NOBLOOD
@ ASF2_DROPITEM_MASK6
Small Health.
@ ASF2_DROPITEM_MASK3
Medium Health.
@ ASF2_PROJECTILEATTACK8
High Priest Homing Blue Flame (anim_aiRangeAttack4)
@ ASF2_DROPITEM_MASK11
Shotgun Shells.
@ ASF2_UNUSED1
NOT USED.
@ ASF2_DROPITEM_MASK14
Clip.
@ ASF2_UNUSED2
NOT USED.
@ ASF2_DROPITEM_MASK12
Energy Cell.
@ ASF2_WARPDEATH
NOT USED.
@ ASF2_NOAUTOMAPDRAW
if map all or show enemies cheats are on then will not draw this actor on the automap.
@ ASF2_DROPITEM_MASK1
Explosive shells.
@ ASF2_DROPITEM_MASK5
Ultra Health.
@ ASF2_PROJECTILEATTACK3
crouch rifle Fire (anim_aiRangeAttack7)
@ ASF2_PROJECTILEATTACK4
(anim_aiRangeAttack8)
@ ASF2_STAYINWATER
sets AF_STAYINWATER on SetSpawnParams
@ ASF2_DROPITEM_MASK10
4 Rockets
@ ASF2_HOLDTRIGGERANIMATION
@ ASF2_DROPITEM_MASK13
Large Energy Cell.
@ ASF2_DROPITEM_MASK2
Grenade.
@ ASF2_STOREWARPRETURN
Used in portal scripts.
@ ASF2_ALTERNATEMOVES
is for holding two handed weapons
@ ASF2_MORTALWOUNDIMPACT
Can be hit by a super arrow shot and if ASF2_DROPITEM_MASK9 is on has a chance to drop a mortal wound...
@ ASF2_DROPITEMONDAMAGE
NOT USED.
@ ASF2_DROPITEM_MASK4
Full Health.
@ ASF2_PROJECTILEATTACK7
Grenade Throw (anim_aiRangeAttack3)
@ ASF2_PROJECTILEATTACK5
Stand Rifle Fire (anim_aiRangeAttack5)
@ ASF2_PROJECTILEATTACK6
Pipe Blow (anim_aiRangeAttack6)
@ ASF2_DROPITEM_MASK8
Minigun ammo.
@ ASF2_DROPITEM_MASK9
Mortal Wound.
@ ASF2_DROPITEM_MASK7
Large Health.
@ ASF2_REMOVEONCOMPLETION
Sets AF_REMOVEONCOMPLETION.
void kStrSplitClear()
clear the list of split strings after your done. Not required to call because it gets cleared when yo...
EnumCameraStates
@ CAMS_FADEIN
@ CAMS_RESTORE_TO_CLIENT
@ CAMS_ACTIVE_TO_FADEOUT
@ CAMS_IDLE
@ CAMS_FADEBACK_TO_CLIENT
@ CAMS_ACTIVE
@ CAMS_FADEOUT
kWorld World
EnumDifficulty
@ DIFFICULTY_HARD
@ DIFFICULTY_HARDCORE
@ DIFFICULTY_NORMAL
@ DIFFICULTY_EASY
kDict GameVariables
EnumCameraFlags
@ CMF_CHANGE_MAP_AFTER_FADE
@ CMF_NO_LETTERBOX
@ CMF_NO_INITIAL_FADEOUT
@ CMF_SHOW_HIDDEN_OBJECTS
@ CMF_UNLOCK_PLAYER_ON_FINISH
@ CMF_INITIAL_FADEIN
@ CMF_LOCK_PLAYER
@ CMF_SHOW_CREDITS
@ CMF_NO_INITIAL_FADEIN
kStr kStrSplitGet(const int index)
returns the string at index
EnumAIFlags
@ AIF_HEARDLOUDNOISE
@ AIF_NOTHINK
don't run ai logic
@ AIF_REGENERATEANIM
@ AIF_SEETARGET
@ AIF_REGENANIMDELAY
@ AIF_FIRSTATTACK
@ AIF_HEARDQUIETNOISE
@ AIF_ATTACKING
playing an attacking animation
@ AIF_AWAYFROMLEASH
@ AIF_GOBACKTOLEASH
@ AIF_WAITFORCYCLE
prevent other animations from interrupting until the current one finishes
@ AIF_RESSURECT
@ AIF_REGENERATE
@ AIF_NOCHASE
disable chase logic
@ AIF_TELEPORTING
in teleport state. ignore all chase logic
@ AIF_BLOWNAWAY
being blown away by explosion
@ AIF_GETATTENTION
@ AIF_WASSOLID
@ AIF_RUNNING
Is playing running animation.
@ AIF_TELEPORTIN
playing teleport in animation
@ AIF_TELEPORTAWAY
playing teleport out animation
@ AIF_TELEPORTMOVESLOW
chasing while underground
@ AIF_DAMAGEPANIC
become aggressive when target is outside its active threshold (good for forcing AI to attack their ta...
@ AIF_FEIGNDEATH
kActorFactory ActorFactory
uint kexRandUInt() void delay(const float time)
used in map scripts to delay execution of script
float Lerp(float start, const float end, const float time)
Linearly interpolates between start and end by time.
float ATan2(float y, float x)
Returns the angle in radians whose Tan is y/x.
float Clampf(const float f, const float min, const float max)
Returns clamped value between min and max.
int Abs(int i)
Returns the absolute value of i.
int Rand()
Range 0..32767.
float NLerp(const float a, const float b, const float t)
Calculates the linear parameter t that produces the interpolant value within the range [a,...
const float tau
pi * 2
const kVec3 vecZero(0.0f, 0.0f, 0.0f)
float Floor(float f)
Returns the largest integer smaller to or equal to f.
float Pow(float x, float y)
Returns f raised to power p.
float Deg2Rad(float degs)
Degrees-to-radians conversion.
float Max(const float a, const float b)
Returns the largest of the two values.
uint8 RandByte()
Range 0..255.
float Accelerate(const float val, const float accel, const float max)
return val that increases by accel in a weird way to the max value.
float Sqrt(float f)
Returns square root of f.
float CosTween(const float t)
return (0.5f - (Cos(t * pi) * 0.5f));
float Tan(float f)
Returns the tangent of angle f in radians.
float Log(float f)
Returns the natural (base e) logarithm of a specified number.
float Fabs(float f)
Returns the absolute value of f.
float HermiteBlend(const float a, const float b, const float t)
float RandRange(const float min, const float max)
Returns a random float number between and min [inclusive] and max [inclusive].
float InvSqrt(float f)
Returns inverse square root of f.
float ACos(float f)
Returns the arc-cosine of f - the angle in radians whose cosine is f.
float Rad2Deg(float rads)
Radians-to-Degrees conversion.
float IncMax(const float val, const float inc, const float dest)
returns val +(or minus) inc and never goes above or below dest value
float Cos(float f)
Returns the cosine of angle f in radians.
const float i2f(const int i)
int to IEEE 754 float
int RandMax(const int max)
Range 0..max-1.
float Min(const float a, const float b)
Returns the smallest of the two values.
float Ceil(float f)
Returns the smallest integer greater to or equal to f.
const int f2i(const float f)
IEEE 754 float to int.
float CosArc(const float t)
return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
float SmoothStep(const float from, const float to, const float t)
Interpolates between min and max with smoothing at the limits.
int Clamp(const int i, const int min, const int max)
Returns clamped value between min and max.
const float pi
int SysRand()
Range 0..32767.
float Sin(float f)
Returns the sine of angle f in radians.
float RandCFloat()
Range -1..1.
float RandFloat()
Range 0..1.
< Not used (garbage included automatically from kexengine)
const kColor magenta
255, 0, 255, 255
const kColor blue
0, 0, 255, 255
const kColor gray
127, 127, 127, 255
const kColor tab20blue2
const kColor tab20purple2
const kColor tab20cyan
const kColor tab20pink
const kColor green
0, 255, 0, 255
const kColor tab20brown2
const kColor white
255, 255, 255, 255
const kColor tab20blue
const kColor red
255, 0, 0, 255
const kColor cyan
0, 255, 255, 255
const kColor tab20green2
const kColor yellow
255, 255, 0, 255
const kColor tab20orange
const kColor tab20pink2
const kColor tab20orange2
const kColor tab20cyan2
const kColor tab20olive
const kColor tab20purple
const kColor tab20grey
const kColor tab20grey2
const kColor tab20green
const kColor orange
255, 127, 0, 255
const kColor transparent
0, 0, 0, 0
const kColor tab20red
const kColor black
0, 0, 0, 255
const kColor tab20brown
const kColor tab20red2
const kColor tab20olive2
funcdef bool less(const ?&in a, const ?&in b)
sorting function for sort
void resize(uint length)
Sets the new length of the array.
void insertAt(uint index, const T &in value)
Inserts a new element into the array at the specified index.
void sortAsc()
Sorts the elements in the array in ascending order. For object types, this will use the type's opCmp ...
void removeLast()
Removes the last element of the array.
int find(uint startAt, const T &in value) const
Returns the index of the first element that has the same value as the wanted value....
int findByRef(const T &in value) const
Searches for a matching address. These are especially useful for arrays of handles where specific ins...
void reverse()
Reverses the order of the elements in the array.
void removeRange(uint start, uint count)
Removes count elements starting from start.
uint length() const
Returns the length of the array.
void removeAt(uint index)
Removes the element at the specified index.
int find(const T &in value) const
Returns the index of the first element that has the same value as the wanted value....
void insertAt(uint index, const T[]&inout arr)
Inserts another array of elements into the array at the specified index.
void insertLast(const T &in value)
Appends an element at the end of the array.
void reserve(uint length)
const T & opIndex(uint index) const
T & opIndex(uint index)
void sortDesc()
Sorts the elements in the array in descending order. For object types, this will use the type's opCmp...
bool isEmpty() const
bool opEquals(const T[]&in) const
void sortDesc(uint startAt, uint count)
Sorts only the elements starting at index startAt and the following count elements in the array in de...
int findByRef(uint startAt, const T &in value) const
Searches for a matching address. These are especially useful for arrays of handles where specific ins...
void sort(less &in, uint startAt=0, uint count=uint(- 1))
sorts array using the passed in less function
T &[] opAssign(const T[]&in)
void sortAsc(uint startAt, uint count)
Sorts only the elements starting at index startAt and the following count elements in the array in as...
String class functions.
kStr & ToUpper()
Converts string to upper case characters.
bool IsEmpty() const
length of string is 0
kStr opAdd(uint16 i) const
kStr opAdd(uint i) const
bool ContainsNoCase(const kStr &in) const
contains the string ignoring case
kStr ReplaceSubstr(const kStr &in from, const kStr &in to) const
Returns a new kStr that replaced all occurrences of from with to.
int8 & opIndex(const uint64 i)
Get/Set the ASCII code of the character at the strings index.
kStr & ToLower()
Converts string to lower case characters.
kStr opAdd(uint64 i) const
bool opEquals(const kStr &in s) const
bool Contains(const kStr &in) const
contains the string
float Atof() const
Converts string to float.
uint64 Length() const
Returns the length of the string.
kStr opAdd(float f) const
kStr opAdd(int i) const
kStr opAdd(int16 i) const
kStr opAdd(const kStr &in s) const
kStr Substr(uint64 start, uint64 length) const
Return a substring from the current string. Will return the current string if start or length indexes...
kStr & opAddAssign(bool b)
kStr opAdd(int64 i) const
kStr(const kStr &in s)
kStr opAdd(bool b) const
const int8 opIndex(const uint64 i) const
Returns the ASCII code of the character at the strings index.
bool StartsWith(const kStr &in s) const
Returns true if this string starts with s.
int Atoi() const
Converts string to int.
uint Hash() const
Returns HashID from this instance.
kStr & opAddAssign(const kStr &in s)
kStr & opAssign(const kStr &in s)
uint64 IndexOf(const kStr &in s) const
Reports the zero-based index of the first occurrence of a specified string within this instance....
bool EndsWith(const kStr &in s) const
Returns true if this string ends with s.
Angle functions.
kAngle & opAssign(const float f)
kAngle opSub(const float f) const
kAngle(const kAngle &in other)
kAngle & opAssign(const kAngle &in a)
float Diff(const float rads) const
kAngle opNeg() const
float opImplConv()
kAngle & opSubAssign(const float f)
float Interpolate(const float a, const float b) const
float Diff(const kAngle &in other) const
kAngle & opAddAssign(const kAngle &in a)
kAngle & opAddAssign(const float f)
kAngle opAdd(const kAngle &in a) const
kAngle(float rads)
kAngle opSub(const kAngle &in a) const
kAngle & opSubAssign(kAngle &in a)
kAngle opAdd(const float f) const
Representation of 3D vectors and points.
kVec3 opAdd(const kVec3 &in v) const
kVec3 & opAssign(const kVec3 &in v)
kVec3 Cross(const kVec3 &in v) const
Cross Product of two vectors.
kVec3 opMul(const float val)
kVec3 & QuadraticCurve(const kVec3 &in pt1, const float value, const kVec3 &in pt2, const kVec3 &in pt3)
kVec3(float x, float y, float z)
float Length() const
Returns the length of this vector. Exactly the same as Unit()
float ToYaw()
Returns the Yaw direction in Rads.
void Set(const float x, const float y, const float z)
Set x, y and z components of this kVec3.
kVec3 opSub(const kVec3 &in v) const
kVec3 & CubicCurve(const kVec3 &in pt1, const float value, const kVec3 &in pt2)
kVec3 & opSubAssign(const kVec3 &in v)
kVec3 opDiv(const kVec3 &in v)
kVec3 & Normalize()
Makes this vector have a magnitude of 1.
kVec3 & Randomize(const float value)
Randomizes x, y, z, components by value.
kVec3 opDiv(const float val)
kVec3 & opAddAssign(const kVec3 &in v)
kVec3 & opDivAssign(const float f)
kStr ToString()
float Distance(const kVec3 &in other) const
Returns the distance between this instance and other vector.
kVec3 & opMulAssign(const kVec3 &in v)
kVec3 opMul(const kQuat &in rot) const
float LengthSq() const
Returns the squared length of this vector. Exactly the same as UnitSq()
kVec3(const kVec3 &in v)
kVec3 & opMulAssign(const float f)
kVec3 Lerp(const kVec3 &in other, const float t) const
Linearly interpolates between two vectors.
float UnitSq() const
Returns the squared length of this vector. Exactly the same as LengthSq()
kVec3 & Lerp(const kVec3 &in other, const float t)
Linearly interpolates between two vectors.
float ToPitch()
Returns the Pitch direction in Rads.
float opIndex(int i) const
kQuat ToQuat() const
kVec3 opAdd(const float f) const
kVec3 opSub(const float f) const
kVec3 & Project(const kVec3 &in normal, const float value)
Projects a vector onto another vector.
kVec3 & opMulAssign(const kQuat &in rot)
kVec3 & opAddAssign(const float f)
kVec3 & opDivAssign(const kVec3 &in v)
float & opIndex(int i)
kVec3 opMul(const kVec3 &in v)
kVec3 opNeg()
kVec3 & Reflect(const kVec3 &in normal, const float energyFactor)
Reflects a vector off the plane defined by a normal.
float DistanceSq(const kVec3 &in other) const
Returns the squared distance between this instance and other.
float Unit() const
Returns the length of this vector. Exactly the same as Length()
kQuat ToQuaternion() const
kVec3 & opSubAssign(const float f)
void Clear()
Sets x, y and z components to 0.
float Dot(const kVec3 &in v) const
Dot Product of two vectors.
Quaternions used to represent rotations.
kQuat Inverse() const
void GetAngles(float &out yaw, float &out pitch, float &out roll)
kQuat & NormalizeNoInvSqrt()
void Set(const float x, const float y, const float z, const float w)
kQuat(float angle, float x, float y, float z)
kQuat Diff(const kQuat &in rot) const
void Clear()
x,y,z = 0.0 w = 1.0
kStr ToString() const
kQuat opSub(const kQuat &in rot)
kQuat(float rotX, float rotY, float rotZ)
kQuat & opAssign(const kQuat &in rot)
kQuat(const kQuat &in other)
kQuat & opMulAssign(const kQuat &in rot)
kQuat(float angle, kVec3 &in vector)
kQuat & Normalize()
kQuat opAdd(const kQuat &in rot)
kQuat opMul(const kQuat &in rot)
kQuat Slerp(const kQuat &in rot, float t) const
float ToYaw() const
Yaw of this plane.
const kVec3 & Normal() const
float Distance(const kVec3 &in point) const
0 = PSIDE_ON. > 0 is PSIDE_FRONT. < 0 PSIDE_BACK.
kPlane(const float a, const float b, const float c, const float d)
float Dot(const kVec3 &in point) const
bool IsFacing(const float yaw) const
Returns true if yaw is facing toward the plane. Usually used for climbing sectors.
kPlane(const kVec3 &in a, const kVec3 &in b, const kVec3 &in c)
float Dot(const kPlane &in plane) const
kVec3 & Normal()
kPlane(const kAngle &in a)
const int PointOnSide(const kVec3 &in point) const
Returns EnumPlaneSide. If point is in front, behind or on the plane.
kPlane(const kVec3 &in a, const kVec3 &in b)
< Not used (included automatically from kexengine)
kColor(float r, float g, float b)
kColor opSub(const kColor &in c) const
kColor(const kColor &in rgb, uint8 a)
kColor & opAssign(const kColor &in c)
void FromVec3(const kVec3 &in v)
void HSLToRGB(float hue, float sat, float lit)
uint DwColor() const
void RGBToHSV(float &out hue, float &out sat, float &out result) const
kColor & opMulAssign(const kColor &in c)
kColor opMul(float f) const
kColor opAdd(const kColor &in c) const
kColor opMul(const kColor &in c) const
kColor(uint rgba)
void RGBToHSL(float &out hue, float &out sat, float &out lit) const
kColor(uint8 r, uint8 g, uint8 b, uint8 a)
kColor & opSubAssign(const kColor &in c)
kColor & opAddAssign(const kColor &in c)
float GetSaturation() const
kColor(const kColor &in c)
kColor(uint8 rgb, uint8 a)
bool opEquals(const kColor &in c) const
kVec3 ToVec3() const
void HSVToRGB(float hue, float sat, float val)
kVec3 ToVec3Linear() const
float GetLuminance() const
kColor ToPreMultiplied() const
void SetLuminance(float)
void PreMultiply()
void FromVec3Linear(const kVec3 &in v)
kColor & opMulAssign(float f)
void SetGrayScale()
void SetSaturation(float)
void LerpRGB(const kColor &in c, float t)
< Not used (garbage included automatically from kexengine)
bool WriteByte(const uint8 i)
uint8 ReadByte()
< Not used (garbage included automatically from kexengine)
kStr GetGroupString(int key, uint groupIndex, uint plat) const
plat: kexLocPlatform_e
kStr TranslateGroupString(const kStr &in key, uint groupIndex, uint plat) const
plat: kexLocPlatform_e
kStr GetString(const kStr &in key, kexLocPlatform_e plat) const
kStr TranslateStringWithArgs(const kStr &in key, const kDict &in pairs, uint plat) const
plat: kexLocPlatform_e
uint GetGroupIndex(const kStr &in groupName)
kStr GetGroupString(const kStr &in key, uint groupIndex, uint plat) const
plat: kexLocPlatform_e
kStr TranslateGroupStringWithArgs(const kStr &in key, const kDict &in pairs, uint groupIndex, uint plat) const
plat: kexLocPlatform_e
kStr TranslateString(const kStr &in key, kexLocPlatform_e plat) const
kStr GetString(int key, kexLocPlatform_e plat) const
kStr TranslateString(const kStr &in key) const
Same as Game.GetLocalizedText.
bool opEquals(const ref &in) const
ref(const ?&in)
~ref()
ref(const ref &in)
ref & opHndlAssign(const ?&in)
bool opEquals(const ?&in) const
ref & opHndlAssign(const ref &in)
void opCast(?&out)
ref obj
Access to ScriptObject class script obj ref. Should never be null.
ref obj
Access to ScriptObjectFx class script obj ref. Should never be null.
Actor script classes must inherit from this class.
void OnCollisionStart()
Collision Movement Check is starting.
void OnSleep()
void OnMenuTick()
called only when dummymenu active
void OnCollide(kCModel@)
called even if alseep
void OnRemoved()
called when actor is removed (Internally or through scripting). IsStale will return true immediately ...
void OnPreDamage(kActor @instigator, kDictMem @damageDef, const int damage)
always called when damaged even after death. Call OverrideOnDamageValue on the actor if you need to o...
void OnPostTick()
For the player script only! Called right after level script ticks.
void OnPreTick()
For the player script only! Called right before all other actors are ticked.
void OnActivate()
void OnSpawn()
Required.
void OnEndLevel()
void OnTouch(kActor @theActorThatTouchedMe)
called even if alseep
void OnDeactivate()
Never used.
void OnPostBeginLevel()
void OnDamage(kActor @instigator, kDictMem @damageDef, const int damage)
always called even after death
void OnBeginLevel()
void OnCollisionFinish()
Collision Movement Check has ended.
void OnRestore()
void OnDeath(kActor @killer, kDictMem @damageDef)
called only when actor dies
void OnTick()
Required.
Weapon script classes must inherit from this class.
void OnBeginFire()
Required.
void OnLower()
Required.
void OnRaise()
Required.
void OnFire()
Required.
void OnEndFire()
Required.
void OnHoldster()
Required.
Player script class must inherit from this class.
void OnPickup(kActor @pickup)
void OnArmorDamage(kActor @instigator, kDictMem @damageDef, const int damage)
Fx script class must inherit from this class.
void OnExpire()
Called OnTick.
bool OnImpactFloor(int impactType, const kVec3 &in normal)
bool OnImpactWall(int impactType, const kVec3 &in normal)
void OnCollide(kCModel @pCModel)
Called just before any of the OnImpact functions (except water).
void OnImpactWater()
Called OnTick after Fx Movement update.
void OnCollidePost()
Called right after OnCollide and the OnImpact functions (except water).
void OnRemoved()
called when actor is removed (Internally or through scripting). IsStale will return true immediately ...
void OnCollisionFinish()
Collision Movement Check has ended.
bool OnImpactObject(int impactType, int impactDmgType, kActor@ actor, const kVec3 &in normal)
void OnCollisionStart()
Collision Movement Check is starting.
bool OnImpactCeiling(int impactType, const kVec3 &in normal)
void OnTick()
Required.
Editable Dictionary object that holds keys and values.
void SetValue(const kStr &in key, const kStr &in value)
Sets the value for the specified key.
void Empty()
Removes all keys/values.
bool GetBool(const kStr &in key, bool &out boolResult, const bool defaultValue=false)
Returns true if found the key as a bool type.
void Add(const kStr &in key, const kStr &in value)
Adds a new key/value.
bool GetInt(const kStr &in key, int &out intResult, const int defaultValue=0)
Returns true if found the key as a int type.
bool GetString(const kStr &in key, kStr &out stringResult)
Returns true if found the key as a kStr type.
bool GetVector(const kStr &in key, kVec3 &out vectorResult)
Returns true if found the key as a kVec3 type.
bool GetFloat(const kStr &in key, float &out floatResult, const float defaultValue=0)
Returns true if found the key as a float type.
const bool HasKey(const kStr &in key)
Returns true if key exists.
Read only Dictionary object that holds keys and values.
bool GetVector(const kStr &in key, kVec3 &out vectorResult)
Returns true if found the key as a kVec3 type.
bool GetBool(const kStr &in key, bool &out boolResult, const bool defaultValue=false)
Returns true if found the key as a bool type.
bool GetFloat(const kStr &in key, float &out floatResult, const float defaultValue=0)
Returns true if found the key as a float type.
bool GetString(const kStr &in key, kStr &out stringResult)
Returns true if found the key as a kStr type.
bool GetInt(const kStr &in key, int &out intResult, const int defaultValue=0)
Returns true if found the key as a int type.
const uint GetNumEntries() const
returns number of items in the list
kSelectionListInt & opAssign(const kSelectionListInt &in other)
void AddItem(int item, const int weight)
void Reset()
clears all items in the list
int & Select()
Returns a value based on item weights.
kSelectionListFloat & opAssign(const kSelectionListFloat &in other)
const uint GetNumEntries() const
returns number of items in the list
void AddItem(float item, const int weight)
void Reset()
clears all items in the list
float & Select()
Returns a value based on item weights.
void SetVisibility(const int nodeIndex, const bool visible)
kVec3 GetNodeScale(const int node)
kStr GetAnimFile() const
kQuat GetNodeRotation(const int node)
Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
kVec3 & PrevOffset()
const int GetNumNodes() const
kVec3 GetNodeOrigin(const int node, const kVec3 &in offset)
Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
void HideSection(const int nodeIndex, const int section, const bool hide)
section is the surface index. must be 0-31 and must not be >= number of surfaces or will do nothing.
void ColorOverrideSections(const int node, const int sectionMask=-1)
enable the color override for specific sections(materials) on the node by setting each bit....
void SetMorphUpdating(const bool bUpdate)
Set Morph Updating.
void SetMorphFrame(const int frame, const int nextFrame, const float time)
void SetTexture(const int section, const int textureID)
void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z, const bool clearInterpolation=false)
void AddTrailEffect(const kStr &in trailName, const int nodeIndex)
const bool IsMorph() const
void ColorOverride(const int node, const float r=1.0f, const float g=1.0f, const float b=1.0f, const float a=1.0f)
color values range from -1.0f to 1.0f. Call ColorOverrideSections to enable the override for sections...
void SetRotationOffset(const int nodeIndex, const kQuat &in rotation, const bool clearInterpolation=false)
const int GetNumAttachedTrails()
void ForceUpdateJoints(const float interpolatedFraction=1.0f)
Force update node matrices and then call GetNodeOrigin/GetNodeRotation to get current value....
void GetMorphFrame(int &out frame, int &out nextFrame, int &out maxFrames, float &out time) const
Get Morph frame info.
kVec3 & Offset()
void SetModel(const kStr &in modelPath, const kStr &in modelAnimPath)
kStr GetModelFile() const
void ScaleOverride(const int node, const kVec3 &in scale)
void RemoveTrailEffect()
Removes all trail effects.
const float TrackTime()
time from 0(on first frame) to 1(on last frame).
const bool CycleCompleted() const
(flags & ANF_CYCLECOMPLETED) != 0
const int LoopFrame()
The frame the animation loops back to when it reaches the last frame. Returns -1 if no animation set.
void Blend(const int animID, float speed, float blend, int flags)
EnumAnimStateFlags.
kVec3 rootMotion
the move direction of the root node from the prev frame to the current frame.
const int GetAnimNumFrames(const int animID)
void Set(const int animID, float speed, int flags)
EnumAnimStateFlags.
kVec3 GetOrigin(const int animID, int nodeNum, int frame)
void Stop()
flags |= ANF_STOPPED; flags &= ~ANF_LOOP;
const int NumFrames()
number of frames in this animation. Returns -1 if no animation set.
const int CurrentFrame()
current frame playing for the current animation. Must have an animation action keyframe for this to w...
void Set(const int animID, float speed, int flags, const int frame, const bool runActions=true, const bool noSoundActions=false)
EnumAnimStateFlags. Sets the animation to the frame while optionally running all previous actions.
void Resume()
flags &= ~ANF_PAUSED;
const float PlayTime()
increases by GAME_DELTA_TIME if not stopped or paused.
void Pause()
flags |= ANF_PAUSED;
const int TrackNextFrame(void) const
next frame to play for the current animation.
void SetPlayTime(const float time)
The total time in seconds this animation has been playing.
void SetLastFrame(const bool execActions=false)
if execActions is true, runs all key frame actions in the animation except Footstep(55) and PlaySound...
const bool Looping() const
(flags & ANF_LOOP) != 0
kQuat GetRotation(const int animID, int nodeNum, int frame)
const bool Blending() const
(flags & ANF_BLEND) != 0
int flags
EnumAnimStateFlags.
float baseOffset
is somewhat the Z position of the root node. It's calculated as follows whenever the root motion is u...
const bool Stopped() const
(flags & ANF_STOPPED) != 0
bool IsPlaying(const int animID)
Returns true if current animations ID is animID and the animation is not stopped.
void Blend(const int animID, float speed, float blend, int flags, const int frame, const bool runActions=true, const bool noSoundActions=false)
EnumAnimStateFlags. Blends the animation to the frame while optionally running all previous actions.
void SetTrackTime(const float time)
0.0(first frame) to 1.0(last frame)
bool CheckAnimID(const int animID)
checks if animID exists
void ChangeSpeed(const float speed)
Scales speed of the current animation where 1.0 = 15fps and 4.0 = 60fps.
const int NumNodes()
number of nodes in this animation. Returns -1 if no animation set.
const int PlayingID() const
the current animations ID
const int TrackFrame(void) const
current frame playing for the current animation.
Base type used by all actors.
bool & DrawDelay()
Don't draw until has ticked once.
kVec3 GetTransformedVector(const kVec3 &in vector)
kVec3 DamageOrigin(void) const
The Origin point of the attacker (Fx, Actor, or null (returns this actors origin in that case)) who d...
bool OnGround() const
float & Friction()
int & DifficultyMode()
The difficulty this actor is currently set to.
void StopLoopingSounds()
void SetSpawnFlags3(const uint flags)
EnumActorSpawnFlags3.
kFx DamageFx() const
The kFx that hit this actor. Will be null if no Fx hit this actor. Only use in OnPreDamage/OnDamage/O...
const int16 SpawnParams(const int paramID) const
Get a map actors param value.
const bool GetUsingCustomDeadHeight()
const int AreaID() const
const int MapActorIndex() const
Returns -1 if not a map actor.
float & BounceDamp()
void SetModel(kStr &in modelFile, kStr &in animFile)
a way to set the model/anim for actors that had no model set previously
void SetDecayTime(const float value)
Used to melt kAI when they regen. Value range should be 0 (normal) to 60 (fully melted).
const int16 GetOverrideKeyTouchTID()
used only for key pickups
bool & NoKnockBack()
Will not receive knock back movement from things like the alien weapon for example.
bool & UseNewExplosiveRadiusCheck(void)
(default False) Set to true to enable explosive damage checks from radius to actor cylinder(more accu...
float & Mass()
default = GAME_SCALE * 1.0f
kAngle & PrevLerpYaw(void)
kAI CastToAI()
Casts to kAI. returns null if isn't a kAI.
int & ImpactType()
EnumImpactType.
void SetCustomDeadHeight(const bool bUse, const float height)
Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
float SoundPlayTime(const kStr &in file, const uint index=0)
returns -1.0f if sound is not playing. Returns the amount of time in seconds the sound has been playi...
const float GetWaterHeight() const
kVec3 DamageVelocity(void) const
The Velocity of the attacker (Fx, Actor, or null (returns this actors velocity in that case)) who dam...
bool FxEventActive()
Returns true if ActorFx is running.
kVec3 & Velocity()
float DistanceToPoint(const float x, const float y, const float z) const
actors point is in the center
bool & IgnoreSectorPlatformChange(void)
if true this actor will not change position(or velocity and movement) when sector platform moves.
const float GetCustomDeadHeight()
void ClearCustomRef(void)
Allows the actor to get freed from memory if it has no references. This will be called automatically ...
kDictMem Definition()
get actors def data
bool CheckPosition(const float angle, const float distance)
calls CheckPosition(kVec3 origin) with origin being: Actor.Origin() + (angle*distance*Actor....
float & WaterFriction()
default = 0.5f (same as Friction)
void Remove()
Removes the actor and sets stale to true. Actor will only internally be removed when there are no ref...
void GetBoundsMinMax(kVec3 &out min, kVec3 &out max) const
actor must not be sleeping and have a model set and not be a pickup. otherwise will return default mi...
kAngle & Pitch()
void LinkArea()
Links the actor to an area node so that internally the actor can be found in quick searches (similar ...
void SetPosition(const kVec3 &in pos, const bool clearInterpolation=true)
best way to set an actors position (if you don't know the sector), will also set the sector and optio...
kAngle & Roll()
const bool InWater() const
float & Height()
float & Gravity()
float & FloorHeight()
void SetSector(const uint sectorIndex)
void SetCurrentGameSpeed(const float speed)
Set Gamespeed of this Actor (default 1.0f)
kActor GetTarget()
kAngle & PrevLerpPitch(void)
bool & IgnoreSectorHeightChange(void)
if true will not change position(or velocity and movement) when sector height changes.
kVec3 & PrevOrigin()
const bool OverridingKeyTouchTID()
used only for key pickups
void OverrideOnDamageValue(const int damage, const bool bOverride=true)
call in OnPreDamage
kFx SpawnProjectile(const kStr &in fxPath, const kVec3 &in pos, const kVec3 &in targetLocation, const float maxAngle)
Returns the first Fx spawned. targetLocation.z gets added by GAME_SCALE * 3.0f.
float RadiusDamageFactor(const kVec3 &in origin, const float radius) const
int & ImpactTypeDmg()
EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
void SetSpawnParams(const int param, const int16 value)
Sets the actors param value. all params are int16.
kAngle & Yaw()
void SetAutomapColor(const int r, const int g, const int b)
kFx SpawnFx(const kStr &in fxPath, const kVec3 &in pos)
const int TID() const
void InflictGenericDamage(kActor@ inflictor, const kexStr &damageDef, const int damage)
Can pass in a damage def. The damageDef keys used are mainly for custom scripting purposes only....
const float GetGameSpeed() const
Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns CurrentGameSpeed * GlobalGameSpeed.
const bool CanSee(kPuppet@ puppet, const uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags). Note: This function that takes in the kPuppet arg...
kScriptObject ScriptObject()
Returns the ScriptObject that holds the obj ref to the custom script. Will return null if actor doesn...
void ClearFxEvent()
Clears all data for the actors ActorFx on this actor.
kFx SpawnFx(const kStr &in fxPath, const kVec3 &in pos, const kQuat &in rot)
float & WallRadius()
uint & ClipFlags()
EnumClipFlags.
kRenderModel RenderModel()
kAngle & PrevLerpRoll(void)
kActor CastToActor()
Casts to a kActor. Only used for kPuppet Actor().
void InflictGenericDamage(kActor@ inflictor, const int damage)
void SetHeadTrackTarget(kActor@ actor)
void SetupSpawnParams()
call after setting your actors spawnflags for them to take effect on the kActor
bool InstanceOf(const kStr &in className) const
example: InstanceOf("kexPuppet")
void InteractActorsAtPosition(const kVec3 &in pos, const kStr &in callbackFunc, const float arg1=0, const float arg2=0, const float arg3=0, const float arg4=0)
Calls a script function on all actors that are in the AreaNodes (KD-Tree search) contained inside a b...
void SetTarget(kActor@ actor)
const float BaseHeight() const
height of actor when spawned or when kAI regenerated
const bool CanSee(kActor@ actor, const uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags)
bool CheckPosition(const kVec3 &in origin)
checks if the actor can move to this location
void SetSpawnFlags2(const uint flags)
EnumActorSpawnFlags2.
void AutomapToggle(const bool show)
Use with Game.AutomapCustom(true);.
const bool IsPersistentMarked()
float & PrevLerpFloorHeight(void)
void InflictDamage(kActor@ inflictor, const kStr &in damageDef)
int & ModelVariation()
const int GetSectorIndexAtLocation(const kVec3 &in pos, uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags)
const bool MoveToPosition(const float x, const float y, uint clipFlags)
EnumClipFlags to use. Returns True if new position is in the same sector as the actor else returns fa...
kVec3 & PrevLerpOrigin(void)
void StopSound()
const float GetCurrentGameSpeed(void) const
Gamespeed of this Actor (default 1.0f)
const uint SpawnFlags2() const
EnumActorSpawnFlags2.
const float DecayTime(void)
Value used to melt kAI when they regen. Values range from 0.0 (normal) to 60.0 (fully melted).
bool & IgnoreGameSpeed()
GameSpeed used for this actor will be CurrentGameSpeed. (Default is true for kPuppet and kPlayerWeapo...
void SetupHeadTrack(const kStr &in headTrackDef)
Sets a headtrack.
void RotateAroundOrigin(const kAngle &in angle, const kVec3 &in platformOrigin, const bool setPos=true)
The angle amount to rotate this actors position. if setPos is true will use SetPosition to position t...
const float GetFloorHeight() const
calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
const bool IsStale() const
Actor is marked as removed and is waiting to be freed from memory when it next checks if there are no...
int GetWaterLevel() const
EnumWaterLevel.
bool & ChildOfTarget(void)
if this actors Target is an actor that belongs to the owner of the Fx, explosion or melee attack then...
void RunFxEvent(const kStr &in fxEventName)
Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");.
void MeleeObject(const kStr &in damageType, const kVec3 &in offset, const float radius)
kVec3 & Movement()
uint & Flags()
EnumActorFlags.
const bool MoveToPosition(const float x, const float y)
Returns True if new position is in the same sector as the actor else returns false and it set a new s...
const uint SpawnFlags3() const
EnumActorSpawnFlags3.
kVec3 & Scale()
void PlaySound(const kStr &in soundPath)
int & SpeciesMask()
const int SectorIndex()
float & StepHeight()
AKA Dead Height. Used for moving up steps, figuring out if in waterheight, and the height of the acto...
float DistanceToPoint(const kVec3 &in point) const
calls DistanceToPoint(x,y,z)
kVec3 & Origin()
Position in world space.
const float GetSkyHeight() const
int & Type()
The actors Type ID.
kAnimState & AnimState()
void CheckLinkArea()
If origin or radius changed since the last LinkArea then calls LinkArea else does nothing....
const float GetCeilingHeight() const
calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
void RunAction(const int funcID, const float w=0.0f, const float x=0.0f, const float y=0.0f, const float z=0.0f)
run a function on the actor defined in defs/animActions.txt
kQuat & PrevLerpRotation(void)
float & Radius()
int16 & Health()
void ClearInterpolation()
bool & SkipKeyTouchCinema()
used only for key pickups
float & AnimSpeed()
void PlaySoundWithLookupID(const int soundID)
bool & TriggerInvincibility()
Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
bool RandomDecision(const int randomBit) const
randomBit should be >= 2. if a random value has the bit set and actors GameTicks also has the bit set...
bool & IgnoreFxGameSpeed()
GameSpeed used for Fx whose source is this actor will always be CurrentGameSpeed. (Default is false)
bool & RemoveTrailsOnAnimChange()
Will remove all model trails on this actor when animation is set/blend.
const uint SpawnFlags1() const
EnumActorSpawnFlags1.
float GetTurnYaw(const kVec3 &in lookAtLocation) const
void AddCustomRef(void)
Keeps the actor from getting freed from memory.
bool HasCustomRef(void) const
kQuat & Rotation()
float & CeilingHeight()
const int RefCount() const
Returns the number of references there are to this actor. If actor is stale and RefCount is 0 then it...
float & SoundPitchModify()
Override the final pitch of sounds owned by this actor. A value of 1000 raises the pitch by the amoun...
void SetSpawnFlags1(const uint flags)
EnumActorSpawnFlags1.
const int GameTicks() const
void MarkPersistentBit(const bool clear)
float GetAvoidanceAngle(const kVec3 &in lookAtLocation, const float distance)
float & AirFriction()
default = 1.0f
void OverrideKeyTouchTID(const bool bOverride, const int16 tid)
used only for key pickups to tell what key it is in the hub
kActor Get()
Returns the next actor in the iterator.
void Reset()
Resets the iterator back to the first actor.
float & PlaySpeed()
Get/Set speed of weapon animations (default = 4.0f)
float & FOV()
Get/Set weapon FOV (default = 47.5f)
kFx FireProjectile(const kStr &in fxPath, const float x, const float y, const float z, const bool adjustToPerspective=false)
SpawnsFx at the players at the position passed in * players rotation, then adds the viewHeight + land...
bool & NoGenericBobbing()
Disables the generic weapon bobbing menu option from affecting this weapon.
kVec3 TransformToOwnerPosition()
returns the OffsetPosition() * the players matrix.
kVec3 TransformToOwnerPosition(const kVec3 &in vector)
returns the (OffsetPosition() + vector) * the players matrix.
bool & ClearInterpolationOffsetPosition()
Set to true to clear the OffsetPosition interpolation after the weapon ticks, then it gets set back t...
bool & NoWalkAnim()
Get/Set the usage of the walk anim. Run animation will be used instead.
kPlayer & Owner()
float & PlaySpeedSwapIn()
Get/Set speed of weapon lower animation (default = 4.0f)
int & State()
EnumWeaponStates.
float & PlaySpeedSwapOut()
Get/Set speed of weapon raise animation (default = 3.0f)
bool & ForceGenericBobbing()
bool & PreventFire()
Use in OnBeginFire to internally prevent from entering its Fire state.
bool & AllowUnderwater()
Set to true to allow the weapon underwater. Gets reset back to the weapons def value after OnBeginLev...
kVec3 & OffsetPosition()
Offset position of weapon.
float & AttackRange()
squared
float & SightRange()
squared
int & Agitation()
0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE
float & SightFOV()
in rads
float & AnimScalar()
default = 1.0f
float & QuietRange()
squared
float & BlendScalar()
default = 10.0f
int & AttackChance()
0-100
void SetupAISpawnFlags()
call after setting your actors spawnflags for them to take effect on the kAI
float & LeashRadius()
squared
int & Regenerate()
get/set current number of times the enemy will regenerate value. Regenerate is set right after OnBegi...
uint & AIFlags()
EnumAIFlags.
float & MeleeRange()
squared
float & FlyHeight()
squared
float & LoudRange()
squared
const float GroundStrafeSpeed() const
default = 10.24f
void SetJumpClimbSpeed(const float speed)
default = GAME_SCALE * 0.2875f
const float JumpMinSpeed() const
default = GAME_SCALE * 0.855f
const float StrafeBobScale() const
void SetGroundBackwardAccel(const float accel)
default = 0.05f
const float LandingViewOffset() const
LandingViewOffset changes when jumping and falling. Origin.z + ViewHeight() + LandingViewOffset() = C...
const float GroundBackwardAccel() const
default = 0.05f
float & Oxygen()
Time in seconds. 0: full oxygen. >= 55: shows air bar. >= 70: OxygenOut is set to true.
void SetSwimBackwardSpeed(const float speed)
default = -10.24f
const int GetMaxLifeforces() const
void SetUnderwaterBobScale(const float scale)
kAngle & CustomViewPitch()
void SetGroundBackwardSpeed(const float speed)
default = -10.24f
void SetOverrideWalkRun(const int value)
0=none(default), 1=Force Disable Walk
const float TurnBobScale() const
const float WalkMaxSpeed() const
default = 4.0f
void SetSwimForwardAccel(const float accel)
default = 0.05f
const float GroundDeaccel() const
default = 0.5f
void SetHeadBobScale(const float scale)
const int OverrideShadow() const
default = 0
void SetGroundStrafeAccel(const float accel)
default = 0.05f
const float GroundForwardSpeed() const
default = 10.24f
void QuietNoiseAlert()
const float GroundForwardAccel() const
default = 0.05f
void SetJumpMaxSpeed(const float speed)
default = GAME_SCALE * 1.667f
const int GetMaxLives() const
void SetStrafeBobScale(const float scale)
uint & PlayerFlags()
EnumPlayerFlags.
void SetWalkMaxSpeed(const float speed)
default = 4.0f
void SetGroundForwardSpeed(const float speed)
default = 10.24f
const float GroundStrafeAccel() const
default = 0.05f
void SetGroundStrafeSpeed(const float speed)
default = 10.24f
float & RecoilPitch()
used for weapon recoil that modifies the players pitch.
kexVec3 & CustomViewOrigin()
kAngle & CustomViewRoll()
const float SwimBackwardAccel() const
default = 0.05f
void SetOverrideWeaponOnTopFix(const int value)
0=none(default), 1=Force disable fix, 2=Force enable fix (can use console command "g_weaponontopfix" ...
const float SwimForwardSpeed() const
default = 10.24f
kAngle & CustomViewYaw()
void SetSwimBackwardAccel(const float accel)
default = 0.05f
void SetCrawl(const bool crawl)
use this to manually set if the player is crawling instead of setting PF_CRAWLING directly.
void SetGroundDeaccel(const float accel)
default = 0.5f
void SetSwimForwardSpeed(const float speed)
default = 10.24f
float & OverrideFOV()
set to 1-179. anything else will stop overriding the fov and will use the r_fov cvar.
void SetMaxLifeforces(const int value)
Amount of Lifeforces needed to get an extra life.
void SetJumpMinSpeed(const float speed)
default = GAME_SCALE * 0.855f
const float SwimStrafeAccel() const
default = 0.05f
const float JumpMaxSpeed() const
default = GAME_SCALE * 1.667f
const int OverrideWalkRun() const
default = 0
void SetSwimStrafeAccel(const float accel)
default = 0.05f
const float SwimStrafeSpeed() const
default = 10.24f
void SetSwimDeaccel(const float accel)
default = 0.5f
void SetSwimStrafeSpeed(const float speed)
default = 10.24f
const float ClimbJumpAmount() const
default = GAME_SCALE * 0.2875f
bool & CustomViewUnderwater()
whether the custom view is underwater or not
const int OverrideWeaponOnTopFix() const
void SetMaxLives(const int value)
Max lives allowed from gaining Lifeforces.
void SetJumpBobScale(const float scale)
const float JumpBobScale() const
bool & NoWallJump(void)
default = false
void SetTurnBobScale(const float scale)
void LoudNoiseAlert()
void SetGroundForwardAccel(const float accel)
default = 0.05f
const float SwimBackwardSpeed() const
default = -10.24f
float & MaxFallVelocity(void)
default = -200.0f
const float GroundBackwardSpeed() const
default = -10.24f
const float SwimDeaccel() const
default = 0.5f
const int GetState(void) const
EnumPlayerStates.
void SetOverrideShadow(const int value)
0=none(default), 1=Force Disable shadow, 2=Force Enable shadow
bool & CustomViewEnable()
Set to true to enable the custom view.
const float UnderwaterBobScale() const
const float SwimForwardAccel() const
default = 0.05f
float & ViewHeight()
set from the players def "player.viewHeight". Origin.z + ViewHeight() + LandingViewOffset() = Cameras...
bool & OxygenOut()
if true will damage player if underwater
const float HeadBobScale() const
For Spawning Actors.
kActor Spawn(const kStr &in actorName, const float x, const float y, const float z, const float yaw, const int sector=- 1)
kActor Spawn(const int actorID, const float x, const float y, const float z, const float yaw, const int sector=- 1)
const int FxIndex() const
The index in the fx file array.
kVec3 InfoMuzzleOffset() const
float InfoSaturationRandom() const
bool InfoOverrideMaxDrawScale() const
void GetColor1(float &out r, float &out g, float &out b, float &out a)
Get the color values.
kStr InfoUserString() const
Custom use.
bool InfoAddOffset() const
void LinkArea()
Links the Fx to an area node so that internally the fx can be found in quick searches (similar to a k...
bool InfoAttachSourceAnimOffset() const
bool InfoProjectile() const
kActor GetOwnerAsActor()
Returns null if is not an Actor.
int InfoFadeinTime() const
void SpawnWaterImpactFx()
float InfoRotationSpeed() const
bool InfoNoSpawnFar() const
bool InfoStopAnimOnImpact() const
int InfoDrawType() const
bool InfoNoDirection() const
float InfoRestart() const
const int InstanceIndex() const
float InfoHueRandom() const
float InfoRotationPivotY() const
bool InfoBullet() const
const float GetWaterHeight() const
bool InfoNoSpawnNear() const
int & ImpactType()
EnumImpactType.
bool InfoDepthBuffer() const
int InfoLifetime() const
kVec3 InfoTranslation() const
kVec3 & VelocityOffset()
When Fx spawns this is set to the starting velocity of the Fx. And adds to velocity if bAddOffset is ...
void Remove()
Removes the Fx and sets stale to true. Fx will only internally be removed when there are no reference...
bool InfoFlash() const
const int BounceCount() const
const float GetSkyHeight() const
float RadiusDamageFactor(const kVec3 &in origin, const float radius) const
void GetColor2(float &out r, float &out g, float &out b, float &out a)
Get the color values.
float & Height()
(Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
void StopLoopingSounds()
void SpawnImpactFx(const int impactType, const kVec3 &in normal, const bool bUseEvent=true, const bool bBlood=true)
bool & DoUpdateMovement()
If set to false the Fx will not move.
bool InfoMuzzleEffect() const
const bool CanSee(kActor@ actor, const uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags)
const int SectorIndex()
float InfoAirFriction() const
bool InfoNoWallSpawn() const
int InfoUserID() const
Custom use.
bool InfoActorInstance() const
float DistanceToPoint(const kVec3 &in point) const
calls DistanceToPoint(x,y,z)
bool InfoAttachSource() const
bool InfoIgnoreGameSpeed() const
bool & DoUpdateExpireCheck()
If set to false the Fx will not expire and get removed when lifetime is over.
int & Frame()
The sprite frame. Make sure this value is < MaxFrames().
void SetTarget(kActor@ actor)
kVec3 & PrevOrigin()
float & Radius()
(Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
float InfoSpawnDistOffset() const
const bool DrawDelay() const
kVec3 & Movement()
kStr FxFilePath()
kScriptObjectFx ScriptObject()
Returns the ScriptObject that holds the obj ref to the custom script. Will return null if kFx doesn't...
bool InfoDecalOffset() const
const bool SwapBloodColor() const
Is true if fx has bBlood set to true and games blood menu option is set to Green(1)....
bool InfoBounceImpact() const
bool InWater()
void ClearCustomRef()
Allows the Fx to get freed from memory if it has no references. This will be called automatically whe...
bool & OnCollideForceNoSetOriginToLast()
If set to true the Fx will never set it's origin and sector to what it was before OnCollide was calle...
float InfoMaxscale() const
float & Friction()
int & ImpactTypeDmg()
EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
bool & DoUpdateScaling()
If set to false the Fx will not update draw scale.
float & RotationOffset()
Current Rotation Offset around the Y Axis. kQuat(RotationOffset(), 0.0f, 1.0f, 0.0f);.
float InfoMass() const
int InfoOnCollideWall() const
bool & ChildOfTarget()
Unused. Only used for kActors.
void SetColor2(float r, float g, float b, float a)
Values range from 0.0 to 1.0. Environment color of the sprite (used in shaders to blend color1 and co...
void SetColor1(float r, float g, float b, float a)
Values range from 0.0 to 1.0. Color and alpha of sprite.
float & FloorHeight()
const float GetFloorHeight() const
calculates the floor height from the Fx sector and origin. Returns 0 if not in a sector.
float InfoWaterFriction() const
kFx GetParentFx()
bool InfoFullScreen() const
const int RefCount() const
Returns the number of references there are to this Fx. If this Fx is stale and RefCount is 0 then it ...
void SetParentFx(kFx@ fx)
float & FrameTime()
The current time left before the Fx sprite tries going to the next frame in the sprite.
void SetOwnerAsFx(kFx@ fx)
int InfoFadeoutTime() const
bool & DoUpdateFading()
If set to false the Fx will not update color1 and color2 alpha value.
float & DrawScaleDest()
When the Fx is updating its scale OnTick, the current draw scale will increase to this value in diffe...
bool InfoStickOnTarget() const
bool InfoLensFlares() const
bool InfoDrawOnBottom() const
float & MaxDrawScale()
The highest value the DrawScale() can become when the Fx is updating its scale OnTick.
kFx GetOwnerAsFx()
Returns null if is not an Fx.
float & Speed()
Initial forward moving speed, set on spawn from forwardSpeed and forwardSpeedRandom in the fx file.
float DistanceToPoint(const float x, const float y, const float z) const
Fx point is in the center.
float & WallRadius()
const float Distance() const
Distance to the center of the View (Player or Camera) at the time the Fx spawned.
int InfoOnCollideActor() const
const float Restart() const
Current delay time before the Fx will start ticking.
bool InfoPerPolyCollision() const
kVec3 & Velocity()
bool & OnCollideForceSetOriginToLast()
If set to true the Fx will set it's origin and sector to what it was before OnCollide was called.
float InfoRotationPivotX() const
float InfoBounceImpactThreshold() const
int InfoAnimspeed() const
bool InfoNoGroundSpawn() const
const float GetCurrentGameSpeed(void) const
Gamespeed of this Fx (default 1.0f)
const int FxID() const
int GetWaterLevel() const
EnumWaterLevel.
const int GameTicks() const
float & Gravity()
float & MovingForce()
initial velocity.Length() value. if bBullet is true then while updating movement OnTick,...
kVec3 InfoBlackColor() const
int InfoMaxInstances() const
bool & DoUpdateRotation()
If set to false the Fx will not update rotation offset.
kAngle & Pitch()
Not used by the Fx.
bool InfoRestrictAim() const
const int AreaID() const
float InfoBrightnessRandom() const
void PlaySoundWithLookupID(const int soundID)
bool InfoOffsetFromFloor() const
float & BounceDamp()
bool InfoNoHitSource() const
float & DrawScale()
Current scale of the sprite.
float InfoScaleDest() const
const bool MoveToPosition(const float x, const float y)
Returns True if new position is in the same sector as the actor else returns false and it set a new s...
const int Instances() const
Same as the instances value in the fx file.
void SetSector(const uint sectorIndex)
float InfoRotationOffset() const
kVec3 & Origin()
bool InfoImpactEffect() const
float & WaterFriction()
kVec3 & MuzzleOffset()
kVec3 InfoWhiteColor() const
kAngle & Roll()
Not used by the Fx.
kStr InfoAnimName() const
Custom use.
const bool MoveToPosition(const float x, const float y, uint clipFlags)
EnumClipFlags to use. Returns True if new position is in the same sector as the actor else returns fa...
float InfoForward() const
const float GetGameSpeed() const
Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns the CurrentGameSpeed * GlobalGameSpe...
bool HasCustomRef() const
float InfoFriction() const
float InfoAnimFriction() const
float InfoScale() const
float & AirFriction()
bool & DidWaterImpact()
float & RecurseLifeTime()
void SetPosition(const kVec3 &in pos, const bool clearInterpolation=true)
best way to set an Fx position without knowing the sector, will also find/set the sector and optional...
bool InfoFadeout(void) const
void RandomizeColors()
void PlaySound(const kStr &in soundPath)
void AddCustomRef()
Keeps the Fx from getting freed from memory.
bool InfoDrawDelay() const
float & RotationSpeed()
Adds this value * (0.25 * GameSpeed) to RotationOffset() when updating rotation OnTick....
int InfoOnCollideFloor() const
int InfoAnimType() const
bool InfoTextureWrapMirrorWidth() const
float InfoNoSpawnNearFarDist() const
bool & IgnoreSectorHeightChange()
const bool IsStale() const
Fx is marked as removed and is waiting to be freed from memory when it next checks if there are no mo...
kStr InfoModelName() const
Custom use.
int & BulletBounces()
bool InstanceOf(const kStr &in className) const
example: InstanceOf("kexFx")
bool InfoSparkle() const
bool OnGround() const
float & MuzzleLifeTime()
float & Mass()
float InfoGravity() const
int InfoMaxBulletBounces() const
bool InfoTextureWrapMirrorHeight() const
void SetCurrentGameSpeed(const float speed)
Set the Gamespeed of this Fx (default 1.0f)
int InfoRecurseLifetime() const
kVec3 & Scale()
const int GetSectorIndexAtLocation(const kVec3 &in pos, uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags)
int InfoVisibilityType() const
kAngle & Yaw()
Not used by the Fx.
void CheckLinkArea()
If origin or radius changed since the last LinkArea then calls LinkArea else does nothing....
const float GetCeilingHeight() const
calculates the ceiling height from the Fx sector and origin. Returns 0 if not in a sector.
void ClearInterpolation()
kVec3 InfoOffset() const
void StopSound()
bool InfoScaleLerp() const
void SetOwnerAsActor(kActor@ actor)
kActor GetTarget()
float InfoTranslationGlobalRandomScale() const
bool InfoDestroyOnWaterSurface() const
bool InfoWeaponView() const
bool & DoUpdateSpriteAnimation()
If set to false the Fx will not update sprite frame.
bool InfoCrossFade() const
float & CeilingHeight()
bool & DoUpdateTickEvents()
If set to false the Fx will not call Tick or WaterTick events.
const uint MaxFrames() const
MaxFrames the sprite has. Frame should be < this value.
bool & IgnoreGameSpeed()
GameSpeed used for this Fx will always be CurrentGameSpeed. (Default = false)
kQuat & Rotation()
bool InfoBlood() const
const int CinematicState() const
EnumCameraStates.
void SetLookAtActor(kActor@ actor)
void TweenRotationTrack(const int view, const kVec3 &in pos, const float time)
Lerps all variables set when SetRotationTrack was called using the time param (clamped 0....
const bool Enabled() const
CinematicState() >= CAMS_FADEOUT (Not Idle)
void ZoomEyeViewToPosition(const kVec3 &in position, const float speed)
linear lerp finalview eye position to position using speed. finalview must be set or will do nothing.
void StartCinematic(const uint flags=12)
EnumCameraFlags.
void SetEyeView(const kVec3 &in position)
position of camera (finalview). finalview must be set or will do nothing.
void ZoomFocusViewToPosition(const kVec3 &in position, const float speed)
linear lerp finalview focus position to position using speed. finalview must be set or will do nothin...
kVec3 origin
current position of camera. if a finalview is set then the origin will be set to the finalview's eye ...
kAngle pitch
if a finalview is set then the pitch will be set to the finalview's look direction.
void SetFinalView(const int view)
the view to use for the camera origin and direction. view must be in range 0-2
void ClearViewTracks()
views 0-2 all variables are set to 0
const bool Active() const
bool & ClearInterpolationOnTick(void)
set to false to handle interpolation yourself
void SetFocusView(const kVec3 &in position)
position of where the camera (finalview) is looking at. (Sets look direction from eye and focus posit...
float lookZOffset
Used only if LookAtActor has been set.
const int AreaID() const
void SetPositionTrack(const int view, const kVec3 &in startEye, const kVec3 &in destEye, const kVec3 &in startFocus, const kVec3 &in endFocus)
Sets eye and focus start and dest positions for use with TweenPositionTrack and AutoPlayPositionTrack...
const bool ViewingFromCamera() const
CinematicState() >= CAMS_FADEIN && CinematicState() <= CAMS_ACTIVE_TO_FADEOUT.
void SetRotationTrack(const int view, const float startAngle, const float destAngle, const float startDist, const float destDist, const float startEyeZOffset=0, const float destEyeZOffset=0, const float startFocusZOffset=0, const float destFocusZOffset=0)
Use with TweenRotationTrack and AutoPlayRotationTrack.
void StopCinematic(const bool noFade=false)
if noFade is true will stop the cinematic immediately without fading out.
void TweenPositionTrack(const int view, const float time)
Lerps eye and focus positions to the start and dest positions using the time param (clamped 0....
kVec3 & Tremor()
x = adds to yaw, y = adds to pitch, z = adds to roll. lerps to vecZero using lerpTime of GAME_FRAME_T...
void SetSector(const uint sectorIndex)
const int SectorIndex()
kAngle roll
if a finalview is set then the roll will be set to 0.
void ClearLookAtActor()
float fov
Camera FOV (default is 74.0)
kAngle yaw
if a finalview is set then the yaw will be set to the finalview's look direction.
kVec3 GetEyeView()
position of camera (finalview). finalview must be set or will return vecZero.
void SetUserInterrupted(const bool toggle)
set to false to set the user interrupted to false.
const uint Flags() const
EnumCameraFlags.
void AutoPlayPositionTrack(const int view, const float speed, const int lerpType)
EnumCameraLerpType. Calls TweenPositionTrack on the view using speed and lerpType.
kVec3 GetFocusView()
position of where the camera (finalview) is looking at. finalview must be set or will return vecZero.
const bool UserInterrupted() const
User pressed left click or escape key or any controller button. While CinematicState() == CAMS_ACTIVE...
void AutoPlayBlendTrack(const int viewA, const int viewB, const int viewC, const float speed, const int lerpType)
EnumCameraLerpType. Blends between viewB and viewC eye and focus. and sets the results to viewA.
bool & AllowMenusWhenActive(void)
set to true to allow the pause menu to be opened during a cinematic
void ClearInterpolation()
void SetRotateEyeVector(const kVec3 &in vector)
The focus position that is used when AutoPlayRotationTrack is called if there is no LookAtActor set.
void ClearFinalView()
finalview is set to null
void AutoPlayRotationTrack(const int view, const float speed, const int lerpType)
EnumCameraLerpType. Calls TweenRotationTrack on the view using speed and lerpType.
The kCModel(CModel) global stores collision results when certain actor methods are called....
kVec3 & ContactNormal()
Returns the normalized vector of the collided surface.
kActor ContactActor()
handle pointer to actor that was collided (null if none was collided)
const uint ClipResult()
specifies the type of intersection (flags)
kVec3 & InterceptVector()
Returns the vector that intersected the collided geometry.
kVec3 & MoveDirection()
Movement vector of the object.
const float & Fraction()
returns the 0.0 - 1.0 range of the point of intersection from start to end trace. (If fraction is == ...
void StartWarp(kActor@ actor, const int tagID, const int mapID)
void TagActorForBossBar(kActor@ actor)
void ClearWarpInterpolation(void)
Clearing the interpolation for kPuppet will also clear the warp interpolation.
const bool CheckWarping()
Checks if Warping or FreeWarping is in progress.
const int UnscaledTicks() const
Not affected by GameSpeed.
void HandlePlayerDeath(const bool loseLife=true)
if loseLife is true and infinite lives cheat is off then player loses a life. if player lives is < 0 ...
const bool CanOpenSaveMenu()
Checks if it's okay to be able to open the save menu.
const float Ticksf(void) const
affected by gamespeed
void CheckKeys()
Prints HUD messages to tell the player how many keys they've found on the current HUBID.
void ChangeMap(const kStr &in mapName)
const int NewMapWarpTID()
Returns the warp TID the player warped to from another map. Returns -1 of didn't warp from another ma...
void RemoveBossActor()
void StartFreeWarp(kActor@ actor, const kVec3 &in origin, const float yaw, const int sectorIndex, const int mapID)
const int Ticks() const
affected by gamespeed (Ticksf truncated)
const bool CanOpenPauseMenu()
Checks if it's okay to be able to open a menu.
const bool GetCvarValue(const kStr &in cvarName, kStr &out result)
void MouseToHUD(float &out x, float &out y)
Returns the HUD position of the mouse.
void MouseToHUDNoStretch(float &out x, float &out y)
Returns the HUD position of the mouse.
int VideoHeight()
void Warning(const kStr &in message)
int Mouse_X()
void Print(const kStr &in message)
int VideoWidth()
int Mouse_Y()
void FloodMatchingAreaFlags(const int sectorIndex, const uint flags, const bool active)
(EnumAreaFlags) Sets flags on all adjacent sectors with matching areaID.
void ChangeAreaWallImpact(const int areaID, const int value)
value: EnumImpactType
const int GetAreaAmbience(const int area) const
const int GetAreaFloorImpact(const int areaID) const
EnumImpactType.
const float GetAreaWaterZFar(const int area) const
const int GetNumSectors() const
const float GetAreaWaterHeight(const int area) const
const int GetNumAreas() const
void ChangeAreaFloorImpact(const int areaID, const int value)
value: EnumImpactType
void FloodFillAreaFlags(const kVec3 &in origin, const uint flags, const bool active)
(EnumAreaFlags) Calls FloodMatchingAreaFlags with FindNextClosestSector(origin) sector.
const float GetAreaBlendLength(const int area) const
the speed to interpolate the fog color/start/zfar values when they change
const int GetSectorDrawOrder(const int sectorIndex) const
lowest draw order (0) draws the sectors on the automap last
const int GetSectorBridge(const int sectorIndex, const uint bridge) const
Get the sector of the bridge. Use GetSectorNumBridges to loop through them all.
void SetSectorFlags(const int sectorIndex, const int flags)
Keep in mind sector flags are a 16 bit unsigned integer and only the first 16 area flags (up to AAF_M...
kActor GetActorByTID(const int tagID, const int typeFilter=- 1) const
if typeFilter is -1 checks any type otherwise only returns the actor of that type
const int GetNumActors() const
number of actors that are in the current maps data
void OverrideWaterFogColor(const int r, const int g, const int b)
rgb values are 0-255
void GetSectorVertIndices(const int sectorIndex, int &v1, int &v2, int &v3) const
Get the Sectors vertex indices. If invalid sectorIndex is passed in will return all -1.
void ChangeAreaArg(const int areaID, const int arg, const int16 value)
const float GetAreaFogZFar(const int area) const
void ChangeSectorCeilingHeight(const int sectorIndex, const float height)
Changes all sectors ceiling vertices with the same areaID to the height.
const int GetAreaCullBits(const int area) const
if any staticmeshes cullBits have any of the area cullBits set then it will draw. (default callbits i...
void OverrideFogColor(const int r, const int g, const int b)
rgb values are 0-255
void SetAreaFogColor(const int area, const kVec3 &in color)
color values are in range 0-255
void SetAreaWaterColor(const int area, const kVec3 &in color)
color values are in range 0-255
void SetAreaMapColor(const int area, const int color)
const int GetSectorAreaID(const int sectorIndex) const
const uint GetAreaFlags(const int areaID) const
EnumAreaFlags.
const int GetSectorFlags(const int sectorIndex) const
Returns a 16 bit unsigned integer. Only the first 16 area flags (up to AAF_MAPPED) are used for secto...
void ChangeSectorHeightVertices(const int sectorIndex, const float height, const int ptMask=7)
Changes only the sector floor vertices(specified using the ptMask) to the height.
const kStr GetSkyMaterial() const
void GetSectorLinks(const int sectorIndex, int &out sectorIndex1, int &out sectorIndex2, int &out sectorIndex3) const
Get the 3 sectors links. -1 means there was no sector linked to that edge. Link 1 is pt1 to pt3 Link ...
void FloodFillAreaFlags(const int sectorIndex, const uint flags, const bool active)
(EnumAreaFlags) Sets flags on all adjacent sectors until it finds a sector that has the flags already...
void ChangeAreaFlag(const int areaID, const uint flags, const bool active)
(EnumAreaFlags) Only sets the areaID flags and not the sector flags. Should most likely prefer using ...
const int FindNextClosestSector(const kVec3 &in origin)
Returns the sector that this point is best in. Returns -1 if not inside and above/on a sector.
void SetAreaAmbience(const int area, const int ambience)
const int FindClosestSectorByDistance(const kVec3 &in origin)
Returns the closest sector. Will return -1 only if the map contains no sectors.
const float GetAreaSkySpeed(const int area) const
speed scale is this value / 100. 100 is normal speed.
const kVec3 GetAreaWaterColor(const int area) const
color values are in range 0-255
const int GetAreaWallImpact(const int areaID) const
EnumImpactType.
const int GetAreaMusic(const int area) const
void SetSectorDrawOrder(const int sectorIndex, const int drawOrder)
lowest draw order (0) draws the sectors on the automap last
void ChangeSectorCeilingHeightVertices(const int sectorIndex, const float height, const int ptMask=7)
Changes only the sector ceiling vertices(specified using the ptMask) to the height.
const int GetAreaMapColor(const int area) const
void SetAreaWaterZFar(const int area, const float zfar)
void ChangeSectorHeight(const int sectorIndex, const float height)
Changes all sectors floor vertices with the same areaID to the height.
void OverrideSkyMaterial(const kStr &in path)
Example path: "skies/skyMaterials/sky_brown" You can clear the sky with an empty string: "" Do not pa...
const bool PointInsideSector(const int sectorIndex, const kVec3 &in point) const
Returns true if point is inside the sector (XY only)
void SetAreaFogZFar(const int area, const float zfar)
void SetAreaSkyHeight(const int area, const float height)
void SetAreaCullBits(const int area, const int bits)
if any staticmeshes cullBits have any of the area cullBits set then it will draw. (default callbits i...
void SetAreaMusic(const int area, const int music)
const uint GetSectorNumBridges(const int sectorIndex) const
number of bridge sectors this sector has
const int16 GetAreaArg(const int areaID, const int arg) const
Returns an area arg value.
void ChangeAreaWaterHeight(const int areaID, const float height)
WaterHeight is stored per area, not per sector or per vertex.
bool TriggerActorsByTID(kActor@ instigator, const int tagID)
Triggers an actor (that is not the instigator) that has the same tagID. Returns true if triggered an ...
void SetAreaSkySpeed(const int area, const float speed)
speed scale is this value / 100. 100 is normal speed.
const kVec3 GetAreaFogColor(const int area) const
color values are in range 0-255
void ClearOverrideWaterFogColor()
Stops overriding and uses the sector color.
void GetSectorCorners(const int sectorIndex, kVec3 &out pt1, kVec3 &out pt2, kVec3 &out pt3, kVec3 &out heights) const
Get the Sectors vertex position and height Link 1 is pt1 to pt3 Link 2 is pt2 to pt1 Link 3 is pt3 to...
void ClearOverrideFogColor()
Stops overriding and uses the sector color.
const float GetAreaSkyHeight(const int area) const
void MoveSectorPlatform(const int sectorIndex, const kVec3 &in moveDelta, const uint flags=SPF_DEFAULT)
EnumSectorPlatformFlags. Moves bridge sectors vertices not connected to non bridge sectors by moveDel...
void SetAreaBlendLength(const int area, const float blendLength)
a blendLength value of 1.0 interpolates the fog color/start/zfar values at 0.066666 (1/15) per tick.
const int GetCurrentMapID()
void StopTactile(int vibHandle)
void CenterMouse()
void Print(const kStr &in text, const int ticks=120)
Print a message to the HUD on the next line.
kStr GetLocalizedText(const kStr &in key)
bool SphereInView(const kVec3 &in origin, const float radius)
void OverrideRespawningEnemies(const int value)
Set: Game.OverrideRespawningEnemies(); Get: GameVariables.GetInt("OverrideRespawningEnemies",...
void LifeForcePulse()
Shows the LifeForces on the HUD.
void KillAllFx()
bool EnemiesAlwaysDropItems()
Returns the gameplay menu option value.
void SetWorldSunDirection(const float x, const float y, const float z)
kStr GetCommandBind(const kStr &in command, const bool first=true, const bool sort=true)
Returns the key bind name of the console command. Returns empty string if nothing is bound.
bool MusicIsPaused()
void SaveMenu()
Opens the save game menu. Should always check if(PlayLoop.CanOpenSaveMenu())
bool SetWeaponWheelPic(const int weapon, const kStr &in imagePath)
void SetPickupFlash()
Shows the pickup screen flash.
void SetModBindings(const bool show=true)
Shows custom mod bindings in menu Bindings > Actions.
bool & NoArmorFlash(void)
kStr GetFxFile(const int fxID)
Returns the file path to the Fx by ID value as defined in defs/fileLookup.txt.
void OpenAudioMenu()
void SetPreventOpenPauseMenu(const bool value)
void OpenHeadBobbingMenu()
bool SetPicColor(const int id, const int r=255, const int g=255, const int b=255, const int a=255)
const float GetMaxZDrawDistance()
Returns GetExtraZFar + the max z-draw distance from the active map def.
void HaltMapScript(const int scriptID)
bool IsTactilePlaying(int vibHandle, const kStr &in path)
void ScreenPointToHUD(float sx, float sy, float &out x, float &out y)
Returns the HUD position of the screen point.
void ClearTextInterpolation(const int id)
void OverrideFogType(const int value)
0=none, 1=force Radial, 2=force Plane
void OverridePerPolyCollision(const int value)
0=none, 1=force disable, 2=force enable
void OpenWeaponBindingsMenu()
void PlayMovie(const kStr &in filename, const bool skippable=true)
Only .ogv or .webm files (replaces/adds extension to filename automatically). Can not read from kpfs.
int PlayTactile(const kStr &in path, int channel, int pos)
Start controller vibration from tactile sound file. Returns a handle.
bool SetPicUV(const int id, const float s1=0.0f, const float t1=0.0f, const float s2=1.0f, const float t2=1.0f)
bool & HideAmmo()
Hide ammo display on the HUD.
float GetHUDOffset(const bool user=false)
if user is false will return the width to the edge of the screen (negative value)....
void ShowPauseMenu()
Should always check if(PlayLoop.CanOpenPauseMenu())
void AutomapDeactive(const bool toggle)
permanently deactivates the automap.
bool GetHubKeyInfo(const uint hubID, int &out nKeys, int &out remainingKeys, int &out keyBits)
bool IsTactilePlaying(int vibHandle)
void SetCursorHotPos(int x, int y)
change the mouses cursors click point (default is 0, 0)
bool & HideCrosshair()
Hide Crosshair display on the HUD.
void ScreenPointToHUDNoStretch(float sx, float sy, float &out x, float &out y)
Returns the HUD position of the screen point.
bool IsCheatActive(const int cheatBits)
EnumCheatFlags. Returns true if cheats are active.
void AddText(const int id, const int font, const kStr &in text, const float x, const float y, const int edge=0, const float scale=1.0f, const bool center=false, const bool shadow=false, const int r=255, const int g=255, const int b=255, const int a=255, const int r2=255, const int g2=255, const int b2=255, const int a2=255)
add custom text to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel...
bool BoxInView(const kVec3 &in min, const kVec3 &in max)
bool IsJoystickActive()
if true the players last input was from a controller.
const int BossDamageScaler(const int difficulty, const int damage)
bool SetPicEdge(const int id, const int edge)
edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOff...
void StopTimer()
bool SetPicWH(const int id, const float w, const float h)
bool SetTextColors(const int id, const int r=255, const int g=255, const int b=255, const int a=255, const int r2=255, const int g2=255, const int b2=255, const int a2=255)
const bool IsActorPersistentMarked(const int actorIndex, const int hubID=-1, const int mapNum=0)
an invalid hub or map uses current maps persistent data.
void OverrideBloom(const int value)
0=none, 1=force disable, 2=force enable
kStr GetInputImagePath(const kStr &in bindName)
void PrintLine(const kStr &in text, const int lineNumber, const int ticks=120)
Print a message to the HUD.
kFx SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in velocity, const kVec3 &in origin, const kQuat &in rotation)
void LivesPulse()
Shows the Lives on the HUD.
void PrintHelp(const kStr &in text, const bool endGame=false)
void SetNoModSelect(const bool bToggle=true)
Disable the mod select menu when selecting new game for workshop mods only. (seta g_nomodselect "1")
bool LoadModFile(const kStr &in filename)
Loads a custom save file. make sure to call GameModFileData.Empty() after you're done loading.
void StopAllTactile()
void GetSectorInBounds(const kVec3 &in min, const kVec3 &in max)
The array of sectors is stored in Game.GetSectorResult. (KD-Tree search)
void OpenMenuBindingsMenu()
bool SetPicAngle(const int id, const float angle)
in rads
void CallDelayedMapScript(const kStr &in funcName, kActor@ instigator, const float delay)
even with delay 0 it will be called when map scripts update
void OpenLevelKeysMenu()
void SetGlobalSoundPitch(const float pitch)
When sounds begin to play their pitch is scaled by this value.
kFx SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in velocity, const kVec3 &in origin, const kQuat &in rotation)
const int GetMapNumberFromName(const kStr &in mapName)
This returns the HUB number NOT the map number. mapName is the HUB name such as "Map_Jungle"....
void NextSoundPitchScale(const float pitch)
The next play sound will scale the pitch by this much.
bool InputImageExists(const kStr &in path)
void NextSpawnFxSetResults()
On the next call to SpawnFx or any other function that calls SpawnFx (such as SpawnProjectile and Fir...
bool SetTextProps(const int id, const float scale, const int font=0, const int edge=0, const bool center=false, const bool shadow=false)
Set the text scale, font, edge, center, shadow.
void StopMusic()
void MarkActorPersistentBit(const int actorIndex, const bool clear=false, const int hubID=-1, const int mapNum=0)
an invalid hub or map uses current maps persistent data.
const int GetMapIDFromName(const kStr &in mapName)
This returns the mapID from the mapName. Returns -1 if not found.
void ClearPicInterpolation(const int id)
float MusicPlayTime()
Returns the amount of time the music has been playing for in seconds. Doesn't reset back to 0 when lo...
void OpenOptionsMenu()
saves config file when exiting this menu
void SetAllSoundsPitchScale(const float pitchScale)
Sets all playing sounds pitch scale.
bool & HideBossBar()
Hide BossBar display on the HUD.
void SaveModFile(const kStr &in filename)
Saves a custom save file. make sure to call GameModFileData.Empty() before adding key/values to save.
void SetDifficulty(const int value)
EnumDifficulty.
bool & NoPickupFlash(void)
void DisableLegalText()
Removes the text at the bottom of the title screen.
void AutomapToggle(const bool toggle)
show/hide the automap.
bool SetPicOrigin(const int id, const float x, const float y)
bool RemoveText(const int id)
int PurgeUnusedModels()
Returns number of models freed.
kFx SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in origin, const kQuat &in rotation)
void GetActorInBounds(const kVec3 &in min, const kVec3 &in max)
The array of actors is stored in Game.GetActorResult. (KD-Tree search). Each actors bounds is calcula...
const bool AutomapDeactived()
kFx GetFxResult(const uint index)
Use after calling Game.GetFxInBounds. Do not use at any other point!
void SetWorldSunLightColor(const float r, const float g, const float b)
void PlaySound(const kStr &in path)
bool MusicIsPlaying()
uint GetActorResultsLength()
Use after calling Game.GetActorInBounds.
void AutomapCustom(const bool toggle)
allow actors with custom automap colors to be drawn to the automap. (for mods)
void ShowMainMenu(const bool mouseCenter=true)
const float ShakeIntensity()
const float GetExtraZFar()
a custom amount for modders to add to the zfar value
void SetExtraZFar(const float zfar)
affects actors, ai, particles, fog and underwater. (works normally unlike the cvar r_zfarextent)
bool CanUseCustomNoStretch()
Returns true if aspect ratio is 4:3 or bigger width.
bool & HideHealth()
Hide health display on the HUD.
void ClearLivesPic()
void StartTimer()
bool ClearWeaponWheelPic(const int weapon)
bool IsWorkshop()
Returns true if game was run through the steam workshop (ran with command arg -workshop)
bool SetTextMsg(const int id, const kStr &in text)
void CallDelayedMapScript(const int scriptID, kActor@ instigator, const float delay)
even with delay 0 it will be called when map scripts update
void SetPicOrder(const int id, const int order)
bool SetTextOrigin(const int id, const float x, const float y)
bool & NoDamageFlash(void)
bool & HideWeaponWheel()
Hide WeaponWheel display on the HUD.
void PlayMusicID(const int musicID, const int fadeTimeMS=500, const bool loop=true)
MusicID -2 plays previous track, -1 stops the music.
void OpenHUDOptionsMenu()
void SetDamageFlash()
Shows the damage screen flash.
void SetWorldSunAmbientColor(const float r, const float g, const float b)
uint GetSectorResultsLength()
Use after calling Game.GetSectorInBounds.
const uint ConButtons()
EnumPlayerConButtons.
void OpenActionBindingsMenu()
void OpenGameplayMenu()
bool IsRunningMapScript(const int scriptID)
uint GetFxResultsLength()
Use after calling Game.GetFxInBounds.
kVec3 GetWorldSunAmbientColor()
void OpenBindingsMenu()
void NextSoundVolumeScale(const float volume)
The next play sound will scale the volume by this much.
const int GetDifficulty()
EnumDifficulty. Internally calls GameVariables.GetInt("g_difficulty")
kVec3 GetWorldSunLightColor()
bool AddPic(const int id, const kStr &in path, const float x, const float y, const float w, const float h, const int edge=0, const float s1=0.0f, const float t1=0.0f, const float s2=1.0f, const float t2=1.0f, const int r=255, const int g=255, const int b=255, const int a=255)
add custom image to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLeve...
const bool AutomapEnabled()
is the automap displaying on screen
void PlayMusic(const kStr &in path, const bool loop)
Use PlayMusicID instead.
kStr GetMapNameFromID(const int mapID)
Finds the name of the map with the mapID.
void Restart()
void ClearText()
bool & HideLives()
Hide Lives display on the HUD.
bool SetTextColor(const int id, const int r=255, const int g=255, const int b=255, const int a=255)
void SetTextOrder(const int id, const int order)
kStr MusicSong()
void ClearDummyMenu(bool bClearAll=false)
void MusicPitch(const float pitch)
void GetTextSize(const kStr &in text, const int font, const float scale, float &out width, float &out height)
EnumGameFontType.
float GetGameSpeed()
bool SetHubKey(const uint hubID, int key)
uint MenuButtons(void) const int64 GetTimestamp()
bool SetPicTex(const int id, const kStr &in path)
kFx SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in origin, const kQuat &in rotation)
void LoadMenu()
Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
kVec3 WorldToScreenPoint(const kVec3 &in origin)
bool & HideTimers()
Hide Timers display on the HUD.
bool MusicIsFading()
void ResumeMusic()
void ClearLifeForcePic()
const bool GetPreventOpenPauseMenu()
void ChangeMap(const kStr &in path)
void SetWaterReflectionViewPoint(const kVec3 &in point)
bool RemovePic(const int id)
kVec3 GetWorldSunDirection()
kFx SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in origin, const float yaw, const float pitch)
void CallMapScript(const int scriptID, kActor@ instigator)
Use to call map script right away.
bool & HideAirBar()
Hide AirBar display on the HUD.
float GetHUDOffsetNoStretch(const bool user=false)
if user is false will return the width to the edge of the screen (negative value)....
kDictMem GetActorDef(const kStr &in name)
Returns the Actors Def by name.
void WeaponWheelPulse()
Shows the WeaponWheel on the HUD.
void SetWaterReflectionAlpha(const float alpha)
Default is 1.0f.
kDictMem GetActorDef(const int type)
Returns the Actors Def by it's type.
void SetGameSpeed(const float speed, const float blendSpeed)
Sets the current GameSpeed. kPuppet and kPlayerWeapon are not affected by GameSpeed.
void MessageBox(const kStr &in msg1, const kStr &in msg2)
void ToggleCursor(bool b=false)
kFx SpawnFx(const kStr &in fxPath, const kVec3 &in origin, const int sectorIndex)
void RemoveTimer()
bool & HideLifeForces()
Hide LifeForces display on the HUD.
void SetArmorFlash()
Shows the armor damage screen flash.
void OpenGraphicsMenu()
kStr GetActionBind(const int action, const bool first=true, const bool sort=true)
Returns the key bind name of action. Returns empty string if nothing is bound.
void GetDateAndTime(int &out seconds, int &out minutes, int &out hours, int &out day, int &out month, int &out year, kStr &out text)
kStr PlayerName()
Returns "Player" if could not get name.
bool LoadModDataFile(const kStr &in filename)
Load any file in your mod that is a kDict binary. Use the python T1_json2modbin.py on the main script...
bool & HideHelpMessages()
Hide HelpMessages display on the HUD.
int GetSectorResult(const uint index)
Use after calling Game.GetSectorInBounds. Do not use at any other point!
kFx SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in origin, const float yaw, const float pitch)
void OverrideSkyHeight(const float height)
Set to 0 to stop overriding.
bool & UseCustomNoStretch()
Set to true to use the non stretch Hud fix for Custom Text and Pics.
void EnableWaterReflectionViewPoint(const bool enable)
void GetFxInBounds(const kVec3 &in min, const kVec3 &in max)
The array of Fx is stored in Game.GetFxResult. (KD-Tree search). Each Fx bounds is calculated as MAX(...
bool & HideRunWalk()
Hide RunWalk display on the HUD.
void ClearPics(const bool clearImageCache=false)
void PauseMusic()
void PlaySoundID(const int soundID)
void StopSounds()
bool & HideMessages()
Hide Messages display on the HUD.
void SetLivesPic(const kStr &in imagePath)
void ClearInterpolationOnGameObjects()
Clears Interpolation on all gameobjects and the camera if it's active.
kActor GetActorResult(const uint index)
Use after calling Game.GetActorInBounds. Do not use at any other point!
const float ViewZFar()
void OpenAutomapBindingsMenu()
void ConfirmMenu(const kStr &in msg1, const kStr &in msg2)
void RunWalkPulse()
Shows the RunWalk graphic on the HUD.
void SetLifeForcePic(const kStr &in imagePath)
void ShowDummyMenu(void)
Actors OnMenuTick function will now be processed. Call ClearDummyMenu to close the dummy menu.
void Reset()
Resets the iterator back to the first Fx.
kFx Get()
Returns the next Fx in the iterator.
void CyclePrevWeapon(const bool bCheckAmmo=false)
const bool HasAltAmmo(const int weaponID) const
const bool HasAltAmmo() const
const int LifeForces()
kPuppet Actor()
const int GetAltAmmo(const int weaponID) const
void SetCheckPoint(const int warpTID, const int map)
kWeapon GetWeaponActor(const int weapon)
int16 & ExtraHealth()
should be <= MaxExtraHealth
bool GiveAmmo(const int weapon, const int amount, const bool altAmmo)
set amount to negative values to take ammo
void Victory(const int warpActorID=- 1, const int mapID=- 1)
int16 & Armor()
bool & RunWalkToggle()
if true walking is enabled. (saves)
const int CurrentCheckPoint()
returns warpTID
const int GetWeaponGroup(const int weapon)
const uint16 Buttons() const
returns EnumPlayerButtons
void SetLives(const int amount)
const float GetSpiritualTime() const
void CancelSpiritualTime(float blendTime=1.0f)
if in spirit mode then will set gamespeed back to 1.0f using the passed in blendTime
bool GiveHealth(const int amount, const bool bMortalWound)
Takes into account extra health, and max health values. 0 is full health, negative amounts give extra...
bool & Backpack()
const int CurrentCheckPointMap()
void CycleNextWeapon(const bool bCheckAmmo=false)
const int PendingWeapon() const
void SetLifeForces(const int amount)
const bool SetWeaponUseAltAmmo(const int weapon, const bool bToggle)
void SetSpiritualTime(const float time, const float blend)
time = time until cancels the effect. Should SetGameSpeed after calling this.
const bool WeaponUsingAltAmmo(const int weapon) const
void ConsumeAmmo(const int ammo, const bool preferredAmmo=true)
int16 & MaxExtraHealth()
should be <= MaxHealth
const int CurrentWeapon() const
const bool Locked() const
uint ButtonHeldTime(const int btn)
btn type is EnumInputActions
bool & UseAltAmmo()
bool & SilentCheckPoints(void)
if true won't show checkpoint message or play sound when on a checkpoint area. Gets set back to false...
void Lock()
const kVec3 GetButtonMovement() const
bool & NoLandClearVel()
if true, when doing a hard landing you will not lose your velocity (saves)
bool RemoveWeapon(const int weapon)
void Unlock()
const kVec3 GetButtonAngles() const
int16 & MaxHealth()
should be >= MaxExtraHealth and ExtraHealth
void SetWeaponGroup(const int weapon, const int group)
Binds this weapon to another weapons index. Example: you made a new pistol weapon at index 14 and wan...
void ChangeWeapon(const int weapon)
const bool HasAmmo(const int weaponID, const bool checkAlt=true) const
if checkAlt is false only checks primary ammo
const bool HasWeapon(const int weaponID) const
const int Lives() const
bool GiveWeapon(const int weaponID, const int ammo, const bool switchNewWeapon=true)
returns true if gave ammo else returns false because already has full primary ammo....
float & LookSensScale()
Scales mouse/controller/gyro sensitivity (default = 1.0f)
const bool WeaponAllowUnderwater(const int weapon) const
bool & NoWeaponSwitchOnWaterLand()
will not auto switch weapon when entering/exiting water. (saves)
const int GetAmmo(const int weaponID) const
void ConsumeAltAmmo(const int ammo)