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
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
499
500/**
501 * @class array<T>
502It is possible to declare array variables with the array identifier followed by the type of the elements within angle brackets.
503
504Example:
505
506@code{.cpp}
507 array<int> a, b, c;
508 array<Foo@> d;
509@endcode
510
511a, b, and c are now arrays of integers, and d is an array of handles to objects of the Foo type.
512
513When 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:
514
515@code{.cpp}
516 array<int> a; // A zero-length array of integers
517 array<int> b(3); // An array of integers with 3 elements
518 array<int> c(3, 1); // An array of integers with 3 elements, all set to 1 by default
519 array<int> d = {5,6,7}; // An array of integers with 3 elements with specific values
520@endcode
521
522Multidimensional arrays are supported as arrays of arrays, for example:
523
524@code{.cpp}
525 array<array<int>> a; // An empty array of arrays of integers
526 array<array<int>> b = {{1,2},{3,4}} // A 2 by 2 array with initialized values
527 array<array<int>> c(10, array<int>(10)); // A 10 by 10 array of integers with uninitialized values
528@endcode
529
530Each 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.
531
532@code{.cpp}
533 a[0] = some_value;
534@endcode
535
536When the array stores handles the elements are assigned using the handle assignment.
537
538@code{.cpp}
539 // Declare an array with initial length 1
540 array<Foo@> arr(1);
541@endcode
542
543@code{.cpp}
544 // Set the first element to point to a new instance of Foo
545 @arr[0] = Foo();
546@endcode
547
548Arrays can also be created and initialized within expressions as anonymous objects.
549
550@code{.cpp}
551 // Call a function that expects an array of integers as input
552 foo(array<int> = {1,2,3,4});
553@endcode
554
555 */
556template <class T>
557class array // class array<T>
558{
559public:
560 void insertAt(uint index, const T&in value); ///< Inserts a new element into the array at the specified index.
561 void insertAt(uint index, const T[]&inout arr); ///< Inserts another array of elements into the array at the specified index.
562 void insertLast(const T&in value); ///< Appends an element at the end of the array.
563 void removeAt(uint index); ///< Removes the element at the specified index.
564 void removeLast(); ///< Removes the last element of the array.
565 void removeRange(uint start, uint count); ///< Removes count elements starting from start.
566 uint length() const; ///< Returns the length of the array.
567 void reserve(uint length);
568 void resize(uint length); ///< Sets the new length of the array.
569 void sortAsc(); ///< Sorts the elements in the array in ascending order. For object types, this will use the type's opCmp method.
570 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.
571 void sortDesc(); ///< Sorts the elements in the array in descending order. For object types, this will use the type's opCmp method.
572 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.
573 void reverse(); ///< Reverses the order of the elements in the array.
574
575 /**
576 * @brief Returns the index of the first element that has the same value as the wanted value.
577 * 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.
578 * If no match is found will return a negative value.
579 */
580 int find(const T&in value) const;
581
582 /**
583 * @brief Returns the index of the first element that has the same value as the wanted value.
584 * 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.
585 * If no match is found will return a negative value.
586 */
587 int find(uint startAt, const T&in value) const;
588
589 /**
590 * @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.
591 * If no match is found will return a negative value.
592 */
593 int findByRef(const T&in value) const;
594
595 /**
596 * @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.
597 * If no match is found will return a negative value.
598 */
599 int findByRef(uint startAt, const T&in value) const;
600 bool isEmpty() const;
601 T& opIndex(uint index);
602 const T& opIndex(uint index) const;
603 T[]& opAssign(const T[]&in);
604 bool opEquals(const T[]&in) const;
605 funcdef bool less(const ?&in a, const ?&in b); ///< sorting function for sort
606 void sort(less&in, uint startAt = 0, uint count = uint ( - 1 )); ///< sorts array using the passed in less function
607};
608
609/**
610 * @class kStr
611 * @brief String class functions
612 */
613class kStr
614{
615public:
617 kStr(const kStr&in s);
618 uint Hash() const; ///< Returns HashID from this instance
619 kStr& ToUpper(); ///< Converts string to upper case characters
620 kStr& ToLower(); ///< Converts string to lower case characters
621 int Atoi() const; ///< Converts string to int
622 float Atof() const; ///< Converts string to float
623 bool Contains(const kStr&in) const; ///< contains the string
624 bool ContainsNoCase(const kStr&in) const; ///< contains the string ignoring case
625 bool IsEmpty() const; ///< length of string is 0
626 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.
627 uint64 Length() const; ///< Returns the length of the string
628 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.
629 kStr ReplaceSubstr(const kStr &in from, const kStr &in to) const; ///< Returns a new kStr that replaced all occurrences of from with to.
630 bool StartsWith(const kStr &in s) const; ///< Returns true if this string starts with s
631 bool EndsWith(const kStr &in s) const; ///< Returns true if this string ends with s
632 const int8 opIndex(const uint64 i) const; ///< Returns the ASCII code of the character at the strings index
633 int8 &opIndex(const uint64 i); ///< Get/Set the ASCII code of the character at the strings index
634 bool opEquals(const kStr&in s) const;
635 kStr& opAssign(const kStr&in s);
636 kStr opAdd(const kStr&in s) const;
637 kStr opAdd(bool b) const;
638 kStr opAdd(int i) const;
639 kStr opAdd(uint i) const;
640 kStr opAdd(int64 i) const;
641 kStr opAdd(uint64 i) const;
642 kStr opAdd(int16 i) const;
643 kStr opAdd(uint16 i) const;
644 kStr opAdd(float f) const;
645 kStr& opAddAssign(const kStr&in s);
647};
648
649/**
650 * @class kAngle
651 * @brief Angle functions
652 */
654{
655public:
657 kAngle(float rads);
658 kAngle(const kAngle&in other);
659 float Diff(const float rads) const;
660 float Diff(const kAngle&in other) const;
661 float Interpolate(const float a, const float b) const;
662 kAngle opAdd(const float f) const;
663 kAngle& opAddAssign(const float f);
664 kAngle opSub(const float f) const;
665 kAngle& opSubAssign(const float f);
666 kAngle opAdd(const kAngle&in a) const;
668 kAngle opSub(const kAngle&in a) const;
670 kAngle& opAssign(const float f);
671 kAngle& opAssign(const kAngle&in a);
672 kAngle opNeg() const;
673 float opImplConv();
674};
675
676/**
677 * @class kVec3
678 * @brief Representation of 3D vectors and points.
679 */
680class kVec3
681{
682public:
684 kVec3(float x, float y, float z);
685 kVec3(const kVec3&in v);
686 kVec3& Normalize(); ///< Makes this vector have a magnitude of 1
687 kVec3 Cross(const kVec3&in v) const; ///< Cross Product of two vectors
688 float Dot(const kVec3&in v) const; ///< Dot Product of two vectors
689 float Length() const; ///< Returns the length of this vector. Exactly the same as Unit()
690 float LengthSq() const; ///< Returns the squared length of this vector. Exactly the same as UnitSq()
691 float DistanceSq(const kVec3&in other) const; ///< Returns the squared distance between this instance and other
692 float ToYaw(); ///< Returns the Yaw direction in Rads
693 float ToPitch(); ///< Returns the Pitch direction in Rads
694 void Clear(); ///< Sets x, y and z components to 0
695 void Set(const float x, const float y, const float z); ///< Set x, y and z components of this kVec3
696 kVec3 Lerp(const kVec3&in other, const float t) const; ///< Linearly interpolates between two vectors
697 kVec3& Lerp(const kVec3&in other, const float t); ///< Linearly interpolates between two vectors
698 kVec3& Project(const kVec3&in normal, const float value); ///< Projects a vector onto another vector
699 kVec3& Reflect(const kVec3&in normal, const float energyFactor); ///< Reflects a vector off the plane defined by a normal
700 kVec3& Randomize(const float value); ///< Randomizes x, y, z, components by value
701 kVec3& CubicCurve(const kVec3&in pt1, const float value, const kVec3&in pt2);
702 kVec3& QuadraticCurve(const kVec3&in pt1, const float value, const kVec3&in pt2, const kVec3&in pt3);
703 kVec3 opAdd(const kVec3&in v) const;
704 kVec3 opAdd(const float f) const;
705 kVec3& opAddAssign(const kVec3&in v);
706 kVec3& opAddAssign(const float f);
708 kVec3 opSub(const kVec3&in v) const;
709 kVec3 opSub(const float f) const;
710 kVec3& opSubAssign(const kVec3&in v);
711 kVec3& opSubAssign(const float f);
712 kVec3 opMul(const kVec3&in v);
713 kVec3 opMul(const float val);
714 kVec3& opMulAssign(const kVec3&in v);
715 kVec3& opMulAssign(const float f);
716 kVec3 opDiv(const kVec3&in v);
717 kVec3 opDiv(const float val);
718 kVec3& opDivAssign(const kVec3&in v);
719 kVec3& opDivAssign(const float f);
720 kVec3& opAssign(const kVec3&in v);
721 float opIndex(int i) const;
722 float& opIndex(int i);
723 float Distance(const kVec3&in other) const; ///< Returns the distance between this instance and other vector
725 kVec3 opMul(const kQuat&in rot) const;
726 kVec3& opMulAssign(const kQuat&in rot);
728 kQuat ToQuat() const;
729 float Unit() const; ///< Returns the length of this vector. Exactly the same as Length()
730 float UnitSq() const; ///< Returns the squared length of this vector. Exactly the same as LengthSq()
731 float x;
732 float y;
733 float z;
734};
735
736/**
737 * @class kQuat
738 * @brief Quaternions used to represent rotations
739 */
740class kQuat
741{
742public:
744 kQuat(float angle, float x, float y, float z);
745 kQuat(float angle, kVec3&in vector);
746 kQuat(float rotX, float rotY, float rotZ);
747 kQuat(const kQuat&in other);
750 kQuat Slerp(const kQuat&in rot, float t) const;
751 kQuat Inverse() const;
752 void GetAngles(float&out yaw, float&out pitch, float&out roll);
753 kQuat Diff(const kQuat&in rot) const;
754 void Set(const float x, const float y, const float z, const float w);
755 void Clear(); ///< x,y,z = 0.0 w = 1.0
756 kQuat opAdd(const kQuat&in rot);
757 kQuat opSub(const kQuat&in rot);
758 kQuat opMul(const kQuat&in rot);
759 kQuat& opAssign(const kQuat&in rot);
760 kQuat& opMulAssign(const kQuat&in rot);
761 kStr ToString() const;
762 float x;
763 float y;
764 float z;
765 float w;
766};
767
768/**
769 * @class kPlane
770 * @brief Plane functions
771 */
773{
774public:
776 kPlane(const float a, const float b, const float c, const float d);
777 kPlane(const kVec3&in a, const kVec3&in b, const kVec3&in c);
778 kPlane(const kVec3&in a, const kVec3&in b);
779 kPlane(const kAngle&in a);
780 const kVec3& Normal() const;
782 float Dot(const kVec3&in point) const;
783 float Dot(const kPlane&in plane) const;
784 float Distance(const kVec3&in point) const; ///< 0 = PSIDE_ON. > 0 is PSIDE_FRONT. < 0 PSIDE_BACK.
785 float ToYaw() const; ///< Yaw of this plane.
786
787 /**
788 * @brief Returns true if yaw is facing toward the plane. Usually used for climbing sectors.
789 * @code{.cpp}
790 * bool Climbable(const float yaw) const
791 * {
792 * return (floorPlane.c <= 0.5f && flags & AAF_CLIMB && floorPlane.IsFacing(yaw));
793 * }
794 * @endcode
795 */
796 bool IsFacing(const float yaw) const;
797 const int PointOnSide(const kVec3&in point) const; ///< Returns EnumPlaneSide. If point is in front, behind or on the plane.
798};
799
800class kColor ///< Not used (included automatically from kexengine)
801{
802public:
804 kColor(const kColor&in c);
805 kColor(uint8 r, uint8 g, uint8 b, uint8 a);
806 kColor(const kColor&in rgb, uint8 a);
807 kColor(uint8 rgb, uint8 a);
808 kColor(uint rgba);
809 kColor(float r, float g, float b);
810 uint DwColor() const;
811 kVec3 ToVec3() const;
812 void FromVec3(const kVec3&in v);
814 void FromVec3Linear(const kVec3&in v);
816 void SetSaturation(float);
817 void SetLuminance(float);
818 float GetSaturation() const;
819 float GetLuminance() const;
820 kColor& opAssign(const kColor&in c);
821 void LerpRGB(const kColor&in c, float t);
824 void RGBToHSV(float&out hue, float&out sat, float&out result) const;
825 void HSVToRGB(float hue, float sat, float val);
826 void RGBToHSL(float&out hue, float&out sat, float&out lit) const;
827 void HSLToRGB(float hue, float sat, float lit);
828 bool opEquals(const kColor&in c) const;
829 kColor opAdd(const kColor&in c) const;
830 kColor opSub(const kColor&in c) const;
831 kColor opMul(const kColor&in c) const;
832 kColor opMul(float f) const;
837 uint8 r;
838 uint8 g;
839 uint8 b;
840 uint8 a;
841};
842
843class kBitDelta ///< Not used (garbage included automatically from kexengine)
844{
845public:
846 bool WriteByte(const uint8 i);
847 uint8 ReadByte();
848};
849
850class kexTranslation ///< Not used (garbage included automatically from kexengine)
851{
852public:
853 uint GetGroupIndex(const kStr&in groupName);
854 kStr GetString(const kStr&in key, kexLocPlatform_e plat) const;
855 kStr GetString(int key, kexLocPlatform_e plat) const;
856 kStr GetGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
857 kStr GetGroupString(int key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
858 kStr TranslateString(const kStr&in key, kexLocPlatform_e plat) const;
859 kStr TranslateString(const kStr&in key) const; ///< Same as Game.GetLocalizedText
860 kStr TranslateGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
861 kStr TranslateStringWithArgs(const kStr&in key, const kDict&in pairs, uint plat) const; ///< plat: kexLocPlatform_e
862 kStr TranslateGroupStringWithArgs(const kStr&in key, const kDict&in pairs, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
863};
864
865class ref
866{
867public:
870 ref(const ref&in);
871 ref(const ?&in);
872 void opCast(?&out);
873 ref& opHndlAssign(const ref&in);
874 ref& opHndlAssign(const ?&in);
875 bool opEquals(const ref&in) const;
876 bool opEquals(const ?&in) const;
877};
878
880{
881public:
883};
884
886{
887public:
888 void OnTick();
889 void OnSpawn();
890};
891
893{
894public:
896 void OnFire();
897 void OnEndFire();
898 void OnLower();
899 void OnRaise();
901};
902
903/**
904 * @class kDict
905 * @brief Editable Dictionary object that holds keys and values
906 */
907class kDict
908{
909public:
910 void Add(const kStr&in key, const kStr&in value); ///< Adds a new key/value
911 void Empty(); ///< Removes all keys/values
912 void SetValue(const kStr&in key, const kStr&in value); ///< Sets the value for the specified key
913 const bool HasKey(const kStr&in key); ///< Returns true if key exists
914 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
915 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
916 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
917 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
918 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
919};
920
921/**
922 * @class kDictMem
923 * @brief Read only Dictionary object that holds keys and values
924 */
926{
927public:
928 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
929 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
930 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
931 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
932 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
933};
934
935/**
936 * @class kSelectionListInt
937 * @brief For selecting a int value based on weights
938 */
940{
941public:
943 void AddItem(int item, const int weight);
944 int& Select(); ///< Returns a value based on item weights
945 void Reset(); ///< clears all items in the list
946 const uint GetNumEntries() const; ///< returns number of items in the list
948};
949
950/**
951 * @class kSelectionListFloat
952 * @brief For selecting a float value based on weights
953 */
955{
956public:
958 void AddItem(float item, const int weight);
959 float& Select(); ///< Returns a value based on item weights
960 void Reset(); ///< clears all items in the list
961 const uint GetNumEntries() const; ///< returns number of items in the list
963};
964
966{
967public:
968 void SetModel(const kStr&in modelPath, const kStr&in modelAnimPath);
969 void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z);
970 void SetRotationOffset(const int nodeIndex, const kQuat&in rotation);
971 void SetTexture(const int section, const int textureID);
972 void SetVisibility(const int nodeIndex, const bool visible);
973 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.
974 void AddTrailEffect(const kStr&in trailName, const int nodeIndex);
975 void RemoveTrailEffect(); ///< Removes all trail effects
978 const int GetNumNodes() const;
979 kVec3 GetNodeOrigin(const int node, const kVec3&in offset); ///< Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
980 kQuat GetNodeRotation(const int node); ///< Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
981 kVec3 GetNodeScale(const int node);
982 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.
985 const bool IsMorph() const;
986
987 /**
988 * @brief Set Morph Updating.
989 * @param bUpdate: Set to false to handle updating it yourself per ModelFile (not per Actor).
990 *
991 Default Tick code:
992 @code{.cpp}
993 if(time >= 1.0f)
994 {
995 time = 0;
996 frame++;
997
998 if(frame >= maxFrames)
999 {
1000 frame = 2;
1001 }
1002 nextFrame = frame + 1;
1003 }
1004 time += GAME_DELTA_TIME * 7.5f;
1005 @endcode
1006 */
1007 void SetMorphUpdating(const bool bUpdate);
1008
1009 /**
1010 * @brief Get Morph frame info
1011 * @param frame: 1=Init Frame, 2=Start Loop Frame. >= maxFrames then 1.
1012 * @param nextFrame: 2=Init Frame, 3=Start Loop Frame. >= maxFrames then 2.
1013 * @param maxFrames
1014 * @param time: 0..1 (lerp time between frame and nextFrame meshes)
1015 */
1016 void GetMorphFrame(int&out frame, int&out nextFrame, int&out maxFrames, float&out time) const;
1017 void SetMorphFrame(const int frame, const int nextFrame, const float time);
1018 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.
1019 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
1020 void ScaleOverride(const int node, const kVec3 &in scale);
1022 void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z, const bool clearInterpolation = false);
1023 void SetRotationOffset(const int nodeIndex, const kQuat&in rotation, const bool clearInterpolation = false);
1024};
1025
1027{
1028public:
1029 void Blend(const int animID, float speed, float blend, int flags); ///< EnumAnimStateFlags
1030 void Set(const int animID, float speed, int flags); ///< EnumAnimStateFlags
1031 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.
1032 const int NumFrames(); ///< number of frames in this animation
1033 const int NumNodes(); ///< number of nodes in this animation
1034 const float PlayTime(); ///< increases by GAME_DELTA_TIME if not stopped or paused.
1035 const float TrackTime(); ///< time from 0(on first frame) to 1(on last frame).
1036 bool IsPlaying(const int animID); ///< Returns true if current animations ID is animID and the animation is not stopped.
1037 bool CheckAnimID(const int animID); ///< checks if animID exists
1038 const int PlayingID() const; ///< the current animations ID
1039 void Stop(); ///< flags |= ANF_STOPPED; flags &= ~ANF_LOOP;
1040 void Pause(); ///< flags |= ANF_PAUSED;
1041 void Resume(); ///< flags &= ~ANF_PAUSED;
1042 const bool Stopped() const; ///< (flags & ANF_STOPPED) != 0
1043 const bool Blending() const; ///< (flags & ANF_BLEND) != 0
1044 const bool Looping() const; ///< (flags & ANF_LOOP) != 0
1045 const bool CycleCompleted() const; ///< (flags & ANF_CYCLECOMPLETED) != 0
1046 void ChangeSpeed(const float speed); ///< Scales speed of the current animation where 1.0 = 15fps and 4.0 = 60fps
1047 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).
1048 void SetPlayTime(const float time); ///< The total time in seconds this animation has been playing
1049 void SetTrackTime(const float time); ///< 0.0(first frame) to 1.0(last frame)
1050 const int TrackFrame(void) const; ///< current frame playing for the current animation.
1051 const int TrackNextFrame(void) const; ///< next frame to play for the current animation.
1052 kQuat GetRotation(const int animID, int nodeNum, int frame);
1053 kVec3 GetOrigin(const int animID, int nodeNum, int frame);
1054 const int GetAnimNumFrames(const int animID);
1055 int flags; ///< EnumAnimStateFlags
1056};
1057
1058/**
1059 * @class kActor
1060 * @brief Base type used by all actors.
1061 */
1063{
1064public:
1065 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.
1069 kVec3& Origin(); ///< Position in world space
1072 void SetTarget(kActor@ actor);
1074 void SetSector(const uint sectorIndex);
1075 void Remove(); ///< Removes the actor and sets stale to true. Actor will only internally be removed when there are no references to this actor.
1079 int16& Health();
1080 int& Type(); ///< The actors Type ID
1081 int& ImpactType(); ///< EnumImpactType
1082 int& ImpactTypeDmg(); ///< EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
1083 bool &IgnoreSectorHeightChange(void); ///< if true will not change position(or velocity and movement) when sector height changes.
1086 uint& Flags(); ///< EnumActorFlags
1087 const uint SpawnFlags1() const; ///< EnumActorSpawnFlags1
1088 const uint SpawnFlags2() const; ///< EnumActorSpawnFlags2
1089 const uint SpawnFlags3() const; ///< EnumActorSpawnFlags3
1090 const int TID() const;
1091 float& Radius();
1092 float& Height();
1093 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.
1094 float& WallRadius();
1095 float& Gravity();
1096 float& Friction();
1097 float& AnimSpeed();
1098 float& BounceDamp();
1099 float& FloorHeight();
1101 const int SectorIndex();
1102 const int AreaID() const;
1103 bool InstanceOf(const kStr&in className) const; ///< example: InstanceOf("kexPuppet")
1104 void PlaySound(const kStr&in soundPath);
1105 void PlaySoundWithLookupID(const int soundID);
1108 const int GameTicks() const;
1111 const bool InWater() const;
1112 bool CheckPosition(const kVec3&in origin); ///< checks if the actor can move to this location
1113 bool CheckPosition(const float angle, const float distance); ///< calls CheckPosition(kVec3 origin) with origin being: Actor.Origin() + (angle*distance*Actor.Radius())
1114 float GetTurnYaw(const kVec3&in lookAtLocation) const;
1115 float GetAvoidanceAngle(const kVec3&in lookAtLocation, const float distance);
1116 const float GetWaterHeight() const;
1117 const bool CanSee(kActor@ actor, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1118 uint& ClipFlags(); ///< EnumClipFlags
1119 kDictMem@ Definition(); ///< get actors def data
1120 bool OnGround() const;
1121 int GetWaterLevel() const; ///< EnumWaterLevel
1122 kActor@ CastToActor(); ///< Casts to a kActor. Only used for kPuppet Actor().
1123 kAI@ CastToAI(); ///< Casts to kAI. returns null if isn't a kAI.
1124 kFx @SpawnProjectile(const kStr&in fxPath, const kVec3&in pos, const kVec3&in targetLocation, const float maxAngle); ///< Returns the first Fx spawned
1125 void MeleeObject(const kStr&in damageType, const kVec3&in offset, const float radius);
1126 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in pos);
1127 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in pos, const kQuat&in rot);
1129 float DistanceToPoint(const kVec3&in point) const; ///< calls DistanceToPoint(x,y,z)
1130 float DistanceToPoint(const float x, const float y, const float z) const; ///< actors point is in the center
1131 void InflictGenericDamage(kActor@ inflictor, const int damage);
1132 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
1133 void InflictDamage(kActor@ inflictor, const kStr&in damageDef);
1134 /**
1135 * @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.
1136 * @param pos The world position of where to check for actors
1137 * @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)
1138 */
1139 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);
1141 void MoveToPosition(const float x, const float y); ///< Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1142 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.
1143 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
1144
1145 /**
1146 * @brief Get a map actors param value
1147 * @param paramID
1148 * (0) Target ID -32768..32767
1149 * (1) Trigger Anim 0..255
1150 * (2) Health -32768..32767
1151 * (3) Max Regenerations -32768..32767
1152 * (4) Attach Chance 0..255
1153 * (5) Texture -128..127
1154 * (6) Params 2 -128..127
1155 * (7) Params 1 -128..127
1156 */
1157 const int16 SpawnParams(const int paramID) const;
1158 const float GetCeilingHeight() const; ///< calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
1159 const float GetFloorHeight() const; ///< calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
1160 void RunFxEvent(const kStr&in fxEventName); ///< Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");
1161 bool FxEventActive(); ///< Returns true if FxEvent is running
1162 const int GetSectorIndexAtLocation(const kVec3&in pos, uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1163 void MarkPersistentBit(const bool clear);
1167 void AutomapToggle(const bool show); ///< Use with Game.AutomapCustom(true);
1168 void SetAutomapColor(const int r, const int g, const int b);
1169
1170 /**
1171 * @brief Sets the actors param value. all params are int16.
1172 * @param param
1173 * (0) Target ID -32768..32767
1174 * (1) Trigger Anim 0..255
1175 * (2) Health -32768..32767
1176 * (3) Max Regenerations -32768..32767
1177 * (4) Attach Chance 0..255
1178 * (5) Texture -128..127
1179 * (6) Params 2 -128..127
1180 * (7) Params 1 -128..127
1181 * @param value
1182 */
1183 void SetSpawnParams(const int param, const int16 value);
1184 void SetSpawnFlags1(const uint flags); ///< EnumActorSpawnFlags1
1185 void SetSpawnFlags2(const uint flags); ///< EnumActorSpawnFlags2
1186 void SetSpawnFlags3(const uint flags); ///< EnumActorSpawnFlags3
1187 void SetupSpawnParams(); ///< call after setting your actors spawnflags for them to take effect on the kActor
1188 void SetCustomDeadHeight(const bool bUse, const float height); ///< Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
1189 const float GetCustomDeadHeight();
1191 const bool OverridingKeyTouchTID(); ///< used only for key pickups
1192 const int16 GetOverrideKeyTouchTID(); ///< used only for key pickups
1193 void OverrideKeyTouchTID(const bool bOverride, const int16 tid); ///< used only for key pickups to tell what key it is in the hub
1194 bool& SkipKeyTouchCinema(); ///< used only for key pickups
1195 void SetModel(kStr&in modelFile, kStr&in animFile); ///< a way to set the model/anim for actors that had no model set previously
1196 bool& TriggerInvincibility(); ///< Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
1197 bool &DrawDelay(); ///< Don't draw until has ticked once.
1198 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)
1199 const int MapActorIndex() const; ///< Returns -1 if not a map actor
1200 int& DifficultyMode(); ///< The difficulty this actor is currently set to
1201 void OverrideOnDamageValue(const int damage, const bool bOverride = true); ///< call in OnPreDamage
1202 bool& NoKnockBack(); ///< Will not receive knock back movement from things like the alien weapon for example.
1203 const float BaseHeight() const; ///< height of actor when spawned or when kAI regenerated
1204 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
1205 float& AirFriction(); ///< default = 1.0f
1206 float& WaterFriction(); ///< default = 0.5f (same as Friction)
1207 float& Mass(); ///< default = GAME_SCALE * 1.0f
1208 const float GetSkyHeight() const;
1209 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.
1210 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.
1211 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.
1212 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.
1213 const kVec3 &PrevLerpOrigin(void) const;
1214 const kQuat &PrevLerpRotation(void) const;
1215 const kAngle &PrevLerpPitch(void) const;
1216 const kAngle &PrevLerpRoll(void) const;
1217 const kAngle &PrevLerpYaw(void) const;
1218 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.
1219 bool HasCustomRef(void) const;
1220 void AddCustomRef(void); ///< Keeps the actor from getting freed from memory.
1221 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.
1222 void SetupHeadTrack(const kStr &in headTrackDef); ///< Sets a headtrack
1223 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.
1224 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.
1225 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.
1226 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).
1227 float SoundPlayTime(const kStr &in file); ///< returns -1 if sound is not playing. Returns the amount of time in seconds the sound has been playing for. file is the "wavefile" property in the sound shader.
1228 bool &RemoveTrailsOnAnimChange(); ///< Will remove all model trails on this actor when animation is set/blend
1229 const float GetCurrentGameSpeed(void) const; ///< Gamespeed of this Actor (default 1.0f)
1230 void SetCurrentGameSpeed(const float speed); ///< Set Gamespeed of this Actor (default 1.0f)
1231 bool &IgnoreGameSpeed(); ///< GameSpeed used for this actor will be CurrentGameSpeed. (Default is true for kPuppet and kPlayerWeapon. Default is False for every other actor)
1232 bool &IgnoreFxGameSpeed(); ///< GameSpeed used for Fx whose source is this actor will always be CurrentGameSpeed. (Default is false)
1233 const float GetGameSpeed() const; ///< Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns CurrentGameSpeed * GlobalGameSpeed.
1234 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!
1235 const float DecayTime(void); ///< Value used to melt kAI when they regen. Values range from 0.0 (normal) to 60.0 (fully melted).
1236 void SetDecayTime(const float value); ///< Used to melt kAI when they regen. Value range should be 0 (normal) to 60 (fully melted).
1237 float RadiusDamageFactor(const kVec3 &in origin, const float radius) const;
1238 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.
1239};
1240
1241/**
1242 * @class kActorIterator
1243 * @brief The way to iterate through all actors in the map. Example code:
1244 * @code{.cpp}
1245 * kActorIterator it;
1246 * kActor @actor;
1247 * while((@actor = it.Get()) !is null)
1248 * {
1249 * // Do something with actor
1250 * }
1251 * @endcode
1252 */
1254{
1255public:
1257 kActor@ Get(); ///< Returns the next actor in the iterator
1258 void Reset(); ///< Resets the iterator back to the first actor
1259};
1260
1261class kWeapon : public kActor
1262{
1263public:
1264 kVec3 TransformToOwnerPosition(); ///< returns the OffsetPosition() * the players matrix.
1265 kVec3 TransformToOwnerPosition(const kVec3&in vector); ///< returns the (OffsetPosition() + vector) * the players matrix.
1266
1267 /**
1268 * @brief SpawnsFx at the players at the position passed in * players rotation, then adds the
1269 * viewHeight + landingViewOffset to the z position. Sets PF_FIREDPROJECTILE PlayerFlags.
1270 * adjustToPerspective will change the position you pass in like this:
1271 * @code{.cpp}
1272 * float d = kexMath::Pow(47.5f / fov, fov / 60.0f);
1273 * vOrigin.y *= d;
1274 * vOrigin.z += (1.0f - d) * 2.0f;
1275 * @endcode
1276 */
1277 kFx @FireProjectile(const kStr&in fxPath, const float x, const float y, const float z, const bool adjustToPerspective = false);
1278 bool& PreventFire(); ///< Use in OnBeginFire to internally prevent from entering its Fire state.
1279 bool &NoGenericBobbing(); ///< Disables the generic weapon bobbing menu option from affecting this weapon
1280 kVec3& OffsetPosition(); ///< Offset position of weapon
1281 int& State(); ///< EnumWeaponStates
1282 bool &AllowUnderwater(); ///< Set to true to allow the weapon underwater. Gets reset back to the weapons def value after OnBeginLevel.
1284 bool &ClearInterpolationOffsetPosition(); ///< Set to true to clear the OffsetPosition interpolation after the weapon ticks, then it gets set back to false.
1285 float &PlaySpeed(); ///< Get/Set speed of weapon animations (default = 4.0f)
1286 float &PlaySpeedSwapIn(); ///< Get/Set speed of weapon lower animation (default = 4.0f)
1287 float &PlaySpeedSwapOut(); ///< Get/Set speed of weapon raise animation (default = 3.0f)
1288 float &FOV(); ///< Get/Set weapon FOV (default = 47.5f)
1289 bool &NoWalkAnim(); ///< Get/Set the usage of the walk anim. Run animation will be used instead.
1291
1292};
1293
1294class kAI : public kActor
1295{
1296public:
1297 uint& AIFlags(); ///< EnumAIFlags
1298 void SetupAISpawnFlags(); ///< call after setting your actors spawnflags for them to take effect on the kAI
1299 int& AttackChance(); ///< 0-100
1300 float& AttackRange(); ///< squared
1301 float& MeleeRange(); ///< squared
1302 float& LeashRadius(); ///< squared
1303 float& SightRange(); ///< squared
1304 float& LoudRange(); ///< squared
1305 float& QuietRange(); ///< squared
1306 float& FlyHeight(); ///< squared
1307 float& SightFOV(); ///< in rads
1308 int& Agitation(); ///< 0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE
1309 float& AnimScalar(); ///< default = 1.0f
1310 float& BlendScalar(); ///< default = 10.0f
1311 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).
1312};
1313
1314class kPuppet : public kActor
1315{
1316public:
1317 float& ViewHeight(); ///< set from the players def "player.viewHeight". Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1318 float& RecoilPitch(); ///< used for weapon recoil that modifies the players pitch.
1319 const float LandingViewOffset() const; ///< LandingViewOffset changes when jumping and falling. Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1320 uint& PlayerFlags(); ///< EnumPlayerFlags
1323 void SetGroundForwardSpeed(const float speed); ///< default = 10.24f
1324 void SetGroundBackwardSpeed(const float speed); ///< default = -10.24f
1325 void SetGroundStrafeSpeed(const float speed); ///< default = 10.24f
1326 void SetGroundForwardAccel(const float accel); ///< default = 0.05f
1327 void SetGroundBackwardAccel(const float accel); ///< default = 0.05f
1328 void SetGroundStrafeAccel(const float accel); ///< default = 0.05f
1329 void SetGroundDeaccel(const float accel); ///< default = 0.5f
1330 void SetSwimForwardSpeed(const float speed); ///< default = 10.24f
1331 void SetSwimBackwardSpeed(const float speed); ///< default = -10.24f
1332 void SetSwimStrafeSpeed(const float speed); ///< default = 10.24f
1333 void SetSwimForwardAccel(const float accel); ///< default = 0.05f
1334 void SetSwimBackwardAccel(const float accel); ///< default = 0.05f
1335 void SetSwimStrafeAccel(const float accel); ///< default = 0.05f
1336 void SetSwimDeaccel(const float accel); ///< default = 0.5f
1337 void SetJumpMinSpeed(const float speed); ///< default = GAME_SCALE * 0.855f
1338 void SetJumpMaxSpeed(const float speed); ///< default = GAME_SCALE * 1.667f
1339 void SetJumpClimbSpeed(const float speed); ///< default = GAME_SCALE * 0.2875f
1340 void SetOverrideShadow(const int value); ///< 0=none(default), 1=Force Disable shadow, 2=Force Enable shadow
1341 void SetOverrideWalkRun(const int value); ///< 0=none(default), 1=Force Disable Walk
1342 float& Oxygen(); ///< Time in seconds. 0: full oxygen. >= 55: shows air bar. >= 70: OxygenOut is set to true.
1343 bool& OxygenOut(); ///< if true will damage player if underwater
1344 float& OverrideFOV(); ///< set to 1-179. anything else will stop overriding the fov and will use the r_fov cvar.
1345 void SetCrawl(const bool crawl); ///< use this to manually set if the player is crawling instead of setting PF_CRAWLING directly.
1346 const float GroundForwardSpeed() const; ///< default = 10.24f
1347 const float GroundBackwardSpeed() const; ///< default = -10.24f
1348 const float GroundStrafeSpeed() const; ///< default = 10.24f
1349 const float GroundForwardAccel() const; ///< default = 0.05f
1350 const float GroundBackwardAccel() const; ///< default = 0.05f
1351 const float GroundStrafeAccel() const; ///< default = 0.05f
1352 const float GroundDeaccel() const; ///< default = 0.5f
1353 const float SwimForwardSpeed() const; ///< default = 10.24f
1354 const float SwimBackwardSpeed() const; ///< default = -10.24f
1355 const float SwimStrafeSpeed() const; ///< default = 10.24f
1356 const float SwimForwardAccel() const; ///< default = 0.05f
1357 const float SwimBackwardAccel() const; ///< default = 0.05f
1358 const float SwimStrafeAccel() const; ///< default = 0.05f
1359 const float SwimDeaccel() const; ///< default = 0.5f
1360 const float JumpMinSpeed() const; ///< default = GAME_SCALE * 0.855f
1361 const float JumpMaxSpeed() const; ///< default = GAME_SCALE * 1.667f
1362 const float ClimbJumpAmount() const; ///< default = GAME_SCALE * 0.2875f
1363 const int OverrideShadow() const; ///< default = 0
1364 const int OverrideWalkRun() const; ///< default = 0
1365 const int GetState(void) const; ///< EnumPlayerStates
1366 float &MaxFallVelocity(void); ///< default = -200.0f
1367 bool &NoWallJump(void); ///< default = false
1368 bool &CustomViewEnable(); ///< Set to true to enable the custom view
1369 bool &CustomViewUnderwater(); ///< whether the custom view is underwater or not
1374 void SetHeadBobScale(const float scale);
1375 void SetTurnBobScale(const float scale);
1376 void SetStrafeBobScale(const float scale);
1377 void SetUnderwaterBobScale(const float scale);
1378 void SetJumpBobScale(const float scale);
1379 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)
1380 void SetMaxLives(const int value); ///< Max lives allowed from gaining Lifeforces
1381 void SetMaxLifeforces(const int value); ///< Amount of Lifeforces needed to get an extra life
1382 const float HeadBobScale() const;
1383 const float TurnBobScale() const;
1384 const float StrafeBobScale() const;
1385 const float UnderwaterBobScale() const;
1386 const float JumpBobScale() const;
1387 const int OverrideWeaponOnTopFix() const;
1388 const int GetMaxLives() const;
1389 const int GetMaxLifeforces() const;
1390};
1391
1392/**
1393 * @class kActorFactory
1394 * @brief For Spawning Actors
1395 */
1397{
1398public:
1399 kActor@ Spawn(const int actorID, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1400 kActor@ Spawn(const kStr&in actorName, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1401};
1402
1403/**
1404 * @class kFx
1405 */
1406class kFx
1407{
1408public:
1409 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).
1410 kAngle& Yaw(); ///< Not used by the Fx
1411 kAngle& Pitch(); ///< Not used by the Fx
1412 kAngle& Roll(); ///< Not used by the Fx
1416 void SetTarget(kActor@ actor);
1418 void SetSector(const uint sectorIndex);
1422 int &ImpactType(); ///< EnumImpactType
1423 int &ImpactTypeDmg(); ///< EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
1425 float &Radius(); ///< (Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
1426 float &Height(); ///< (Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
1427 float &WallRadius();
1428 float &Gravity();
1429 float &Friction();
1430 float &BounceDamp();
1431 float &FloorHeight();
1433 const int SectorIndex();
1434 const int AreaID() const;
1435 bool InstanceOf(const kStr &in className) const; ///< example: InstanceOf("kexFx")
1436 void PlaySound(const kStr &in soundPath);
1437 void PlaySoundWithLookupID(const int soundID);
1440 const float GetWaterHeight() const;
1441 const bool CanSee(kActor@ actor, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1442 bool OnGround() const;
1443 int GetWaterLevel() const; ///< EnumWaterLevel
1444 float DistanceToPoint(const kVec3 &in point) const; ///< calls DistanceToPoint(x,y,z)
1445 float DistanceToPoint(const float x, const float y, const float z) const; ///< Fx point is in the center
1446 void MoveToPosition(const float x, const float y); ///< Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1447 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
1448 const float GetCeilingHeight() const; ///< calculates the ceiling height from the Fx sector and origin. Returns 0 if not in a sector.
1449 const float GetFloorHeight() const; ///< calculates the floor height from the Fx sector and origin. Returns 0 if not in a sector.
1450 const int GetSectorIndexAtLocation(const kVec3 &in pos, uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1451 float &AirFriction();
1453 float &Mass();
1454 const float GetSkyHeight() const;
1455 bool &ChildOfTarget(); ///< Unused. Only used for kActors.
1456 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.
1457 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.
1458 void Remove(); ///< Removes the Fx and sets stale to true. Fx will only internally be removed when there are no references to this Fx.
1459 const int GameTicks() const;
1460 float RadiusDamageFactor(const kVec3 &in origin, const float radius) const;
1461 bool InWater();
1462 kScriptObjectFx @ScriptObject();
1464 const bool DrawDelay() const;
1465 const float GetCurrentGameSpeed(void) const; ///< Gamespeed of this Fx (default 1.0f)
1466 void SetCurrentGameSpeed(const float speed); ///< Set the Gamespeed of this Fx (default 1.0f)
1467 const float GetGameSpeed() const; ///< Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns the CurrentGameSpeed * GlobalGameSpeed.
1468 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.
1469 bool HasCustomRef() const;
1470 void AddCustomRef(); ///< Keeps the Fx from getting freed from memory.
1471 void ClearCustomRef(); ///< Allows the Fx to get freed from memory if it has no references. This will be called automatically when level is unloaded.
1472 const int BounceCount() const;
1475 bool &IgnoreGameSpeed(); ///< GameSpeed used for this Fx will always be CurrentGameSpeed. (Default = false)
1481 void SetParentFx(kFx@ fx);
1484 const float Distance() const; ///< Distance to the center of the View (Player or Camera) at the time the Fx spawned.
1485 const float Restart() const; ///< Current delay time before the Fx will start ticking
1486 int &Frame(); ///< The sprite frame. Make sure this value is < MaxFrames().
1487 const uint MaxFrames() const; ///< MaxFrames the sprite has. Frame should be < this value.
1488 float &DrawScale(); ///< Current scale of the sprite
1489 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.
1490 float &MaxDrawScale(); ///< The highest value the DrawScale() can become when the Fx is updating its scale OnTick.
1491 float &RotationOffset(); ///< Current Rotation Offset around the Y Axis. kQuat(RotationOffset(), 0.0f, 1.0f, 0.0f);
1492 float &RotationSpeed(); ///< Adds this value * (0.25 * GameSpeed) to RotationOffset() when updating rotation OnTick. This value is set on spawn.
1493 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.
1494 void SetColor1(float r, float g, float b, float a); ///< Values range from 0.0 to 1.0. Color and alpha of sprite.
1495 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.
1496 void GetColor1(float &out r, float &out g, float &out b, float &out a); ///< Get the color values
1497 void GetColor2(float &out r, float &out g, float &out b, float &out a); ///< Get the color values
1498 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.
1499 float &Speed(); ///< Initial forward moving speed, set on spawn from forwardSpeed and forwardSpeedRandom in the fx file.
1500 float &MovingForce(); ///< initial veolcity.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.
1502 const int Instances() const; ///< Same as the instances value in the fx file.
1503 float &FrameTime(); ///< The current time left before the Fx sprite tries going to the next frame in the sprite.
1505 const int FxIndex() const; ///< The index in the fx file array
1506 const int InstanceIndex() const;
1507 bool &DoUpdateTickEvents(); ///< If set to false the Fx will not call Tick or WaterTick events.
1508 bool &DoUpdateSpriteAnimation(); ///< If set to false the Fx will not update sprite frame
1509 bool &DoUpdateRotation(); ///< If set to false the Fx will not update rotation offset
1510 bool &DoUpdateScaling(); ///< If set to false the Fx will not update draw scale
1511 bool &DoUpdateFading(); ///< If set to false the Fx will not update color1 and color2 alpha value
1512 bool &DoUpdateMovement(); ///< If set to false the Fx will not move
1513 bool &DoUpdateExpireCheck(); ///< If set to false the Fx will not expire and get removed when lifetime is over
1514 bool &OnCollideForceSetOriginToLast(); ///< If set to true the Fx will set it's origin and sector to what it was before OnCollide was called.
1515 bool &OnCollideForceNoSetOriginToLast(); ///< If set to true the Fx will never set it's origin and sector to what it was before OnCollide was called.
1516 void SpawnImpactFx(const int impactType, const kVec3 &in normal, const bool bUseEvent = true, const bool bBlood = true);
1519 const int FxID() const;
1520 bool InfoFadeout(void) const;
1525 bool InfoLensFlares() const;
1526 bool InfoBlood() const;
1527 bool InfoAddOffset() const;
1528 bool InfoDepthBuffer() const;
1529 bool InfoScaleLerp() const;
1530 bool InfoActorInstance() const;
1531 bool InfoNoDirection() const;
1532 bool InfoFlash() const;
1533 bool InfoProjectile() const;
1535 bool InfoStickOnTarget() const;
1536 bool InfoBullet() const;
1537 bool InfoWeaponView() const;
1538 bool InfoFullScreen() const;
1539 bool InfoDecalOffset() const;
1540 bool InfoNoSpawnNear() const;
1541 bool InfoNoSpawnFar() const;
1544 bool InfoAttachSource() const;
1545 bool InfoDrawOnBottom() const;
1546 bool InfoSparkle() const;
1547 bool InfoCrossFade() const;
1548 bool InfoImpactEffect() const;
1549 bool InfoRestrictAim() const;
1550 bool InfoNoWallSpawn() const;
1551 bool InfoNoGroundSpawn() const;
1552 bool InfoNoHitSource() const;
1554 bool InfoMuzzleEffect() const;
1555 bool InfoDrawDelay() const;
1556 bool InfoBounceImpact() const;
1559 float InfoMass() const;
1562 float InfoGravity() const;
1563 float InfoFriction() const;
1564 float InfoAirFriction() const;
1565 float InfoWaterFriction() const;
1566 float InfoAnimFriction() const;
1568 float InfoScale() const;
1569 float InfoScaleDest() const;
1570 float InfoMaxscale() const;
1571 float InfoForward() const;
1573 float InfoRotationOffset() const;
1574 float InfoRotationSpeed() const;
1575 float InfoRotationPivotX() const;
1576 float InfoRotationPivotY() const;
1577 int InfoLifetime() const;
1579 float InfoRestart() const;
1580 int InfoAnimspeed() const;
1584 int InfoDrawType() const;
1585 int InfoAnimType() const;
1589 float InfoHueRandom() const;
1592 int InfoFadeinTime() const;
1593 int InfoFadeoutTime() const;
1595 int InfoMaxInstances() const;
1596 float InfoSpawnDistOffset() const;
1597 kStr InfoModelName() const; ///< Custom use
1598 kStr InfoAnimName() const; ///< Custom use
1599 kStr InfoUserString() const; ///< Custom use
1600 int InfoUserID() const; ///< Custom use
1601};
1602
1604{
1605public:
1606 void StartCinematic(const uint flags = 12); ///< EnumCameraFlags
1607 void StopCinematic(const bool noFade = false); ///< if noFade is true will stop the cinematic immediately without fading out.
1608 const int CinematicState() const; ///< EnumCameraStates
1611 void SetRotateEyeVector(const kVec3&in vector); ///< The focus position that is used when AutoPlayRotationTrack is called if there is no LookAtActor set.
1612 void SetFinalView(const int view); ///< the view to use for the camera origin and direction. view must be in range 0-2
1613 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.
1614 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.
1615 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.
1616 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).
1617 void AutoPlayPositionTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenPositionTrack on the view using speed and lerpType
1618 void AutoPlayRotationTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenRotationTrack on the view using speed and lerpType
1619 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.
1620 void SetEyeView(const kVec3&in position); ///< position of camera (finalview). finalview must be set or will do nothing.
1621 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.
1622 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.
1623 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.
1624 kVec3 GetEyeView(); ///< position of camera (finalview). finalview must be set or will return vecZero.
1625 kVec3 GetFocusView(); ///< position of where the camera (finalview) is looking at. finalview must be set or will return vecZero.
1626 void ClearFinalView(); ///< finalview is set to null
1627 void ClearViewTracks(); ///< views 0-2 all variables are set to 0
1628 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
1629 void SetUserInterrupted(const bool toggle); ///< set to false to set the user interrupted to false.
1630 const bool Active() const;
1631 const bool Enabled() const; ///< CinematicState() >= CAMS_FADEOUT (Not Idle)
1632 const bool ViewingFromCamera() const; ///< CinematicState() >= CAMS_FADEIN && CinematicState() <= CAMS_ACTIVE_TO_FADEOUT
1633 kVec3& Tremor(); ///< x = adds to yaw, y = adds to pitch, z = adds to roll. lerps to vecZero using lerpTime of GAME_FRAME_TIME.
1634 void SetSector(const uint sectorIndex);
1635 const int SectorIndex();
1636 const int AreaID() const;
1638 const uint Flags() const; ///< EnumCameraFlags
1639 kVec3 origin; ///< current position of camera. if a finalview is set then the origin will be set to the finalview's eye position.
1640 kAngle yaw; ///< if a finalview is set then the yaw will be set to the finalview's look direction.
1641 kAngle pitch; ///< if a finalview is set then the pitch will be set to the finalview's look direction.
1642 kAngle roll; ///< if a finalview is set then the roll will be set to 0.
1643 float fov; ///< Camera FOV (default is 74.0)
1644 float lookZOffset; ///< Used only if LookAtActor has been set.
1645 bool &ClearInterpolationOnTick(void); ///< set to false to handle interpolation yourself
1646 bool &AllowMenusWhenActive(void); ///< set to true to allow the pause menu to be opened during a cinematic
1647};
1648
1649/**
1650 * @class kCModel
1651 * @brief The kCModel(CModel) global stores collision results when certain actor methods are called. Those methods are as follows:
1652 * GetSectorIndexAtLocation
1653 * const bool CanSee(kActor@, const uint = 0)
1654 * MoveToPosition
1655 * SpawnProjectile
1656 * bool CheckPosition(const kVec3 &in)
1657 */
1659{
1660public:
1661 kVec3& InterceptVector(); ///< Returns the vector that intersected the collided geometry
1662 kVec3& ContactNormal(); ///< Returns the normalized vector of the collided surface
1663 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.)
1664 const uint ClipResult(); ///< specifies the type of intersection (flags)
1665 kActor@ ContactActor(); ///< handle pointer to actor that was collided (null if none was collided)
1666 kVec3& MoveDirection(); ///< Movement vector of the object
1667};
1668
1670{
1671public:
1672 const int Ticks() const; ///< affected by gamespeed (Ticksf truncated)
1673 const float Ticksf(void) const; ///< affected by gamespeed
1674 const int UnscaledTicks() const; ///< Not affected by GameSpeed
1677 void CheckKeys(); ///< Prints HUD messages to tell the player how many keys they've found on the current HUBID
1678 void ChangeMap(const kStr&in mapName);
1679 void StartWarp(kActor@ actor, const int tagID, const int mapID);
1680 void StartFreeWarp(kActor@ actor, const kVec3&in origin, const float yaw, const int sectorIndex, const int mapID);
1681 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.
1682 const bool CheckWarping(); ///< Checks if Warping or FreeWarping is in progress.
1683 const bool CanOpenPauseMenu(); ///< Checks if it's okay to be able to open a menu
1684 const bool CanOpenSaveMenu(); ///< Checks if it's okay to be able to open the save menu
1685 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.
1686 void ClearWarpInterpolation(void); ///< Clearing the interpolation for kPuppet will also clear the warp interpolation.
1687};
1688
1689class kSys
1690{
1691public:
1692 void Print(const kStr&in message);
1693 void Warning(const kStr&in message);
1696 int Mouse_X();
1697 int Mouse_Y();
1698 const bool GetCvarValue(const kStr&in cvarName, kStr&out result);
1699 void MouseToHUD(float&out x, float&out y); ///< Returns the HUD position of the mouse
1700};
1701
1703{
1704public:
1705 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
1706 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.
1707 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.
1708 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)
1709 void FloodFillAreaFlags(const kVec3&in origin, const uint flags, const bool active); ///< (EnumAreaFlags) Calls FloodMatchingAreaFlags with FindNextClosestSector(origin) sector.
1710 void FloodMatchingAreaFlags(const int sectorIndex, const uint flags, const bool active); ///< (EnumAreaFlags) Sets flags on all adjacent sectors with matching areaID.
1711 const uint GetAreaFlags(const int areaID) const; ///< EnumAreaFlags
1712 const int GetAreaFloorImpact(const int areaID) const; ///< EnumImpactType
1713 const int GetAreaWallImpact(const int areaID) const; ///< EnumImpactType
1714 void ChangeAreaFloorImpact(const int areaID, const int value); ///< value: EnumImpactType
1715 void ChangeAreaWallImpact(const int areaID, const int value); ///< value: EnumImpactType
1716 void ChangeAreaWaterHeight(const int areaID, const float height); ///< WaterHeight is stored per area, not per sector or per vertex.
1717
1718 /**
1719 * @brief Returns an area arg value
1720 * @param areaID
1721 * @param arg
1722 @code{.cpp}
1723
1724 though args can be used for anything, they are typically used in this fashion:
1725 0: warp ID
1726 1: warp level ID or trigger sound ID
1727 2: checkpoint ID
1728 3: tag ID
1729 4: floor damage hit points
1730 5: floor damage rate
1731
1732 Hardcoded:
1733 0: AAF_TELEPORT: WarpID
1734 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1735 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1736 3: AAF_EVENT: tag ID
1737 4: Not used
1738 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))
1739
1740 Default Scripts:
1741 0: Not used
1742 1: Not used
1743 2: Not used
1744 3: Not used
1745 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1746 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1747 @endcode
1748 */
1749 const int16 GetAreaArg(const int areaID, const int arg) const;
1750
1751 /**
1752 * @brief
1753 * @param areaID
1754 * @param arg
1755 @code{.cpp}
1756
1757 though args can be used for anything, they are typically used in this fashion:
1758 0: warp ID
1759 1: warp level ID or trigger sound ID
1760 2: checkpoint ID
1761 3: tag ID
1762 4: floor damage hit points
1763 5: floor damage rate
1764
1765 Hardcoded:
1766 0: AAF_TELEPORT: WarpID
1767 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1768 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1769 3: AAF_EVENT: tag ID
1770 4: Not used
1771 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))
1772
1773 Default Scripts:
1774 0: Not used
1775 1: Not used
1776 2: Not used
1777 3: Not used
1778 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1779 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1780 @endcode
1781 * @param value
1782 */
1783 void ChangeAreaArg(const int areaID, const int arg, const int16 value);
1784 void ChangeSectorHeight(const int sectorIndex, const float height); ///< Changes all sectors floor vertices with the same areaID to the height
1785 void ChangeSectorCeilingHeight(const int sectorIndex, const float height); ///< Changes all sectors ceiling vertices with the same areaID to the height
1786 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.
1787 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.
1788 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.
1789 const int FindClosestSectorByDistance(const kVec3&in origin); ///< Returns the closest sector. Will return -1 only if the map contains no sectors.
1790
1791 /**
1792 * @brief Get the Sectors vertex position and height
1793 * Link 1 is pt1 to pt3
1794 * Link 2 is pt2 to pt1
1795 * Link 3 is pt3 to pt2
1796 * @param sectorIndex
1797 * @param pt1
1798 * @param pt2
1799 * @param pt3
1800 * @param heights: x is the height of pt1, y is the height of pt2, z is the height of pt3.
1801 */
1802 void GetSectorCorners(const int sectorIndex, kVec3&out pt1, kVec3&out pt2, kVec3&out pt3, kVec3&out heights) const;
1803
1804 /**
1805 * @brief Get the 3 sectors links. -1 means there was no sector linked to that edge.
1806 * Link 1 is pt1 to pt3
1807 * Link 2 is pt2 to pt1
1808 * Link 3 is pt3 to pt2
1809 * @param sectorIndex
1810 * @param sectorIndex1
1811 * @param sectorIndex2
1812 * @param sectorIndex3
1813 */
1814 void GetSectorLinks(const int sectorIndex, int&out sectorIndex1, int&out sectorIndex2, int&out sectorIndex3) const; ///< a sectorIndex with -1 is no sector.
1815 const uint GetSectorNumBridges(const int sectorIndex) const; ///< number of bridge sectors this sector has
1816 const int GetSectorBridge(const int sectorIndex, const uint bridge) const; ///< Get the sector of the bridge. Use GetSectorNumBridges to loop through them all.
1817 const int GetSectorAreaID(const int sectorIndex) const;
1818 const int GetNumSectors() const;
1819 const int GetNumAreas() const;
1820 const int GetNumActors() const; ///< number of actors that are in the current maps data
1821 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.
1822 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.
1823 const kStr GetSkyMaterial() const;
1824 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!
1825 void OverrideFogColor(const int r, const int g, const int b); ///< rgb values are 0-255
1826 void ClearOverrideFogColor(); ///< Stops overriding and uses the sector color
1827 void OverrideWaterFogColor(const int r, const int g, const int b); ///< rgb values are 0-255
1828 void ClearOverrideWaterFogColor(); ///< Stops overriding and uses the sector color
1829 const int FindClosestSectorByDistance(const kVec3&in origin);
1830 const float GetAreaWaterHeight(const int area) const;
1831 const float GetAreaFogZFar(const int area) const;
1832 void SetAreaFogZFar(const int area, const float zfar);
1833 const float GetAreaWaterZFar(const int area) const;
1834 void SetAreaWaterZFar(const int area, const float zfar);
1835 const kVec3 GetAreaFogColor(const int area) const; ///< color values are in range 0-255
1836 void SetAreaFogColor(const int area, const kVec3 &in color); ///< color values are in range 0-255
1837 const kVec3 GetAreaWaterColor(const int area) const; ///< color values are in range 0-255
1838 void SetAreaWaterColor(const int area, const kVec3 &in color); ///< color values are in range 0-255
1839 const float GetAreaSkyHeight(const int area) const;
1840 void SetAreaSkyHeight(const int area, const float height);
1841 const float GetAreaSkySpeed(const int area) const; ///< speed scale is this value / 100. 100 is normal speed.
1842 void SetAreaSkySpeed(const int area, const float speed); ///< speed scale is this value / 100. 100 is normal speed.
1843 const float GetAreaBlendLength(const int area) const; ///< the speed to interpolate the fog color/start/zfar values when they change
1844 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.
1845 const int GetAreaAmbience(const int area) const;
1846 void SetAreaAmbience(const int area, const int ambience);
1847 const int GetAreaMapColor(const int area) const;
1848 void SetAreaMapColor(const int area, const int color);
1849 const int GetAreaMusic(const int area) const;
1850 void SetAreaMusic(const int area, const int music);
1851 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)
1852 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)
1853 const int GetSectorDrawOrder(const int sectorIndex) const; ///< lowest draw order (0) draws the sectors on the automap last
1854 void SetSectorDrawOrder(const int sectorIndex, const int drawOrder); ///< lowest draw order (0) draws the sectors on the automap last
1855};
1856
1858{
1859public:
1860 void CallDelayedMapScript(const kStr&in funcName, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
1861 void CallDelayedMapScript(const int scriptID, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
1862 void CallMapScript(const int scriptID, kActor@ instigator); ///< Use to call map script right away
1863 void HaltMapScript(const int scriptID);
1864 void PlaySound(const kStr&in path);
1865 void PlaySoundID(const int soundID);
1866 void PlayMusic(const kStr&in path, const bool loop);
1872 void MusicPitch(const float pitch);
1873
1874 /**
1875 * @brief Start controller vibration from tactile sound file. Returns a handle.
1876 * @param path the path to the .bnvib file
1877 * @param channel kexVibrationPlayer::channel_e
1878 * @param pos kexVibrationPlayer::position_e
1879 */
1880 int PlayTactile(const kStr&in path, int channel, int pos);
1881 bool IsTactilePlaying(int vibHandle);
1882 bool IsTactilePlaying(int vibHandle, const kStr&in path);
1884 void StopTactile(int vibHandle);
1886 void Restart();
1887
1888 /**
1889 * @brief Print a message to the HUD
1890 * @param text
1891 * @param lineNumber must be in range 0..7
1892 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
1893 */
1894 void PrintLine(const kStr&in text, const int lineNumber, const int ticks = 120);
1895 /**
1896 * @brief Print a message to the HUD on the next line.
1897 * @param text
1898 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
1899 */
1900 void Print(const kStr &in text, const int ticks = 120);
1901 void PrintHelp(const kStr&in text, const bool endGame = false);
1905 void ChangeMap(const kStr&in path);
1906 void ShowMainMenu(const bool mouseCenter = true);
1907 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.
1908 const int GetMapIDFromName(const kStr &in mapName); ///< This returns the mapID from the mapName. Returns -1 if not found.
1909 const int GetCurrentMapID();
1910 const int GetDifficulty(); ///< EnumDifficulty. Internally calls GameVariables.GetInt("g_difficulty")
1911 void SetDifficulty(const int value); ///< EnumDifficulty
1913
1914 /**
1915 * @brief Sets the current GameSpeed. kPuppet and kPlayerWeapon are not affected by GameSpeed.
1916 * @param speed 0..1
1917 * @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)
1918 */
1919 void SetGameSpeed(const float speed, const float blendSpeed);
1920 bool GetHubKeyInfo(const uint hubID, int&out nKeys, int&out remainingKeys, int&out keyBits);
1921 bool SetHubKey(const uint hubID, int key);
1922 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
1923 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
1924 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const kQuat&in rotation);
1925 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const kQuat&in rotation);
1926 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const float yaw, const float pitch);
1927 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const float yaw, const float pitch);
1928 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in origin, const int sectorIndex);
1930 const bool AutomapEnabled(); ///< is the automap displaying on screen
1931 const bool AutomapDeactived();
1932 void AutomapToggle(const bool toggle); ///< show/hide the automap.
1933 void AutomapDeactive(const bool toggle); ///< permanently deactivates the automap.
1934 void AutomapCustom(const bool toggle); ///< allow actors with custom automap colors to be drawn to the automap. (for mods)
1935 void LifeForcePulse(); ///< Shows the LifeForces on the HUD
1936 void LivesPulse(); ///< Shows the Lives on the HUD
1937 void RunWalkPulse(); ///< Shows the RunWalk graphic on the HUD
1938 void WeaponWheelPulse(); ///< Shows the WeaponWheel on the HUD
1939 bool SetWeaponWheelPic(const int weapon, const kStr&in imagePath);
1940 bool ClearWeaponWheelPic(const int weapon);
1941 void SetLivesPic(const kStr&in imagePath);
1943 void SetLifeForcePic(const kStr&in imagePath);
1945 void MessageBox(const kStr&in msg1, const kStr&in msg2);
1946
1947 /**
1948 * @brief
1949 * @param msg1 top line
1950 * @param msg2 bottom line
1951 @code{.cpp}
1952 // Usage:
1953 Game.ConfirmMenu("Confirm This", "Is that correct?");
1954
1955 // Then check for result on Tick:
1956
1957 int result;
1958 GameVariables.GetInt("ConfirmMenuResult", result);
1959 switch(result)
1960 {
1961 case 1:
1962 Sys.Print("Selected No");
1963 GameVariables.SetValue("ConfirmMenuResult", "0");
1964 break;
1965 case 2:
1966 Sys.Print("Selected Yes");
1967 GameVariables.SetValue("ConfirmMenuResult", "0");
1968 break;
1969 default: // There's no ConfirmMenuResult waiting
1970 break;
1971 }
1972 @endcode
1973 */
1974 void ConfirmMenu(const kStr&in msg1, const kStr&in msg2);
1975 void SaveMenu(); ///< Opens the save game menu. Should always check if(PlayLoop.CanOpenSaveMenu())
1976 void LoadMenu(); ///< Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
1977 void SetDamageFlash(); ///< Shows the damage screen flash
1978 void SetPickupFlash(); ///< Shows the pickup screen flash
1979 void SetArmorFlash(); ///< Shows the armor damage screen flash
1980 const uint ConButtons(); ///< EnumPlayerConButtons
1981 uint MenuButtons(void) ///< EnumGameButtonEvents
1982 const int64 GetTimestamp();
1983 void GetDateAndTime(int&out seconds, int&out minutes, int&out hours, int&out day, int&out month, int&out year, kStr&out text);
1986
1987 /**
1988 * @brief add custom text to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
1989 * if the id already exists then simply sets all its variables.
1990 * @param font EnumGameFontType
1991 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
1992 */
1993 void AddText(const int id, const int font, const kStr &in text, const float x, const float y,
1994 const int edge = 0, const float scale = 1.0f, const bool center = false, const bool shadow = false,
1995 const int r = 255, const int g = 255, const int b = 255, const int a = 255,
1996 const int r2 = 255, const int g2 = 255, const int b2 = 255, const int a2 = 255);
1997 bool SetTextMsg(const int id, const kStr &in text);
1998 bool SetTextOrigin(const int id, const float x, const float y);
1999 bool SetTextColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2000 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);
2001
2002 /**
2003 * @brief Set the text scale, font, edge, center, shadow
2004 * @param font EnumGameFontType
2005 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2006 */
2007 bool SetTextProps(const int id, const float scale, const int font = 0, const int edge = 0, const bool center = false, const bool shadow = false);
2008 void SetTextOrder(const int id, const int order);
2009 void ClearTextInterpolation(const int id);
2010 bool RemoveText(const int id);
2012 void GetTextSize(const kStr &in text, const int font, const float scale, float &out width, float &out height); ///< EnumGameFontType
2013 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".
2014
2015 /**
2016 * @brief add custom image to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
2017 * if the id already exists then simply sets all its variables.
2018 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2019 */
2020 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,
2021 const float s1 = 0.0f, const float t1 = 0.0f, const float s2 = 1.0f, const float t2 = 1.0f,
2022 const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2023 bool SetPicTex(const int id, const kStr &in path);
2024 bool SetPicOrigin(const int id, const float x, const float y);
2025 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)
2026 bool SetPicAngle(const int id, const float angle); ///< in rads
2027 bool SetPicWH(const int id, const float w, const float h);
2028 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);
2029 bool SetPicColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2030 void SetPicOrder(const int id, const int order);
2031 void ClearPicInterpolation(const int id);
2032 bool RemovePic(const int id);
2033 void ClearPics(const bool clearImageCache = false);
2034 bool& HideHealth(); ///< Hide health display on the HUD
2035 bool& HideAmmo(); ///< Hide ammo display on the HUD
2036 bool& HideLifeForces(); ///< Hide LifeForces display on the HUD
2037 bool& HideRunWalk(); ///< Hide RunWalk display on the HUD
2038 bool& HideLives(); ///< Hide Lives display on the HUD
2039 bool& HideBossBar(); ///< Hide BossBar display on the HUD
2040 bool& HideAirBar(); ///< Hide AirBar display on the HUD
2041 bool& HideWeaponWheel(); ///< Hide WeaponWheel display on the HUD
2042 bool& HideCrosshair(); ///< Hide Crosshair display on the HUD
2043 bool& HideHelpMessages(); ///< Hide HelpMessages display on the HUD
2044 bool& HideMessages(); ///< Hide Messages display on the HUD
2045 bool& HideTimers(); ///< Hide Timers display on the HUD
2046 const float GetMaxZDrawDistance(); ///< Returns GetExtraZFar + the max z-draw distance from the active map def.
2047 const float GetExtraZFar(); ///< a custom amount for modders to add to the zfar value
2048 void SetExtraZFar(const float zfar); ///< affects actors, ai, particles, fog and underwater. (works normally unlike the cvar r_zfarextent)
2049 const float ShakeIntensity();
2050 kVec3 WorldToHUDPoint(const kVec3&in origin);
2051 bool SphereInView(const kVec3&in origin, const float radius);
2052 bool BoxInView(const kVec3&in min, const kVec3&in max);
2053 const float ViewZFar();
2054 void SaveModFile(const kStr&in filename); ///< Saves a custom save file. make sure to call GameModFileData.Empty() before adding key/values to save
2055 bool LoadModFile(const kStr&in filename); ///< Loads a custom save file. make sure to call GameModFileData.Empty() after you're done loading
2056 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.
2057 void SetNoModSelect(const bool bToggle = true); ///< Disable the mod select menu when selecting new game for workshop mods only. (seta g_nomodselect "1")
2058 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.
2059
2060 /**
2061 * @brief Returns the key bind name of action. Returns empty string if nothing is bound.
2062 * @param action EnumInputActions
2063 * @param first if is false returns a string of all the bound keys separated by the ; character.
2064 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
2065 */
2066 kStr GetActionBind(const int action, const bool first = true, const bool sort = true);
2067
2068 /**
2069 * @brief Returns the key bind name of the console command. Returns empty string if nothing is bound.
2070 * @param command the name of the console command.
2071 @code{.cpp}
2072 "weapon 0" to "weapon 13"
2073 "automap"
2074 "changeammotype"
2075 "runwalktoggle"
2076 "menu_up"
2077 "menu_down"
2078 "menu_left"
2079 "menu_right"
2080 "*menu_select"
2081 "menu_back"
2082 "menu_cancel"
2083 "menu_activate"
2084 @endcode
2085 * @param first if is false returns a string of all the bound keys separated by the ; character.
2086 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
2087 */
2088 kStr GetCommandBind(const kStr&in command, const bool first = true, const bool sort = true);
2089 bool IsJoystickActive(); ///< if true the players last input was from a controller.
2090 kStr GetInputImagePath(const kStr&in bindName);
2091 bool InputImageExists(const kStr&in path);
2092 void SetCursorHotPos(int x, int y); ///< change the mouses cursors click point (default is 0, 0)
2093 void SetModBindings(const bool show = true); ///< Shows custom mod bindings in menu Bindings > Actions
2094 kStr PlayerName(); ///< Returns "Player" if could not get name
2095 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.
2096 const bool IsActorPersistentMarked(const int actorIndex, const int hubID = -1, const int mapNum = 0); ///< an invalid hub or map uses current maps persistent data.
2098 void SetPreventOpenPauseMenu(const bool value);
2099 void ShowPauseMenu(); ///< Should always check if(PlayLoop.CanOpenPauseMenu())
2100 void OverrideSkyHeight(const float height); ///< Set to 0 to stop overriding
2101 const int BossDamageScaler(const int difficulty, const int damage);
2102 int PurgeUnusedModels(); ///< Returns number of models freed
2107 void SetWorldSunLightColor(const float r, const float g, const float b);
2108 void SetWorldSunAmbientColor(const float r, const float g, const float b);
2109 void SetWorldSunDirection(const float x, const float y, const float z);
2110 bool IsWorkshop(); ///< Returns true if game was run through the steam workshop (ran with command arg -workshop)
2111 void OverridePerPolyCollision(const int value); ///< 0=none, 1=force disable, 2=force enable
2112 void DisableLegalText(); ///< Removes the text at the bottom of the title screen
2113 void OverrideFogType(const int value); ///< 0=none, 1=force Radial, 2=force Plane
2114 void ClearInterpolationOnGameObjects(); ///< Clears Interpolation on all gameobjects and the camera if it's active
2115 void ShowDummyMenu(void); ///< Actors OnMenuTick function will now be processed. Call ClearDummyMenu to close the dummy menu.
2116 void ClearDummyMenu(bool bClearAll = false);
2117 void ToggleCursor(bool b = false);
2119 void OpenOptionsMenu(); ///< saves config file when exiting this menu
2130 bool EnemiesAlwaysDropItems(); ///< Returns the gameplay menu option value
2131 void OverrideRespawningEnemies(const int value); ///< Set: Game.OverrideRespawningEnemies(); Get: GameVariables.GetInt("OverrideRespawningEnemies", result); 0=none, 1=force disable, 2=force enable
2132 void PlayMusicID(const int musicID, const int fadeTimeMS = 500, const bool loop = true);
2134 bool IsRunningMapScript(const int scriptID);
2135 kStr GetMapNameFromID(const int mapID); ///< Finds the name of the map with the mapID
2136 const float GetMaxZDrawDistance(); ///< Returns GetExtraZFar + the max z-draw distance from the active map def.
2137 bool IsCheatActive(const int cheatBits); ///< EnumCheatFlags. Returns true if cheats are active
2138 void SetWaterReflectionAlpha(const float alpha); ///< Default is 1.0f
2139 void EnableWaterReflectionViewPoint(const bool enable);
2140 void SetWaterReflectionViewPoint(const kVec3 &in point);
2141 void NextSoundVolumeScale(const float volume); ///< The next play sound will scale the volume by this much
2142 void NextSoundPitchScale(const float pitch); ///< The next play sound will scale the pitch by this much
2143 kDictMem @GetActorDef(const kStr &in name); ///< Returns the Actors Def by name
2144 kDictMem @GetActorDef(const int type); ///< Returns the Actors Def by it's type
2145 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.
2146 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.
2147 void GetSectorInBounds(const kVec3 &in min, const kVec3 &in max); ///< The array of sectors is stored in Game.GetSectorResult. (KD-Tree search)
2148 uint GetActorResultsLength(); ///< Use after calling Game.GetActorInBounds
2149 uint GetFxResultsLength(); ///< Use after calling Game.GetFxInBounds
2150 uint GetSectorResultsLength(); ///< Use after calling Game.GetSectorInBounds
2151 kActor @GetActorResult(const uint index); ///< Use after calling Game.GetActorInBounds. Do not use at any other point!
2152 kFx @GetFxResult(const uint index); ///< Use after calling Game.GetFxInBounds. Do not use at any other point!
2153 int @GetSectorResult(const uint index); ///< Use after calling Game.GetSectorInBounds. Do not use at any other point!
2154 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!
2155 kStr GetFxFile(const int fxID); ///< Returns the file path to the Fx by ID value as defined in defs/fileLookup.txt
2156};
2157
2158/**
2159 * @class kFxIterator
2160 * @brief The way to iterate through all Fx in the map. Example code:
2161 * @code{.cpp}
2162 * kFxIterator it;
2163 * kFx @fx;
2164 * while((@fx = it.Get()) !is null)
2165 * {
2166 * // Do something with fx
2167 * }
2168 * @endcode
2169 */
2171{
2172public:
2174 kFx@ Get(); ///< Returns the next Fx in the iterator
2175 void Reset(); ///< Resets the iterator back to the first Fx
2176};
2177
2179{
2180public:
2181 const uint16 Buttons() const; ///< returns EnumPlayerButtons
2182 uint ButtonHeldTime(const int btn); ///< btn type is EnumInputActions
2184 void ConsumeAmmo(const int ammo, const bool preferredAmmo = true);
2185 void ConsumeAltAmmo(const int ammo);
2186 const int GetAmmo(const int weaponID) const;
2187 const int GetAltAmmo(const int weaponID) const;
2188 const bool HasAmmo(const int weaponID, const bool checkAlt = true) const; ///< if checkAlt is false only checks primary ammo
2189 const bool HasAltAmmo(const int weaponID) const;
2190 const bool HasAltAmmo() const;
2191 const bool HasWeapon(const int weaponID) const;
2192 bool& UseAltAmmo();
2193 const int CurrentWeapon() const;
2194 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.
2195 bool RemoveWeapon(const int weapon);
2196 void Lock();
2197 void Unlock();
2198 int16& Armor();
2199 void Victory(const int warpActorID = - 1, const int mapID = - 1);
2200 const bool Locked() const;
2201 const int Lives() const;
2202 void SetLives(const int amount);
2203 const int LifeForces();
2204 void SetLifeForces(const int amount);
2205 bool& Backpack();
2206 bool& RunWalkToggle(); ///< if true walking is enabled. (saves)
2207 bool& NoLandClearVel(); ///< if true, when doing a hard landing you will not lose your velocity (saves)
2208 bool &NoWeaponSwitchOnWaterLand(); ///< will not auto switch weapon when entering/exiting water. (saves)
2209 bool GiveAmmo(const int weapon, const int amount, const bool altAmmo); ///< set amount to negative values to take ammo
2210 const int CurrentCheckPoint(); ///< returns warpTID
2212 void SetCheckPoint(const int warpTID, const int map);
2213 const kVec3 GetButtonAngles() const;
2215 const bool WeaponUsingAltAmmo(const int weapon) const;
2216 const bool SetWeaponUseAltAmmo(const int weapon, const bool bToggle);
2217 const bool WeaponAllowUnderwater(const int weapon) const;
2218 void ChangeWeapon(const int weapon);
2219 const int PendingWeapon() const;
2220 void CycleNextWeapon(const bool bCheckAmmo = false);
2221 void CyclePrevWeapon(const bool bCheckAmmo = false);
2222 kWeapon@ GetWeaponActor(const int weapon);
2223 int16& MaxHealth(); ///< should be >= MaxExtraHealth and ExtraHealth
2224 int16& MaxExtraHealth(); ///< should be <= MaxHealth
2225 int16& ExtraHealth(); ///< should be <= MaxExtraHealth
2226 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.
2227 void CancelSpiritualTime(float blendTime = 1.0f); ///< if in spirit mode then will set gamespeed back to 1.0f using the passed in blendTime
2228 void SetSpiritualTime(const float time, const float blend); ///< time = time until cancels the effect. Should SetGameSpeed after calling this.
2229 const float GetSpiritualTime() const;
2230 const int GetWeaponGroup(const int weapon);
2231
2232 /**
2233 * @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.
2234 * 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"
2235 */
2236 void SetWeaponGroup(const int weapon, const int group);
2237 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.
2238 float &LookSensScale(); ///< Scales mouse/controller/gyro sensitivity (default = 1.0f)
2239};
2240
2241namespace Math
2242{
2243 float Sin(float f); ///< Returns the sine of angle f in radians
2244 float Cos(float f); ///< Returns the cosine of angle f in radians
2245 float Tan(float f); ///< Returns the tangent of angle f in radians.
2246 float ATan2(float y, float x); ///< Returns the angle in radians whose Tan is y/x
2247 float Fabs(float f); ///< Returns the absolute value of f
2248 float ACos(float f); ///< Returns the arc-cosine of f - the angle in radians whose cosine is f
2249 float Sqrt(float f); ///< Returns square root of f
2250 int Abs(int i); ///< Returns the absolute value of i.
2251 float Ceil(float f); ///< Returns the smallest integer greater to or equal to f
2252 float Floor(float f); ///< Returns the largest integer smaller to or equal to f
2253 float Log(float f); ///< Returns the natural (base e) logarithm of a specified number
2254 float Pow(float x, float y); ///< Returns f raised to power p
2255 float Deg2Rad(float degs); ///< Degrees-to-radians conversion
2256 float Rad2Deg(float rads); ///< Radians-to-Degrees conversion
2257 float InvSqrt(float f); ///< Returns inverse square root of f
2258 float IncMax(const float val, const float inc, const float dest); ///< returns val +(or minus) inc and never goes above or below dest value
2259 int SysRand(); ///< Range 0..32767
2260 int Rand(); ///< Range 0..32767
2261 uint8 RandByte(); ///< Range 0..255
2262 int RandMax(const int max); ///< Range 0..max-1
2263 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]
2264 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.
2265 float RandFloat(); ///< Range 0..1
2266 float RandCFloat(); ///< Range -1..1
2267 float RandRange(const float min, const float max); ///< Returns a random float number between and min [inclusive] and max [inclusive]
2268 int Clamp(const int i, const int min, const int max); ///< Returns clamped value between min and max
2269 float Clampf(const float f, const float min, const float max); ///< Returns clamped value between min and max
2270 float Lerp(float start, const float end, const float time); ///< Linearly interpolates between start and end by time.
2271 float CosTween(const float t); ///< return (0.5f - (Cos(t * pi) * 0.5f));
2272 float CosArc(const float t); ///< return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
2273 float SmoothStep(const float from, const float to, const float t); ///< Interpolates between min and max with smoothing at the limits.
2274 float HermiteBlend(const float a, const float b, const float t);
2275 float Min(const float a, const float b); ///< Returns the smallest of the two values
2276 float Max(const float a, const float b); ///< Returns the largest of the two values
2277 const int f2i(const float f); ///< IEEE 754 float to int
2278 const float i2f(const int i); ///< int to IEEE 754 float
2279 const float pi = 3.1415927f;
2280 const float tau = 6.2831855f; ///< pi * 2
2281 const kVec3 vecZero(0.0f, 0.0f, 0.0f);
2282}
2283
2284namespace kexColors ///< Not used (garbage included automatically from kexengine)
2285{
2286 const kColor white; ///< 255, 255, 255, 255
2287 const kColor gray; ///< 127, 127, 127, 255
2288 const kColor black; ///< 0, 0, 0, 255
2289 const kColor red; ///< 255, 0, 0, 255
2290 const kColor green; ///< 0, 255, 0, 255
2291 const kColor blue; ///< 0, 0, 255, 255
2292 const kColor yellow; ///< 255, 255, 0, 255
2293 const kColor orange; ///< 255, 127, 0, 255
2294 const kColor cyan; ///< 0, 255, 255, 255
2295 const kColor magenta; ///< 255, 0, 255, 255
2296 const kColor transparent; ///< 0, 0, 0, 0
2317}
2318
2319/**
2320 * @brief
2321 * @param s the string you want to split
2322 * @param sep the separators you want to use to split the string
2323 @code{.cpp}
2324 kStr myString = "Hello,World!";
2325 kStrSplit(myString, ",");
2326 for(uint i = 0; i < kStrSplitLength(); i++)
2327 {
2328 kStr stringPart = kStrSplitGet(i);
2329 Sys.Print("SplitStrings[" + i + "] len=" + stringPart.Length() + ": " + stringPart);
2330 }
2331 kStrSplitClear();
2332 @endcode
2333 */
2334void kStrSplit(const kStr &in s, const kStr &in sep);
2335kStr kStrSplitGet(const int index); ///< returns the string at index
2336uint kStrSplitLength(); ///< returns the amount of strings that were split
2337void 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.
2338kColor kexColor_FromHSL(float hue, float sat, float lit); ///< Not used. (garbage from kexengine)
2339kColor kexColor_Random(); ///< Not used. (garbage from kexengine)
2340kColor kexColor_Tab20(uint i); ///< Not used. (garbage from kexengine)
2341kColor kexColor_Tab20Dark(uint i); ///< Not used. (garbage from kexengine)
2342kColor kexColor_Tab20Light(uint i); ///< Not used. (garbage from kexengine)
2343kColor kexColor_ViridisScale(float v); ///< Not used. (garbage from kexengine)
2344kColor kexColor_LerpRGB(const kColor&in from, const kColor&in to, float time); ///< Not used. (garbage from kexengine)
2345int kexRandInt(); ///< Range -2147483648..2147483647
2346uint kexRandUInt() ///< Range 0..4294967295
2347void delay(const float time); ///< used in map scripts to delay execution of script
2348const float GAME_FRAME_TIME = 0.25f;
2349const float GAME_DELTA_TIME = 0.016666668f;
2350const float GAME_FRAME_UNIT = 4.0f;
2351const float GAME_SECONDS = 0.06666667f;
2352const float GAME_SCALE = 10.24f;
2355kDict 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
@ 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
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)
void OnSpawn()
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.
void SetRotationOffset(const int nodeIndex, const kQuat &in rotation)
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 SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z)
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
void Blend(const int animID, float speed, float blend, int flags)
EnumAnimStateFlags.
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
const int CurrentFrame()
current frame playing for the current animation. Must have an animation action keyframe for this to w...
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.
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 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
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).
float SoundPlayTime(const kStr &in file)
returns -1 if sound is not playing. Returns the amount of time in seconds the sound has been playing ...
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
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)
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 FxEvent is running.
kVec3 & Velocity()
float DistanceToPoint(const float x, const float y, const float z) const
actors point is in the center
const kAngle & PrevLerpPitch(void) const
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()
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.
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...
void MoveToPosition(const float x, const float y)
Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision f...
kScriptObject ScriptObject()
kFx SpawnFx(const kStr &in fxPath, const kVec3 &in pos, const kQuat &in rot)
float & WallRadius()
uint & ClipFlags()
EnumClipFlags.
kRenderModel RenderModel()
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")
const kAngle & PrevLerpRoll(void) const
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()
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)
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).
const kAngle & PrevLerpYaw(void) const
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.
const kQuat & PrevLerpRotation(void) const
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");.
const kVec3 & PrevLerpOrigin(void) const
void MeleeObject(const kStr &in damageType, const kVec3 &in offset, const float radius)
kVec3 & Movement()
uint & Flags()
EnumActorFlags.
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
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
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 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 InfoProjectile() const
kActor GetOwnerAsActor()
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()
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
void MoveToPosition(const float x, const float y)
Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision f...
bool InfoDrawOnBottom() const
float & MaxDrawScale()
The highest value the DrawScale() can become when the Fx is updating its scale OnTick.
kFx GetOwnerAsFx()
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 veolcity.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 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.
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.
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 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...
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 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.
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 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.
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.
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()
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)
void OpenOptionsMenu()
saves config file when exiting this menu
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.
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 & 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 & HideWeaponWheel()
Hide WeaponWheel display on the HUD.
void PlayMusicID(const int musicID, const int fadeTimeMS=500, const bool loop=true)
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)
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())
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.
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.
kVec3 WorldToHUDPoint(const kVec3 &in origin)
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.
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)