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, ///< NOT USED. suppose to be: can't be shot at (ignores hitscans)
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};
179
190
191enum EnumAIFlags
192{
193 AIF_ATTACKING = 1, ///< playing an attacking animation
197 AIF_BLOWNAWAY = 16, ///< being blown away by explosion
203 AIF_NOCHASE = 1024, ///< disable chase logic
205 AIF_NOTHINK = 4096, ///< don't run ai logic
206 AIF_RUNNING = 8192, ///< Is playing running animation
211 AIF_TELEPORTAWAY = 262144, ///< playing teleport out animation
212 AIF_TELEPORTMOVESLOW = 524288, ///< chasing while underground
213 AIF_TELEPORTING = 1048576, ///< in teleport state. ignore all chase logic
214 AIF_TELEPORTIN = 2097152, ///< playing teleport in animation
215 AIF_WAITFORCYCLE = 4194304, ///< prevent other animations from interrupting until the current one finishes
216 AIF_DAMAGEPANIC = 8388608 ///< become aggressive when target is outside its active threshold (good for forcing AI to attack their target)
218
232
240
242{
244 CRF_FLOOR = 1, ///< made contact with a floor
245 CRF_CEILING = 2, ///< made contact with a ceiling
246 CRF_WALL = 4, ///< made contact with an edge (sector edge that isn't linked to another sector)
247 CRF_OBJECT = 8, ///< made contact with an actor
248 CRF_MESH = 16, ///< made contact with a static object
249 CRF_ADJUST = 32, ///< z-axis was adjusted (ceiling or floor)
250 CRF_WALLRADIUS = 64 ///< made contact with an edge during the wall radius collision test
251};
252
254{
258 WS_FIRE = 3, //< Is currently firing
259 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.
260 WS_WALK = 5, ///< NOT USED
261 WS_RUN = 6, ///< NOT USED
262 WS_DISCHARGE = 7, ///< set after OnEndFire is called. If was in WS_FIRE state and not pressing the Attack button.
263 WS_FIREUNDERWATER = 8 ///< NOT USED
264};
265
281
297
327
341
349
351{
352 CF_CLIPEDGES = 1, ///< clip movement against edges that don't link to sectors
353 CF_IGNOREBLOCKERS = 2, ///< don't clip edges belonging to blocking sectors
354 CF_DROPOFF = 4, ///< allows passing through platforms or ledges
355 CF_NOENTERWATER = 8, ///< block all edges that links to a water sector
356 CF_NOEXITWATER = 16, ///< block all edges that links to a non-water sector
357 CF_NOCLIPSTATICS = 32, ///< don't collide with static models
358 CF_NOCLIPACTORS = 64, ///< don't collide with dynamic objects/actors
359 CF_WALKWALLS = 128, ///< don't restrict movement to steep slopes
360 CF_COLLIDEFLOORS = 256, ///< project and clip movement against non-flat floors
361 CF_HITSCAN = 512, ///< performs a single-pass trace. useful for hitscans
362 CF_ALLOWCLIMB = 1024, ///< collide with sectors flagged as climbable
363 CF_ALLOWCRAWL = 2048, ///< collide with sectors flagged as crawlable
364 CF_NOSTEPDOWN = 4096, ///< don't clamp z-axis when walking down slopes
365 CF_NOSLOPESTEP = 8192, ///< don't project z-axis movement along slopes
366 CF_COLLIDEHEIGHT = 16384, ///< clip against ceilings
367 CF_COLLIDECORPSES = 32768, ///< clip against actors flagged as dead
368 CF_NOEXITWALLS = 65536, ///< clip all edges, regardless if they link to another sector or not
369 CF_NOCOLLIDEFUNC = 131072, ///< don't invoke the OnCollide callback on the moving object
370 CF_NOFLOORADJUST = 262144, ///< don't keep z-axis above floor plane
371 CF_NOCEILINGADJUST = 524288, ///< don't keep z-axis below ceiling plane
372 CF_COLLIDEWATER = 1048576, ///< clip movement against the water surface
373 CF_USEWALLRADIUS = 2097152, ///< clip and project movement away from walls based on wall radius
374 CF_NOCLIPTARGETACTORS = 4194304, ///< don't clip actors that are targeted by moving object
375 CF_COLLIDETRIGGERS = 8388608, ///< block edges belonging to a trigger
376 CF_STANDONOBJECTS = 16777216, ///< allow vertical clipping of objects
377 CF_GREASESLIDEOBJECTS = 33554432, ///< always keep movement projected away from collided objects
378 CF_ALLOWRESTRICTEDAREAS = 67108864, ///< don't collide with edges belonging to a restricted sector
379 CF_COLLIDECLIFFS = 134217728, ///< collide with non-walkable floors
380 CF_CHECKLINKEDBRIDGES = 268435456, ///< do extensive checks against overlapping bridge sectors
381 CF_POLYCOLLISION = 536870912 ///< clip movement against all model polygons of an object
382};
383
385{
386 WLT_INVALID = 0, ///< Not in water sectors
387 WLT_OVER = 1, ///< In water sector but over the water height
388 WLT_BETWEEN = 2, ///< In water sector and floating above the water
389 WLT_UNDER = 3 ///< In water sector and under the water height
390};
391
392/**
393 * @brief Lerp type when doing AutoPlayPositionTrack, AutoPlayRotationTrack, or AutoPlayBlendTrack.
394 * When a view has one of those active the view's time variable is then increased by GAME_DELTA_TIME.
395 */
397{
398 CMLT_NONE = 0, ///< time is set to time / speed.
399 CMLT_LINEAR = 1, ///< time is set to time / speed.
400 CMLT_LINEARLOOP = 2, ///< time is set to time / speed. If time is > 1.0 then time -= 1.0
401 CMLT_COSINE = 3, ///< time will never be higher than speed. time = CosTween(time * (1.0f / speed));
402 CMLT_COSINE_POW = 4 ///< time will never be higher than speed. time = CosTween(Pow(time * (1.0f / speed), 3));
403};
404
417
428
430{
433 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.
434 AAF_CLIFF = 8, ///< is a wall
435 AAF_CLIMB = 16, ///< climb up sectors faster than AAF_LADDER
436 AAF_ONESIDED = 32, ///< Bridge
439 AAF_ENTERCRAWL = 256, ///< Exactly the same as AAF_CRAWL
441 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.
443 AAF_RESTRICTED = 4096, ///< kAI can't enter the area
444 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).
446 AAF_MAPPED = 32768,
447 AAF_EVENT = 65536,
448 AAF_REPEATABLE = 131072, ///< Unused
449 AAF_TELEPORT = 262144,
450 AAF_DAMAGE = 524288,
451 AAF_DRAWSKY = 1048576,
453 AAF_LAVA = 4194304,
454 AAF_EVENTSOUND = 8388608,
455 AAF_ANTIGRAVITY = 16777216,
456 AAF_LADDER = 33554432, ///< climb up sectors slower than AAF_CLIMB
457 AAF_CHECKPOINT = 67108864,
458 AAF_SAVEGAME = 134217728,
459 AAF_WARPRETURN = 268435456, ///< Unused
460 AAF_SHALLOWWATER = 536870912,
461 AAF_DRAWSUN = 1073741824,
462 AAF_STOREWARPRETURN = -2147483648 ///< Unused
463};
464
482
483/**
484 * @class array<T>
485It is possible to declare array variables with the array identifier followed by the type of the elements within angle brackets.
486
487Example:
488
489@code{.cpp}
490 array<int> a, b, c;
491 array<Foo@> d;
492@endcode
493
494a, b, and c are now arrays of integers, and d is an array of handles to objects of the Foo type.
495
496When 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:
497
498@code{.cpp}
499 array<int> a; // A zero-length array of integers
500 array<int> b(3); // An array of integers with 3 elements
501 array<int> c(3, 1); // An array of integers with 3 elements, all set to 1 by default
502 array<int> d = {5,6,7}; // An array of integers with 3 elements with specific values
503@endcode
504
505Multidimensional arrays are supported as arrays of arrays, for example:
506
507@code{.cpp}
508 array<array<int>> a; // An empty array of arrays of integers
509 array<array<int>> b = {{1,2},{3,4}} // A 2 by 2 array with initialized values
510 array<array<int>> c(10, array<int>(10)); // A 10 by 10 array of integers with uninitialized values
511@endcode
512
513Each 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.
514
515@code{.cpp}
516 a[0] = some_value;
517@endcode
518
519When the array stores handles the elements are assigned using the handle assignment.
520
521@code{.cpp}
522 // Declare an array with initial length 1
523 array<Foo@> arr(1);
524@endcode
525
526@code{.cpp}
527 // Set the first element to point to a new instance of Foo
528 @arr[0] = Foo();
529@endcode
530
531Arrays can also be created and initialized within expressions as anonymous objects.
532
533@code{.cpp}
534 // Call a function that expects an array of integers as input
535 foo(array<int> = {1,2,3,4});
536@endcode
537
538 */
539template <class T>
540class array // class array<T>
541{
542public:
543 void insertAt(uint index, const T&in value); ///< Inserts a new element into the array at the specified index.
544 void insertAt(uint index, const T[]&inout arr); ///< Inserts another array of elements into the array at the specified index.
545 void insertLast(const T&in value); ///< Appends an element at the end of the array.
546 void removeAt(uint index); ///< Removes the element at the specified index.
547 void removeLast(); ///< Removes the last element of the array.
548 void removeRange(uint start, uint count); ///< Removes count elements starting from start.
549 uint length() const; ///< Returns the length of the array.
550 void reserve(uint length);
551 void resize(uint length); ///< Sets the new length of the array.
552 void sortAsc(); ///< Sorts the elements in the array in ascending order. For object types, this will use the type's opCmp method.
553 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.
554 void sortDesc(); ///< Sorts the elements in the array in descending order. For object types, this will use the type's opCmp method.
555 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.
556 void reverse(); ///< Reverses the order of the elements in the array.
557
558 /**
559 * @brief Returns the index of the first element that has the same value as the wanted value.
560 * 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.
561 * If no match is found will return a negative value.
562 */
563 int find(const T&in value) const;
564
565 /**
566 * @brief Returns the index of the first element that has the same value as the wanted value.
567 * 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.
568 * If no match is found will return a negative value.
569 */
570 int find(uint startAt, const T&in value) const;
571
572 /**
573 * @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.
574 * If no match is found will return a negative value.
575 */
576 int findByRef(const T&in value) const;
577
578 /**
579 * @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.
580 * If no match is found will return a negative value.
581 */
582 int findByRef(uint startAt, const T&in value) const;
583 bool isEmpty() const;
584 T& opIndex(uint index);
585 const T& opIndex(uint index) const;
586 T[]& opAssign(const T[]&in);
587 bool opEquals(const T[]&in) const;
588 funcdef bool less(const ?&in a, const ?&in b); ///< sorting function for sort
589 void sort(less&in, uint startAt = 0, uint count = uint ( - 1 )); ///< sorts array using the passed in less function
590};
591
592/**
593 * @class kStr
594 * @brief String class functions
595 */
596class kStr
597{
598public:
600 kStr(const kStr&in s);
601 uint Hash() const; ///< Returns HashID from this instance
602 kStr& ToUpper(); ///< Converts string to upper case characters
603 kStr& ToLower(); ///< Converts string to lower case characters
604 int Atoi() const; ///< Converts string to int
605 float Atof() const; ///< Converts string to float
606 bool Contains(const kStr&in) const; ///< contains the string
607 bool ContainsNoCase(const kStr&in) const; ///< contains the string ignoring case
608 bool IsEmpty() const; ///< length of string is 0
609 uint64 IndexOf(const kStr&in) 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.
610 uint64 Length() const; ///< Returns the length of the string
611 int8 opIndex(const int64 i); ///< Returns The ASCII code of the character at the strings index
612 bool opEquals(const kStr&in s) const;
613 kStr& opAssign(const kStr&in s);
614 kStr opAdd(const kStr&in s) const;
615 kStr opAdd(bool b) const;
616 kStr opAdd(int i) const;
617 kStr opAdd(uint i) const;
618 kStr opAdd(int64 i) const;
619 kStr opAdd(uint64 i) const;
620 kStr opAdd(int16 i) const;
621 kStr opAdd(uint16 i) const;
622 kStr opAdd(float f) const;
623 kStr& opAddAssign(const kStr&in s);
625};
626
627/**
628 * @class kAngle
629 * @brief Angle functions
630 */
632{
633public:
635 kAngle(float rads);
636 kAngle(const kAngle&in other);
637 float Diff(const float rads) const;
638 float Diff(const kAngle&in other) const;
639 float Interpolate(const float a, const float b) const;
640 kAngle opAdd(const float f) const;
641 kAngle& opAddAssign(const float f);
642 kAngle opSub(const float f) const;
643 kAngle& opSubAssign(const float f);
644 kAngle opAdd(const kAngle&in a) const;
646 kAngle opSub(const kAngle&in a) const;
648 kAngle& opAssign(const float f);
649 kAngle& opAssign(const kAngle&in a);
650 kAngle opNeg() const;
651 float opImplConv();
652};
653
654/**
655 * @class kVec3
656 * @brief Representation of 3D vectors and points.
657 */
658class kVec3
659{
660public:
662 kVec3(float x, float y, float z);
663 kVec3(const kVec3&in v);
664 kVec3& Normalize(); ///< Makes this vector have a magnitude of 1
665 kVec3 Cross(const kVec3&in v) const; ///< Cross Product of two vectors
666 float Dot(const kVec3&in v) const; ///< Dot Product of two vectors
667 float Length() const; ///< Returns the length of this vector. Exactly the same as Unit()
668 float LengthSq() const; ///< Returns the squared length of this vector. Exactly the same as UnitSq()
669 float DistanceSq(const kVec3&in other) const; ///< Returns the squared distance between this instance and other
670 float ToYaw(); ///< Returns the Yaw direction in Rads
671 float ToPitch(); ///< Returns the Pitch direction in Rads
672 void Clear(); ///< Sets x, y and z components to 0
673 void Set(const float x, const float y, const float z); ///< Set x, y and z components of this kVec3
674 kVec3 Lerp(const kVec3&in other, const float t) const; ///< Linearly interpolates between two vectors
675 kVec3& Lerp(const kVec3&in other, const float t); ///< Linearly interpolates between two vectors
676 kVec3& Project(const kVec3&in normal, const float value); ///< Projects a vector onto another vector
677 kVec3& Reflect(const kVec3&in normal, const float energyFactor); ///< Reflects a vector off the plane defined by a normal
678 kVec3& Randomize(const float value); ///< Randomizes x, y, z, components by value
679 kVec3& CubicCurve(const kVec3&in pt1, const float value, const kVec3&in pt2);
680 kVec3& QuadraticCurve(const kVec3&in pt1, const float value, const kVec3&in pt2, const kVec3&in pt3);
681 kVec3 opAdd(const kVec3&in v) const;
682 kVec3 opAdd(const float f) const;
683 kVec3& opAddAssign(const kVec3&in v);
684 kVec3& opAddAssign(const float f);
686 kVec3 opSub(const kVec3&in v) const;
687 kVec3 opSub(const float f) const;
688 kVec3& opSubAssign(const kVec3&in v);
689 kVec3& opSubAssign(const float f);
690 kVec3 opMul(const kVec3&in v);
691 kVec3 opMul(const float val);
692 kVec3& opMulAssign(const kVec3&in v);
693 kVec3& opMulAssign(const float f);
694 kVec3 opDiv(const kVec3&in v);
695 kVec3 opDiv(const float val);
696 kVec3& opDivAssign(const kVec3&in v);
697 kVec3& opDivAssign(const float f);
698 kVec3& opAssign(const kVec3&in v);
699 float opIndex(int i) const;
700 float& opIndex(int i);
701 float Distance(const kVec3&in other) const; ///< Returns the distance between this instance and other vector
703 kVec3 opMul(const kQuat&in rot) const;
704 kVec3& opMulAssign(const kQuat&in rot);
706 kQuat ToQuat() const;
707 float Unit() const; ///< Returns the length of this vector. Exactly the same as Length()
708 float UnitSq() const; ///< Returns the squared length of this vector. Exactly the same as LengthSq()
709 float x;
710 float y;
711 float z;
712};
713
714/**
715 * @class kQuat
716 * @brief Quaternions used to represent rotations
717 */
718class kQuat
719{
720public:
722 kQuat(float x, float y, float z, float w);
723 kQuat(float w, kVec3&in point);
724 kQuat(float x, float y, float z);
725 kQuat(const kQuat&in other);
728 kQuat Slerp(const kQuat&in rot, float t) const;
729 kQuat Inverse() const;
730 void GetAngles(float&out yaw, float&out pitch, float&out roll);
731 kQuat Diff(const kQuat&in rot) const;
732 void Set(const float x, const float y, const float z, const float w);
733 void Clear(); ///< x,y,z = 0.0 w = 1.0
734 kQuat opAdd(const kQuat&in rot);
735 kQuat opSub(const kQuat&in rot);
736 kQuat opMul(const kQuat&in rot);
737 kQuat& opAssign(const kQuat&in rot);
738 kQuat& opMulAssign(const kQuat&in rot);
739 kStr ToString() const;
740 float x;
741 float y;
742 float z;
743 float w;
744};
745
746/**
747 * @class kPlane
748 * @brief Plane functions
749 */
751{
752public:
754 kPlane(const float a, const float b, const float c, const float d);
755 kPlane(const kVec3&in a, const kVec3&in b, const kVec3&in c);
756 kPlane(const kVec3&in a, const kVec3&in b);
757 kPlane(const kAngle&in a);
758 const kVec3& Normal() const;
760 float Dot(const kVec3&in point) const;
761 float Dot(const kPlane&in plane) const;
762 float Distance(const kVec3&in point) const; ///< 0 = PSIDE_ON. > 0 is PSIDE_FRONT. < 0 PSIDE_BACK.
763 float ToYaw() const; ///< Yaw of this plane.
764
765 /**
766 * @brief Returns true if yaw is facing toward the plane. Usually used for climbing sectors.
767 * @code{.cpp}
768 * bool Climbable(const float yaw) const
769 * {
770 * return (floorPlane.c <= 0.5f && flags & AAF_CLIMB && floorPlane.IsFacing(yaw));
771 * }
772 * @endcode
773 */
774 bool IsFacing(const float yaw) const;
775 const int PointOnSide(const kVec3&in point) const; ///< Returns EnumPlaneSide. If point is in front, behind or on the plane.
776};
777
778class kColor ///< Not used (included automatically from kexengine)
779{
780public:
782 kColor(const kColor&in c);
783 kColor(uint8 r, uint8 g, uint8 b, uint8 a);
784 kColor(const kColor&in rgb, uint8 a);
785 kColor(uint8 rgb, uint8 a);
786 kColor(uint rgba);
787 kColor(float r, float g, float b);
788 uint DwColor() const;
789 kVec3 ToVec3() const;
790 void FromVec3(const kVec3&in v);
792 void FromVec3Linear(const kVec3&in v);
794 void SetSaturation(float);
795 void SetLuminance(float);
796 float GetSaturation() const;
797 float GetLuminance() const;
798 kColor& opAssign(const kColor&in c);
799 void LerpRGB(const kColor&in c, float t);
802 void RGBToHSV(float&out hue, float&out sat, float&out result) const;
803 void HSVToRGB(float hue, float sat, float val);
804 void RGBToHSL(float&out hue, float&out sat, float&out lit) const;
805 void HSLToRGB(float hue, float sat, float lit);
806 bool opEquals(const kColor&in c) const;
807 kColor opAdd(const kColor&in c) const;
808 kColor opSub(const kColor&in c) const;
809 kColor opMul(const kColor&in c) const;
810 kColor opMul(float f) const;
815 uint8 r;
816 uint8 g;
817 uint8 b;
818 uint8 a;
819};
820
821class kBitDelta ///< Not used (garbage included automatically from kexengine)
822{
823public:
824 bool WriteByte(const uint8 i);
825 uint8 ReadByte();
826};
827
828class kexTranslation ///< Not used (garbage included automatically from kexengine)
829{
830public:
831 uint GetGroupIndex(const kStr&in groupName);
832 kStr GetString(const kStr&in key, kexLocPlatform_e plat) const;
833 kStr GetString(int key, kexLocPlatform_e plat) const;
834 kStr GetGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
835 kStr GetGroupString(int key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
836 kStr TranslateString(const kStr&in key, kexLocPlatform_e plat) const;
837 kStr TranslateString(const kStr&in key) const; ///< Same as Game.GetLocalizedText
838 kStr TranslateGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
839 kStr TranslateStringWithArgs(const kStr&in key, const kDict&in pairs, uint plat) const; ///< plat: kexLocPlatform_e
840 kStr TranslateGroupStringWithArgs(const kStr&in key, const kDict&in pairs, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
841};
842
843class ref
844{
845public:
848 ref(const ref&in);
849 ref(const ?&in);
850 void opCast(?&out);
851 ref& opHndlAssign(const ref&in);
852 ref& opHndlAssign(const ?&in);
853 bool opEquals(const ref&in) const;
854 bool opEquals(const ?&in) const;
855};
856
858{
859public:
861};
862
864{
865public:
866 void OnTick();
867 void OnSpawn();
868};
869
871{
872public:
874 void OnFire();
875 void OnEndFire();
876 void OnLower();
877 void OnRaise();
879};
880
881/**
882 * @class kDict
883 * @brief Editable Dictionary object that holds keys and values
884 */
885class kDict
886{
887public:
888 void Add(const kStr&in key, const kStr&in value); ///< Adds a new key/value
889 void Empty(); ///< Removes all keys/values
890 void SetValue(const kStr&in key, const kStr&in value); ///< Sets the value for the specified key
891 const bool HasKey(const kStr&in key); ///< Returns true if key exists
892 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
893 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
894 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
895 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
896 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
897};
898
899/**
900 * @class kDictMem
901 * @brief Read only Dictionary object that holds keys and values
902 */
904{
905public:
906 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
907 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
908 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
909 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
910 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
911};
912
913/**
914 * @class kSelectionListInt
915 * @brief For selecting a int value based on weights
916 */
918{
919public:
921 void AddItem(int item, const int weight);
922 int& Select(); ///< Returns a value based on item weights
923 void Reset(); ///< clears all items in the list
924 const uint GetNumEntries() const; ///< returns number of items in the list
926};
927
928/**
929 * @class kSelectionListFloat
930 * @brief For selecting a float value based on weights
931 */
933{
934public:
936 void AddItem(float item, const int weight);
937 float& Select(); ///< Returns a value based on item weights
938 void Reset(); ///< clears all items in the list
939 const uint GetNumEntries() const; ///< returns number of items in the list
941};
942
944{
945public:
946 void SetModel(const kStr&in modelPath, const kStr&in modelAnimPath);
947 void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z);
948 void SetRotationOffset(const int nodeIndex, const kQuat&in rotation);
949 void SetTexture(const int section, const int textureID);
950 void SetVisibility(const int nodeIndex, const bool visible);
951 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.
952 void AddTrailEffect(const kStr&in trailName, const int nodeIndex);
953 void RemoveTrailEffect(); ///< Removes all trail effects
956 const int GetNumNodes() const;
957 kVec3 GetNodeOrigin(const int node, const kVec3&in offset); ///< Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
958 kQuat GetNodeRotation(const int node); ///< Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
959 kVec3 GetNodeScale(const int node);
960 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.
963 const bool IsMorph() const;
964
965 /**
966 * @brief Set Morph Updating.
967 * @param bUpdate: Set to false to handle updating it yourself per ModelFile (not per Actor).
968 *
969 Default Tick code:
970 @code{.cpp}
971 if(time >= 1.0f)
972 {
973 time = 0;
974 frame++;
975
976 if(frame >= maxFrames)
977 {
978 frame = 2;
979 }
980 nextFrame = frame + 1;
981 }
982 time += GAME_DELTA_TIME * 7.5f;
983 @endcode
984 */
985 void SetMorphUpdating(const bool bUpdate);
986
987 /**
988 * @brief Get Morph frame info
989 * @param frame: 1=Init Frame, 2=Start Loop Frame. >= maxFrames then 1.
990 * @param nextFrame: 2=Init Frame, 3=Start Loop Frame. >= maxFrames then 2.
991 * @param maxFrames
992 * @param time: 0..1 (lerp time between frame and nextFrame meshes)
993 */
994 void GetMorphFrame(int&out frame, int&out nextFrame, int&out maxFrames, float&out time) const;
995 void SetMorphFrame(const int frame, const int nextFrame, const float time);
996 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.
997 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
998};
999
1001{
1002public:
1003 void Blend(const int animID, float speed, float blend, int flags); ///< EnumAnimStateFlags
1004 void Set(const int animID, float speed, int flags); ///< EnumAnimStateFlags
1005 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.
1006 const int NumFrames(); ///< number of frames in this animation
1007 const int NumNodes(); ///< number of nodes in this animation
1008 const float PlayTime(); ///< increases by GAME_DELTA_TIME if not stopped or paused.
1009 const float TrackTime(); ///< time from 0(on first frame) to 1(on last frame).
1010 bool IsPlaying(const int animID); ///< Returns true if current animations ID is animID and the animation is not stopped.
1011 bool CheckAnimID(const int animID); ///< checks if animID exists
1012 const int PlayingID() const; ///< the current animations ID
1013 void Stop(); ///< flags |= ANF_STOPPED; flags &= ~ANF_LOOP;
1014 void Pause(); ///< flags |= ANF_PAUSED;
1015 void Resume(); ///< flags &= ~ANF_PAUSED;
1016 const bool Stopped() const; ///< (flags & ANF_STOPPED) != 0
1017 const bool Blending() const; ///< (flags & ANF_BLEND) != 0
1018 const bool Looping() const; ///< (flags & ANF_LOOP) != 0
1019 const bool CycleCompleted() const; ///< (flags & ANF_CYCLECOMPLETED) != 0
1020 void ChangeSpeed(const float speed); ///< Scales speed of the current animation where 1.0 = 15fps and 4.0 = 60fps
1021 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).
1022 void SetPlayTime(const float time); ///< The total time in seconds this animation has been playing
1023 void SetTrackTime(const float time); ///< 0.0(first frame) to 1.0(last frame)
1024 const int TrackFrame(void) const; ///< current frame playing for the current animation.
1025 const int TrackNextFrame(void) const; ///< next frame to play for the current animation.
1026 kQuat GetRotation(const int animID, int nodeNum, int frame);
1027 kVec3 GetOrigin(const int animID, int nodeNum, int frame);
1028 const int GetAnimNumFrames(const int animID);
1029 int flags; ///< EnumAnimStateFlags
1030};
1031
1032/**
1033 * @class kActor
1034 * @brief Base type used by all actors.
1035 */
1037{
1038public:
1039 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.
1043 kVec3& Origin(); ///< Position in world space
1046 void SetTarget(kActor@ actor);
1048 void SetSector(const uint sectorIndex);
1049 void Remove(); ///< Removes the actor and sets stale to true. Actor will only internally be removed when there are no references to this actor.
1053 int16& Health();
1054 int& Type(); ///< The actors Type ID
1055 int& ImpactType(); ///< EnumImpactType
1056 int& ImpactTypeDmg(); ///< EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
1057 bool &IgnoreSectorHeightChange(void); ///< if true will not change position(or velocity and movement) when sector height changes.
1060 uint& Flags(); ///< EnumActorFlags
1061 const uint SpawnFlags1() const; ///< EnumActorSpawnFlags1
1062 const uint SpawnFlags2() const; ///< EnumActorSpawnFlags2
1063 const uint SpawnFlags3() const; ///< EnumActorSpawnFlags3
1064 const int TID() const;
1065 float& Radius();
1066 float& Height();
1067 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.
1068 float& WallRadius();
1069 float& Gravity();
1070 float& Friction();
1071 float& AnimSpeed();
1072 float& BounceDamp();
1073 float& FloorHeight();
1075 const int SectorIndex();
1076 const int AreaID() const;
1077 bool InstanceOf(const kStr&in className) const; ///< example: InstanceOf("kexPuppet")
1078 void PlaySound(const kStr&in soundPath);
1079 void PlaySoundWithLookupID(const int soundID);
1082 const int GameTicks() const;
1085 const bool InWater() const;
1086 bool CheckPosition(const kVec3&in origin); ///< checks if the actor can move to this location
1087 bool CheckPosition(const float angle, const float distance); ///< calls CheckPosition(kVec3 origin) with origin being: Actor.Origin() + (angle*distance*Actor.Radius())
1088 float GetTurnYaw(const kVec3&in lookAtLocation) const;
1089 float GetAvoidanceAngle(const kVec3&in lookAtLocation, const float distance);
1090 const float GetWaterHeight() const;
1091 const bool CanSee(kActor@ actor, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1092 uint& ClipFlags(); ///< EnumClipFlags
1093 kDictMem@ Definition(); ///< get actors def data
1094 bool OnGround() const;
1095 int GetWaterLevel() const; ///< EnumWaterLevel
1096 kActor@ CastToActor(); ///< Casts to a kActor. Only used for kPuppet Actor().
1097 kAI@ CastToAI(); ///< Casts to kAI. returns null if isn't a kAI.
1098 void SpawnProjectile(const kStr&in fxPath, const kVec3&in pos, const kVec3&in targetLocation, const float maxAngle);
1099 void MeleeObject(const kStr&in damageType, const kVec3&in offset, const float radius);
1100 void SpawnFx(const kStr&in fxPath, const kVec3&in pos);
1101 void SpawnFx(const kStr&in fxPath, const kVec3&in pos, const kQuat&in rot);
1103 float DistanceToPoint(const kVec3&in point) const; ///< calls DistanceToPoint(x,y,z)
1104 float DistanceToPoint(const float x, const float y, const float z) const; ///< actors point is in the center
1105 void InflictGenericDamage(kActor@ inflictor, const int damage);
1106 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
1107 void InflictDamage(kActor@ inflictor, const kStr&in damageDef);
1108 /**
1109 * @brief Calls a script function on all actors that are in the AreaNodes contained inside a bounds. The bounds is calculated as: pos + this actors bounds(model bounds) + this actors radius
1110 * @param pos The world position of where to check for actors
1111 * @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@, const float, const float, const float, const float)
1112 */
1113 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);
1115 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.
1116 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.
1117 void SetPosition(const kVec3&in pos, const bool clearInterpolation = true); ///< best way to set an actors position, will also set the sector and optionally clear interpolation
1118
1119 /**
1120 * @brief Get a map actors param value
1121 * @param paramID
1122 * (0) Target ID -32768..32767
1123 * (1) Trigger Anim 0..255
1124 * (2) Health -32768..32767
1125 * (3) Max Regenerations -32768..32767
1126 * (4) Attach Chance 0..255
1127 * (5) Texture -128..127
1128 * (6) Params 2 -128..127
1129 * (7) Params 1 -128..127
1130 */
1131 const int16 SpawnParams(const int paramID) const;
1132 const float GetCeilingHeight() const; ///< calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
1133 const float GetFloorHeight() const; ///< calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
1134 void RunFxEvent(const kStr&in fxEventName); ///< Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");
1135 bool FxEventActive(); ///< Returns true if FxEvent is running
1136 const int GetSectorIndexAtLocation(const kVec3&in pos, uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1137 void MarkPersistentBit(const bool clear);
1141 void AutomapToggle(const bool show); ///< Use with Game.AutomapCustom(true);
1142 void SetAutomapColor(const int r, const int g, const int b);
1143
1144 /**
1145 * @brief Sets the actors param value. all params are int16.
1146 * @param param
1147 * (0) Target ID -32768..32767
1148 * (1) Trigger Anim 0..255
1149 * (2) Health -32768..32767
1150 * (3) Max Regenerations -32768..32767
1151 * (4) Attach Chance 0..255
1152 * (5) Texture -128..127
1153 * (6) Params 2 -128..127
1154 * (7) Params 1 -128..127
1155 * @param value
1156 */
1157 void SetSpawnParams(const int param, const int16 value);
1158 void SetSpawnFlags1(const uint flags); ///< EnumActorSpawnFlags1
1159 void SetSpawnFlags2(const uint flags); ///< EnumActorSpawnFlags2
1160 void SetSpawnFlags3(const uint flags); ///< EnumActorSpawnFlags3
1161 void SetupSpawnParams(); ///< call after setting your actors spawnflags for them to take effect on the kActor
1162 void SetCustomDeadHeight(const bool bUse, const float height); ///< Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
1163 const float GetCustomDeadHeight();
1165 const bool OverridingKeyTouchTID(); ///< used only for key pickups
1166 const int16 GetOverrideKeyTouchTID(); ///< used only for key pickups
1167 void OverrideKeyTouchTID(const bool bOverride, const int16 tid); ///< used only for key pickups to tell what key it is in the hub
1168 bool& SkipKeyTouchCinema(); ///< used only for key pickups
1169 void SetModel(kStr&in modelFile, kStr&in animFile); ///< a way to set the model/anim for actors that had no model set previously
1170 bool& TriggerInvincibility(); ///< Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
1171 bool &DrawDelay(); ///< Don't draw until has ticked once.
1172 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)
1173 const int MapActorIndex() const; ///< Returns -1 if not a map actor
1174 int& DifficultyMode(); ///< The difficulty this actor is currently set to
1175 void OverrideOnDamageValue(const int damage, const bool bOverride = true); ///< call in OnPreDamage
1176 bool& NoKnockBack(); ///< Will not receive knock back movement from things like the alien weapon for example.
1177 const float BaseHeight() const; ///< height of actor when spawned or when kAI regenerated
1178 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
1179 float& AirFriction(); ///< default = 1.0f
1180 float& WaterFriction(); ///< default = 0.5f (same as Friction)
1181 float& Mass(); ///< default = GAME_SCALE * 1.0f
1182 const float GetSkyHeight() const;
1183 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.
1184 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.
1185 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.
1186 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.
1187 const kVec3 &PrevLerpOrigin(void) const;
1188 const kQuat &PrevLerpRotation(void) const;
1189 const kAngle &PrevLerpPitch(void) const;
1190 const kAngle &PrevLerpRoll(void) const;
1191 const kAngle &PrevLerpYaw(void) const;
1192 bool HasCustomRef(void) const;
1193 void AddCustomRef(void); ///< Keeps the actor from getting freed from memory.
1194 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.
1195 void SetupHeadTrack(const kStr &in headTrackDef); ///< Sets a headtrack
1196 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.
1197 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.
1198 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.
1199};
1200
1201/**
1202 * @class kActorIterator
1203 * @brief The way to iterate through all actors in the map. Example code:
1204 * @code{.cpp}
1205 * kActorIterator it;
1206 * kActor @actor;
1207 * while((@actor = it.Get()) !is null)
1208 * {
1209 * // Do something with actor
1210 * }
1211 * @endcode
1212 */
1214{
1215public:
1217 kActor@ Get(); ///< Returns the next actor in the iterator
1218 void Reset(); ///< Resets the iterator back to the first actor
1219};
1220
1221class kWeapon : public kActor
1222{
1223public:
1224 kVec3 TransformToOwnerPosition(); ///< returns the OffsetPosition() * the players matrix.
1225 kVec3 TransformToOwnerPosition(const kVec3&in vector); ///< returns the (OffsetPosition() + vector) * the players matrix.
1226
1227 /**
1228 * @brief SpawnsFx at the players at the position passed in * players rotation, then adds the
1229 * viewHeight + landingViewOffset to the z position. Sets PF_FIREDPROJECTILE PlayerFlags.
1230 * adjustToPerspective will change the position you pass in like this:
1231 * @code{.cpp}
1232 * float d = kexMath::Pow(47.5f / fov, fov / 60.0f);
1233 * vOrigin.y *= d;
1234 * vOrigin.z += (1.0f - d) * 2.0f;
1235 * @endcode
1236 */
1237 void FireProjectile(const kStr&in fxPath, const float x, const float y, const float z, const bool adjustToPerspective = false);
1238 bool& PreventFire(); ///< Use in OnBeginFire to internally prevent from entering its Fire state.
1239 bool &NoGenericBobbing(); ///< Disables the generic weapon bobbing menu option from affecting this weapon
1240 kVec3& OffsetPosition(); ///< Offset position of weapon
1241 int& State(); ///< EnumWeaponStates
1242 bool &AllowUnderwater(); ///< Set to true to allow the weapon underwater. Gets reset back to the weapons def value after OnBeginLevel.
1244};
1245
1246class kAI : public kActor
1247{
1248public:
1249 uint& AIFlags(); ///< EnumAIFlags
1250 void SetupAISpawnFlags(); ///< call after setting your actors spawnflags for them to take effect on the kAI
1251 int& AttackChance(); ///< 0-100
1252 float& AttackRange(); ///< squared
1253 float& MeleeRange(); ///< squared
1254 float& LeashRadius(); ///< squared
1255 float& SightRange(); ///< squared
1256 float& LoudRange(); ///< squared
1257 float& QuietRange(); ///< squared
1258 float& FlyHeight(); ///< squared
1259 float& SightFOV(); ///< in rads
1260 int& Agitation(); ///< 0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE
1261 float& AnimScalar(); ///< default = 1.0f
1262 float& BlendScalar(); ///< default = 10.0f
1263};
1264
1265class kPuppet : public kActor
1266{
1267public:
1268 float& ViewHeight(); ///< set from the players def "player.viewHeight". Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1269 float& RecoilPitch(); ///< used for weapon recoil that modifies the players pitch.
1270 const float LandingViewOffset() const; ///< LandingViewOffset changes when jumping and falling. Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1271 uint& PlayerFlags(); ///< EnumPlayerFlags
1274 void SetGroundForwardSpeed(const float speed); ///< default = 10.24f
1275 void SetGroundBackwardSpeed(const float speed); ///< default = -10.24f
1276 void SetGroundStrafeSpeed(const float speed); ///< default = 10.24f
1277 void SetGroundForwardAccel(const float accel); ///< default = 0.05f
1278 void SetGroundBackwardAccel(const float accel); ///< default = 0.05f
1279 void SetGroundStrafeAccel(const float accel); ///< default = 0.05f
1280 void SetGroundDeaccel(const float accel); ///< default = 0.5f
1281 void SetSwimForwardSpeed(const float speed); ///< default = 10.24f
1282 void SetSwimBackwardSpeed(const float speed); ///< default = -10.24f
1283 void SetSwimStrafeSpeed(const float speed); ///< default = 10.24f
1284 void SetSwimForwardAccel(const float accel); ///< default = 0.05f
1285 void SetSwimBackwardAccel(const float accel); ///< default = 0.05f
1286 void SetSwimStrafeAccel(const float accel); ///< default = 0.05f
1287 void SetSwimDeaccel(const float accel); ///< default = 0.5f
1288 void SetJumpMinSpeed(const float speed); ///< default = GAME_SCALE * 0.855f
1289 void SetJumpMaxSpeed(const float speed); ///< default = GAME_SCALE * 1.667f
1290 void SetJumpClimbSpeed(const float speed); ///< default = GAME_SCALE * 0.2875f
1291 void SetOverrideShadow(const int value); ///< 0=none(default), 1=Force Disable shadow, 2=Force Enable shadow
1292 void SetOverrideWalkRun(const int value); ///< 0=none(default), 1=Force Disable Walk
1293 float& Oxygen(); ///< Time in seconds. 0: full oxygen. >= 55: shows air bar. >= 70: OxygenOut is set to true.
1294 bool& OxygenOut(); ///< if true will damage player if underwater
1295 float& OverrideFOV(); ///< set to 1-179. anything else will stop overriding the fov and will use the r_fov cvar.
1296 void SetCrawl(const bool crawl); ///< use this to manually set if the player is crawling instead of setting PF_CRAWLING directly.
1297 const float GroundForwardSpeed() const; ///< default = 10.24f
1298 const float GroundBackwardSpeed() const; ///< default = -10.24f
1299 const float GroundStrafeSpeed() const; ///< default = 10.24f
1300 const float GroundForwardAccel() const; ///< default = 0.05f
1301 const float GroundBackwardAccel() const; ///< default = 0.05f
1302 const float GroundStrafeAccel() const; ///< default = 0.05f
1303 const float GroundDeaccel() const; ///< default = 0.5f
1304 const float SwimForwardSpeed() const; ///< default = 10.24f
1305 const float SwimBackwardSpeed() const; ///< default = -10.24f
1306 const float SwimStrafeSpeed() const; ///< default = 10.24f
1307 const float SwimForwardAccel() const; ///< default = 0.05f
1308 const float SwimBackwardAccel() const; ///< default = 0.05f
1309 const float SwimStrafeAccel() const; ///< default = 0.05f
1310 const float SwimDeaccel() const; ///< default = 0.5f
1311 const float JumpMinSpeed() const; ///< default = GAME_SCALE * 0.855f
1312 const float JumpMaxSpeed() const; ///< default = GAME_SCALE * 1.667f
1313 const float ClimbJumpAmount() const; ///< default = GAME_SCALE * 0.2875f
1314 const int OverrideShadow() const; ///< default = 0
1315 const int OverrideWalkRun() const; ///< default = 0
1316 const int GetState(void) const; ///< EnumPlayerStates
1317 float &MaxFallVelocity(void); ///< default = -200.0f
1318 bool &NoWallJump(void); ///< default = false
1319 bool &CustomViewEnable(); ///< Set to true to enable the custom view
1320 bool &CustomViewUnderwater(); ///< whether the custom view is underwater or not
1325};
1326
1327/**
1328 * @class kActorFactory
1329 * @brief For Spawning Actors
1330 */
1332{
1333public:
1334 kActor@ Spawn(const int actorID, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1335 kActor@ Spawn(const kStr&in actorName, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1336};
1337
1339{
1340public:
1341 void StartCinematic(const uint flags = 12); ///< EnumCameraFlags
1342 void StopCinematic(const bool noFade = false); ///< if noFade is true will stop the cinematic immediately without fading out.
1343 const int CinematicState() const; ///< EnumCameraStates
1346 void SetRotateEyeVector(const kVec3&in vector); ///< The focus position that is used when AutoPlayRotationTrack is called if there is no LookAtActor set.
1347 void SetFinalView(const int view); ///< the view to use for the camera origin and direction. view must be in range 0-2
1348 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.
1349 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.
1350 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.
1351 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).
1352 void AutoPlayPositionTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenPositionTrack on the view using speed and lerpType
1353 void AutoPlayRotationTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenRotationTrack on the view using speed and lerpType
1354 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.
1355 void SetEyeView(const kVec3&in position); ///< position of camera (finalview). finalview must be set or will do nothing.
1356 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.
1357 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.
1358 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.
1359 kVec3 GetEyeView(); ///< position of camera (finalview). finalview must be set or will return vecZero.
1360 kVec3 GetFocusView(); ///< position of where the camera (finalview) is looking at. finalview must be set or will return vecZero.
1361 void ClearFinalView(); ///< finalview is set to null
1362 void ClearViewTracks(); ///< views 0-2 all variables are set to 0
1363 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
1364 void SetUserInterrupted(const bool toggle); ///< set to false to set the user interrupted to false.
1365 const bool Active() const;
1366 const bool Enabled() const; ///< CinematicState() >= CAMS_FADEOUT (Not Idle)
1367 const bool ViewingFromCamera() const; ///< CinematicState() >= CAMS_FADEIN && CinematicState() <= CAMS_ACTIVE_TO_FADEOUT
1368 kVec3& Tremor(); ///< x = adds to yaw, y = adds to pitch, z = adds to roll. lerps to vecZero using lerpTime of GAME_FRAME_TIME.
1369 void SetSector(const uint sectorIndex);
1370 const int SectorIndex();
1371 const int AreaID() const;
1373 const uint Flags() const; ///< EnumCameraFlags
1374 kVec3 origin; ///< current position of camera. if a finalview is set then the origin will be set to the finalview's eye position.
1375 kAngle yaw; ///< if a finalview is set then the yaw will be set to the finalview's look direction.
1376 kAngle pitch; ///< if a finalview is set then the pitch will be set to the finalview's look direction.
1377 kAngle roll; ///< if a finalview is set then the roll will be set to 0.
1378 float fov; ///< Camera FOV (default is 74.0)
1379 float lookZOffset; ///< Used only if LookAtActor has been set.
1380 bool &ClearInterpolationOnTick(void); ///< set to false to handle interpolation yourself
1381 bool &AllowMenusWhenActive(void); ///< set to true to allow the pause menu to be opened during a cinematic
1382};
1383
1384/**
1385 * @class kCModel
1386 * @brief The kCModel(CModel) global stores collision results when certain actor methods are called. Those methods are as follows:
1387 * GetSectorIndexAtLocation
1388 * const bool CanSee(kActor@, const uint = 0)
1389 * MoveToPosition
1390 * SpawnProjectile
1391 * bool CheckPosition(const kVec3 &in)
1392 */
1394{
1395public:
1396 kVec3& InterceptVector(); ///< Returns the vector that intersected the collided geometry
1397 kVec3& ContactNormal(); ///< Returns the normalized vector of the collided surface
1398 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.)
1399 const uint ClipResult(); ///< specifies the type of intersection (flags)
1400 kActor@ ContactActor(); ///< handle pointer to actor that was collided (null if none was collided)
1401 kVec3& MoveDirection(); ///< Movement vector of the object
1402};
1403
1405{
1406public:
1407 const int Ticks() const; ///< affected by gamespeed
1408 const int UnscaledTicks() const; ///< Not affected by GameSpeed
1411 void CheckKeys(); ///< Prints HUD messages to tell the player how many keys they've found on the current HUBID
1412 void ChangeMap(const kStr&in mapName);
1413 void StartWarp(kActor@ actor, const int tagID, const int mapID);
1414 void StartFreeWarp(kActor@ actor, const kVec3&in origin, const float yaw, const int sectorIndex, const int mapID);
1415 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.
1416 const bool CheckWarping(); ///< Checks if Warping or FreeWarping is in progress.
1417 const bool CanOpenPauseMenu(); ///< Checks if it's okay to be able to open a menu
1418 const bool CanOpenSaveMenu(); ///< Checks if it's okay to be able to open the save menu
1419 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.
1420 void ClearWarpInterpolation(void); ///< Clearing the interpolation for kPuppet will also clear the warp interpolation.
1421};
1422
1423class kSys
1424{
1425public:
1426 void Print(const kStr&in message);
1427 void Warning(const kStr&in message);
1430 int Mouse_X();
1431 int Mouse_Y();
1432 const bool GetCvarValue(const kStr&in cvarName, kStr&out result);
1433 void MouseToHUD(float&out x, float&out y); ///< Returns the HUD position of the mouse
1434};
1435
1437{
1438public:
1439 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
1440 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.
1441 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.
1442 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)
1443 void FloodFillAreaFlags(const kVec3&in origin, const uint flags, const bool active); ///< (EnumAreaFlags) Calls FloodMatchingAreaFlags with FindNextClosestSector(origin) sector.
1444 void FloodMatchingAreaFlags(const int sectorIndex, const uint flags, const bool active); ///< (EnumAreaFlags) Sets flags on all adjacent sectors with matching areaID.
1445 const uint GetAreaFlags(const int areaID) const; ///< EnumAreaFlags
1446 const int GetAreaFloorImpact(const int areaID) const; ///< EnumImpactType
1447 const int GetAreaWallImpact(const int areaID) const; ///< EnumImpactType
1448 void ChangeAreaFloorImpact(const int areaID, const int value); ///< value: EnumImpactType
1449 void ChangeAreaWallImpact(const int areaID, const int value); ///< value: EnumImpactType
1450 void ChangeAreaWaterHeight(const int areaID, const float height); ///< WaterHeight is stored per area, not per sector or per vertex.
1451
1452 /**
1453 * @brief Returns an area arg value
1454 * @param areaID
1455 * @param arg
1456 @code{.cpp}
1457
1458 though args can be used for anything, they are typically used in this fashion:
1459 0: warp ID
1460 1: warp level ID or trigger sound ID
1461 2: checkpoint ID
1462 3: tag ID
1463 4: floor damage hit points
1464 5: floor damage rate
1465
1466 Hardcoded:
1467 0: AAF_TELEPORT: WarpID
1468 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1469 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1470 3: AAF_EVENT: tag ID
1471 4: Not used
1472 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))
1473
1474 Default Scripts:
1475 0: Not used
1476 1: Not used
1477 2: Not used
1478 3: Not used
1479 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1480 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1481 @endcode
1482 */
1483 const int16 GetAreaArg(const int areaID, const int arg) const;
1484
1485 /**
1486 * @brief
1487 * @param areaID
1488 * @param arg
1489 @code{.cpp}
1490
1491 though args can be used for anything, they are typically used in this fashion:
1492 0: warp ID
1493 1: warp level ID or trigger sound ID
1494 2: checkpoint ID
1495 3: tag ID
1496 4: floor damage hit points
1497 5: floor damage rate
1498
1499 Hardcoded:
1500 0: AAF_TELEPORT: WarpID
1501 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1502 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1503 3: AAF_EVENT: tag ID
1504 4: Not used
1505 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))
1506
1507 Default Scripts:
1508 0: Not used
1509 1: Not used
1510 2: Not used
1511 3: Not used
1512 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1513 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1514 @endcode
1515 * @param value
1516 */
1517 void ChangeAreaArg(const int areaID, const int arg, const int16 value);
1518 void ChangeSectorHeight(const int sectorIndex, const float height); ///< Changes all sectors floor vertices with the same areaID to the height
1519 void ChangeSectorCeilingHeight(const int sectorIndex, const float height); ///< Changes all sectors ceiling vertices with the same areaID to the height
1520 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.
1521 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.
1522 const int FindNextClosestSector(const kVec3&in origin);
1523 /**
1524 * @brief Get the Sectors vertex position and height
1525 * Link 1 is pt1 to pt3
1526 * Link 2 is pt2 to pt1
1527 * Link 3 is pt3 to pt2
1528 * @param sectorIndex
1529 * @param pt1
1530 * @param pt2
1531 * @param pt3
1532 * @param heights: x is the height of pt1, y is the height of pt2, z is the height of pt3.
1533 */
1534 void GetSectorCorners(const int sectorIndex, kVec3&out pt1, kVec3&out pt2, kVec3&out pt3, kVec3&out heights) const;
1535
1536 /**
1537 * @brief Get the 3 sectors links. -1 means there was no sector linked to that edge.
1538 * Link 1 is pt1 to pt3
1539 * Link 2 is pt2 to pt1
1540 * Link 3 is pt3 to pt2
1541 * @param sectorIndex
1542 * @param sectorIndex1
1543 * @param sectorIndex2
1544 * @param sectorIndex3
1545 */
1546 void GetSectorLinks(const int sectorIndex, int&out sectorIndex1, int&out sectorIndex2, int&out sectorIndex3) const; ///< a sectorIndex with -1 is no sector.
1547 const uint GetSectorNumBridges(const int sectorIndex) const; ///< number of bridge sectors this sector has
1548 const int GetSectorBridge(const int sectorIndex, const uint bridge) const; ///< Get the sector of the bridge. Use GetSectorNumBridges to loop through them all.
1549 const int GetSectorAreaID(const int sectorIndex) const;
1550 const int GetNumSectors() const;
1551 const int GetNumAreas() const;
1552 const int GetNumActors() const; ///< number of actors that are in the current maps data
1553 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.
1554 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.
1555};
1556
1558{
1559public:
1560 void CallDelayedMapScript(const kStr&in funcName, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
1561 void CallDelayedMapScript(const int scriptID, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
1562 void CallMapScript(const int scriptID, kActor@ instigator); ///< Use to call map script right away
1563 void HaltMapScript(const int scriptID);
1564 void PlaySound(const kStr&in path);
1565 void PlaySoundID(const int soundID);
1566 void PlayMusic(const kStr&in path, const bool loop);
1572 void MusicPitch(const float pitch);
1573
1574 /**
1575 * @brief Start controller vibration from tactile sound file. Returns a handle.
1576 * @param path the path to the .bnvib file
1577 * @param channel kexVibrationPlayer::channel_e
1578 * @param pos kexVibrationPlayer::position_e
1579 */
1580 int PlayTactile(const kStr&in path, int channel, int pos);
1581 bool IsTactilePlaying(int vibHandle);
1582 bool IsTactilePlaying(int vibHandle, const kStr&in path);
1584 void StopTactile(int vibHandle);
1586 void Restart();
1587
1588 /**
1589 * @brief Print a message to the HUD
1590 * @param text
1591 * @param lineNumber must be in range 0..7
1592 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
1593 */
1594 void PrintLine(const kStr&in text, const int lineNumber, const int ticks = 120);
1595 /**
1596 * @brief Print a message to the HUD on the next line.
1597 * @param text
1598 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
1599 */
1600 void Print(const kStr &in text, const int ticks = 120);
1601 void PrintHelp(const kStr&in text, const bool endGame = false);
1605 void ChangeMap(const kStr&in path);
1606 void ShowMainMenu(const bool mouseCenter = true);
1607 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.
1608 const int GetMapIDFromName(const kStr &in mapName); ///< This returns the mapID from the mapName. Returns -1 if not found.
1609 const int GetCurrentMapID();
1610 const int GetDifficulty(); ///< EnumDifficulty. Internally calls GameVariables.GetInt("g_difficulty")
1611 void SetDifficulty(const int value); ///< EnumDifficulty
1613
1614 /**
1615 * @brief Sets the current GameSpeed. kPuppet and kPlayerWeapon are not affected by GameSpeed.
1616 * @param speed 0..1
1617 * @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)
1618 */
1619 void SetGameSpeed(const float speed, const float blendSpeed);
1620 bool GetHubKeyInfo(const uint hubID, int&out nKeys, int&out remainingKeys, int&out keyBits);
1621 bool SetHubKey(const uint hubID, int key);
1622 void SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
1623 void SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
1624 void SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const kQuat&in rotation);
1625 void SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const kQuat&in rotation);
1626 void SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const float yaw, const float pitch);
1627 void SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const float yaw, const float pitch);
1628 void SpawnFx(const kStr&in fxPath, const kVec3&in origin, const int sectorIndex);
1630 const bool AutomapEnabled(); ///< is the automap displaying on screen
1631 const bool AutomapDeactived();
1632 void AutomapToggle(const bool toggle); ///< show/hide the automap.
1633 void AutomapDeactive(const bool toggle); ///< permanently deactivates the automap.
1634 void AutomapCustom(const bool toggle); ///< allow actors with custom automap colors to be drawn to the automap. (for mods)
1635 void LifeForcePulse(); ///< Shows the LifeForces on the HUD
1636 void LivesPulse(); ///< Shows the Lives on the HUD
1637 void RunWalkPulse(); ///< Shows the RunWalk graphic on the HUD
1638 void WeaponWheelPulse(); ///< Shows the WeaponWheel on the HUD
1639 bool SetWeaponWheelPic(const int weapon, const kStr&in imagePath);
1640 bool ClearWeaponWheelPic(const int weapon);
1641 void SetLivesPic(const kStr&in imagePath);
1643 void SetLifeForcePic(const kStr&in imagePath);
1645 void MessageBox(const kStr&in msg1, const kStr&in msg2);
1646
1647 /**
1648 * @brief
1649 * @param msg1 top line
1650 * @param msg2 bottom line
1651 @code{.cpp}
1652 // Usage:
1653 Game.ConfirmMenu("Confirm This", "Is that correct?");
1654
1655 // Then check for result on Tick:
1656
1657 int result;
1658 GameVariables.GetInt("ConfirmMenuResult", result);
1659 switch(result)
1660 {
1661 case 1:
1662 Sys.Print("Selected No");
1663 GameVariables.SetValue("ConfirmMenuResult", "0");
1664 break;
1665 case 2:
1666 Sys.Print("Selected Yes");
1667 GameVariables.SetValue("ConfirmMenuResult", "0");
1668 break;
1669 default: // There's no ConfirmMenuResult waiting
1670 break;
1671 }
1672 @endcode
1673 */
1674 void ConfirmMenu(const kStr&in msg1, const kStr&in msg2);
1675 void SaveMenu(); ///< Opens the save game menu. Should always check if(PlayLoop.CanOpenSaveMenu())
1676 void LoadMenu(); ///< Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
1677 void SetDamageFlash(); ///< Shows the damage screen flash
1678 void SetPickupFlash(); ///< Shows the pickup screen flash
1679 void SetArmorFlash(); ///< Shows the armor damage screen flash
1680 const uint ConButtons(); ///< EnumPlayerConButtons
1681 uint MenuButtons(void) ///< EnumGameButtonEvents
1682 const int64 GetTimestamp();
1683 void GetDateAndTime(int&out seconds, int&out minutes, int&out hours, int&out day, int&out month, int&out year, kStr&out text);
1686
1687 /**
1688 * @brief add custom text to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
1689 * if the id already exists then simply sets all its variables.
1690 * @param font EnumGameFontType
1691 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
1692 */
1693 void AddText(const int id, const int font, const kStr &in text, const float x, const float y,
1694 const int edge = 0, const float scale = 1.0f, const bool center = false, const bool shadow = false,
1695 const int r = 255, const int g = 255, const int b = 255, const int a = 255,
1696 const int r2 = 255, const int g2 = 255, const int b2 = 255, const int a2 = 255);
1697 bool SetTextMsg(const int id, const kStr &in text);
1698 bool SetTextOrigin(const int id, const float x, const float y);
1699 bool SetTextColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
1700 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);
1701
1702 /**
1703 * @brief Set the text scale, font, edge, center, shadow
1704 * @param font EnumGameFontType
1705 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
1706 */
1707 bool SetTextProps(const int id, const float scale, const int font = 0, const int edge = 0, const bool center = false, const bool shadow = false);
1708 bool RemoveText(const int id);
1710 void GetTextSize(const kStr &in text, const int font, const float scale, float &out width, float &out height); ///< EnumGameFontType
1711 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".
1712
1713 /**
1714 * @brief add custom image to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
1715 * if the id already exists then simply sets all its variables.
1716 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
1717 */
1718 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,
1719 const float s1 = 0.0f, const float t1 = 0.0f, const float s2 = 1.0f, const float t2 = 1.0f,
1720 const int r = 255, const int g = 255, const int b = 255, const int a = 255);
1721 bool SetPicTex(const int id, const kStr &in path);
1722 bool SetPicOrigin(const int id, const float x, const float y);
1723 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)
1724 bool SetPicAngle(const int id, const float angle); ///< in rads
1725 bool SetPicWH(const int id, const float w, const float h);
1726 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);
1727 bool SetPicColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
1728 bool RemovePic(const int id);
1729 void ClearPics(const bool clearImageCache = false);
1730 bool& HideHealth(); ///< Hide health display on the HUD
1731 bool& HideAmmo(); ///< Hide ammo display on the HUD
1732 bool& HideLifeForces(); ///< Hide LifeForces display on the HUD
1733 bool& HideRunWalk(); ///< Hide RunWalk display on the HUD
1734 bool& HideLives(); ///< Hide Lives display on the HUD
1735 bool& HideBossBar(); ///< Hide BossBar display on the HUD
1736 bool& HideAirBar(); ///< Hide AirBar display on the HUD
1737 bool& HideWeaponWheel(); ///< Hide WeaponWheel display on the HUD
1738 bool& HideCrosshair(); ///< Hide Crosshair display on the HUD
1739 bool& HideHelpMessages(); ///< Hide HelpMessages display on the HUD
1740 bool& HideMessages(); ///< Hide Messages display on the HUD
1741 bool& HideTimers(); ///< Hide Timers display on the HUD
1742 const float GetExtraZFar();
1743 void SetExtraZFar(const float zfar); ///< affects actors, ai, particles, fog and underwater. (works normally unlike the cvar r_zfarextent)
1744 const float ShakeIntensity();
1745 kVec3 WorldToHUDPoint(const kVec3&in origin);
1746 bool SphereInView(const kVec3&in origin, const float radius);
1747 bool BoxInView(const kVec3&in min, const kVec3&in max);
1748 const float ViewZFar();
1749 void SaveModFile(const kStr&in filename); ///< make sure to call GameModFileData.Empty() before adding key/values to save
1750 bool LoadModFile(const kStr&in filename); ///< make sure to call GameModFileData.Empty() after you're done loading
1751 bool LoadModDataFile(const kStr&in filename); ///< Returns false if couldn't load file. Clears and Sets GameModFileData with the contents of the loaded file.
1752 void SetNoModSelect(const bool bToggle = true); ///< Disable the mod select menu when selecting new game for workshop mods only. (seta g_nomodselect "1")
1753 void PlayMovie(const kStr&in filename, const bool skippable = true); ///< Only .ogv files (replaces/adds .ogv extension to filename). Can not read from kpfs.
1754
1755 /**
1756 * @brief Returns the key bind name of action. Returns empty string if nothing is bound.
1757 * @param action EnumInputActions
1758 * @param first if is false returns a string of all the bound keys separated by the ; character.
1759 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
1760 */
1761 kStr GetActionBind(const int action, const bool first = true, const bool sort = true);
1762
1763 /**
1764 * @brief Returns the key bind name of the console command. Returns empty string if nothing is bound.
1765 * @param command the name of the console command.
1766 @code{.cpp}
1767 "weapon 0" to "weapon 13"
1768 "automap"
1769 "changeammotype"
1770 "runwalktoggle"
1771 "menu_up"
1772 "menu_down"
1773 "menu_left"
1774 "menu_right"
1775 "*menu_select"
1776 "menu_back"
1777 "menu_cancel"
1778 "menu_activate"
1779 @endcode
1780 * @param first if is false returns a string of all the bound keys separated by the ; character.
1781 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
1782 */
1783 kStr GetCommandBind(const kStr&in command, const bool first = true, const bool sort = true);
1784 bool IsJoystickActive(); ///< if true the players last input was from a controller.
1785 kStr GetInputImagePath(const kStr&in bindName);
1786 bool InputImageExists(const kStr&in path);
1787 void SetCursorHotPos(int x, int y); ///< change the mouses cursors click point (default is 0, 0)
1788 void SetModBindings(const bool show = true); ///< Shows custom mod bindings in menu Bindings > Actions
1789 kStr PlayerName(); ///< Returns "Player" if could not get name
1790 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.
1791 const bool IsActorPersistentMarked(const int actorIndex, const int hubID = -1, const int mapNum = 0); ///< an invalid hub or map uses current maps persistent data.
1793 void SetPreventOpenPauseMenu(const bool value);
1794 void ShowPauseMenu(); ///< Should always check if(PlayLoop.CanOpenPauseMenu())
1795 void OverrideSkyHeight(const float height); ///< Set to 0 to stop overriding
1796 const int BossDamageScaler(const int difficulty, const int damage);
1797 int PurgeUnusedModels(); ///< Returns number of models freed
1802 void SetWorldSunLightColor(const float r, const float g, const float b);
1803 void SetWorldSunAmbientColor(const float r, const float g, const float b);
1804 void SetWorldSunDirection(const float x, const float y, const float z);
1805 bool IsWorkshop(); ///< Returns true if game was run through the steam workshop (ran with command arg -workshop)
1806 void OverridePerPolyCollision(const int value); ///< 0=none, 1=force disable, 2=force enable
1807 void DisableLegalText(); ///< Removes the text at the bottom of the title screen
1808 void OverrideFogType(const int value); ///< 0=none, 1=force Radial, 2=force Plane
1809 void ClearInterpolationOnGameObjects(); ///< Clears Interpolation on all gameobjects and the camera if it's active
1810 void ShowDummyMenu(void); ///< Actors OnMenuTick function will now be processed. Call ClearDummyMenu to close the dummy menu.
1811 void ClearDummyMenu(bool bClearAll = false);
1812 void ToggleCursor(bool b = false);
1813};
1814
1816{
1817public:
1818 const uint16 Buttons() const; ///< returns EnumPlayerButtons
1819 uint ButtonHeldTime(const int btn); ///< btn type is EnumInputActions
1821 void ConsumeAmmo(const int ammo, const bool preferredAmmo = true);
1822 void ConsumeAltAmmo(const int ammo);
1823 const int GetAmmo(const int weaponID) const;
1824 const int GetAltAmmo(const int weaponID) const;
1825 const bool HasAmmo(const int weaponID, const bool checkAlt = true) const; ///< if checkAlt is false only checks primary ammo
1826 const bool HasAltAmmo(const int weaponID) const;
1827 const bool HasAltAmmo() const;
1828 const bool HasWeapon(const int weaponID) const;
1829 bool& UseAltAmmo();
1830 const int CurrentWeapon() const;
1831 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.
1832 bool RemoveWeapon(const int weapon);
1833 void Lock();
1834 void Unlock();
1835 int16& Armor();
1836 void Victory(const int warpActorID = - 1, const int mapID = - 1);
1837 const bool Locked() const;
1838 const int Lives() const;
1839 void SetLives(const int amount);
1840 const int LifeForces();
1841 void SetLifeForces(const int amount);
1842 bool& Backpack();
1843 bool& RunWalkToggle(); ///< if true walking is enabled. (saves)
1844 bool& NoLandClearVel(); ///< if true, when doing a hard landing you will not lose your velocity (saves)
1845 bool &NoWeaponSwitchOnWaterLand(); ///< will not auto switch weapon when entering/exiting water. (saves)
1846 bool GiveAmmo(const int weapon, const int amount, const bool altAmmo); ///< set amount to negative values to take ammo
1847 const int CurrentCheckPoint(); ///< returns warpTID
1849 void SetCheckPoint(const int warpTID, const int map);
1850 const kVec3 GetButtonAngles() const;
1852 const bool WeaponUsingAltAmmo(const int weapon) const;
1853 const bool SetWeaponUseAltAmmo(const int weapon, const bool bToggle);
1854 const bool WeaponAllowUnderwater(const int weapon) const;
1855 void ChangeWeapon(const int weapon);
1856 const int PendingWeapon() const;
1857 void CycleNextWeapon(const bool bCheckAmmo = false);
1858 void CyclePrevWeapon(const bool bCheckAmmo = false);
1859 kWeapon@ GetWeaponActor(const int weapon);
1860 int16& MaxHealth(); ///< should be >= MaxExtraHealth and ExtraHealth
1861 int16& MaxExtraHealth(); ///< should be <= MaxHealth
1862 int16& ExtraHealth(); ///< should be <= MaxExtraHealth
1863 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.
1864 void CancelSpiritualTime(float blendTime = 1.0f); ///< if in spirit mode then will set gamespeed back to 1.0f using the passed in blendTime
1865 void SetSpiritualTime(const float time, const float blend); ///< time = time until cancels the effect. Should SetGameSpeed after calling this.
1866 const float GetSpiritualTime() const;
1867 const int GetWeaponGroup(const int weapon);
1868
1869 /**
1870 * @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.
1871 * 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"
1872 */
1873 void SetWeaponGroup(const int weapon, const int group);
1874 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.
1875 float &LookSensScale(); ///< Scales mouse/controller/gyro sensitivity (default = 1.0f)
1876};
1877
1878namespace Math
1879{
1880 float Sin(float f); ///< Returns the sine of angle f in radians
1881 float Cos(float f); ///< Returns the cosine of angle f in radians
1882 float Tan(float f); ///< Returns the tangent of angle f in radians.
1883 float ATan2(float y, float x); ///< Returns the angle in radians whose Tan is y/x
1884 float Fabs(float f); ///< Returns the absolute value of f
1885 float ACos(float f); ///< Returns the arc-cosine of f - the angle in radians whose cosine is f
1886 float Sqrt(float f); ///< Returns square root of f
1887 int Abs(int i); ///< Returns the absolute value of i.
1888 float Ceil(float f); ///< Returns the smallest integer greater to or equal to f
1889 float Floor(float f); ///< Returns the largest integer smaller to or equal to f
1890 float Log(float f); ///< Returns the natural (base e) logarithm of a specified number
1891 float Pow(float x, float y); ///< Returns f raised to power p
1892 float Deg2Rad(float degs); ///< Degrees-to-radians conversion
1893 float Rad2Deg(float rads); ///< Radians-to-Degrees conversion
1894 float InvSqrt(float f); ///< Returns inverse square root of f
1895 float IncMax(const float val, const float inc, const float dest); ///< returns val +(or minus) inc and never goes above or below dest value
1896 int SysRand(); ///< Range 0..32767
1897 int Rand(); ///< Range 0..32767
1898 uint8 RandByte(); ///< Range 0..255
1899 int RandMax(const int max); ///< Range 0..max-1
1900 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]
1901 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.
1902 float RandFloat(); ///< Range 0..1
1903 float RandCFloat(); ///< Range -1..1
1904 float RandRange(const float min, const float max); ///< Returns a random float number between and min [inclusive] and max [inclusive]
1905 int Clamp(const int i, const int min, const int max); ///< Returns clamped value between min and max
1906 float Clampf(const float f, const float min, const float max); ///< Returns clamped value between min and max
1907 float Lerp(float start, const float end, const float time); ///< Linearly interpolates between start and end by time.
1908 float CosTween(const float t); ///< return (0.5f - (Cos(t * pi) * 0.5f));
1909 float CosArc(const float t); ///< return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
1910 float SmoothStep(const float from, const float to, const float t); ///< Interpolates between min and max with smoothing at the limits.
1911 float HermiteBlend(const float a, const float b, const float t);
1912 float Min(const float a, const float b); ///< Returns the smallest of the two values
1913 float Max(const float a, const float b); ///< Returns the largest of the two values
1914 const int f2i(const float f); ///< IEEE 754 float to int
1915 const float i2f(const int i); ///< int to IEEE 754 float
1916 const float pi = 3.1415927f;
1917 const float tau = 6.2831855f; ///< pi * 2
1918 const kVec3 vecZero(0.0f, 0.0f, 0.0f);
1919}
1920
1921namespace kexColors ///< Not used (garbage included automatically from kexengine)
1922{
1923 const kColor white; ///< 255, 255, 255, 255
1924 const kColor gray; ///< 127, 127, 127, 255
1925 const kColor black; ///< 0, 0, 0, 255
1926 const kColor red; ///< 255, 0, 0, 255
1927 const kColor green; ///< 0, 255, 0, 255
1928 const kColor blue; ///< 0, 0, 255, 255
1929 const kColor yellow; ///< 255, 255, 0, 255
1930 const kColor orange; ///< 255, 127, 0, 255
1931 const kColor cyan; ///< 0, 255, 255, 255
1932 const kColor magenta; ///< 255, 0, 255, 255
1933 const kColor transparent; ///< 0, 0, 0, 0
1954}
1955
1956kColor kexColor_FromHSL(float hue, float sat, float lit); ///< Not used. (garbage from kexengine)
1957kColor kexColor_Random(); ///< Not used. (garbage from kexengine)
1958kColor kexColor_Tab20(uint i); ///< Not used. (garbage from kexengine)
1959kColor kexColor_Tab20Dark(uint i); ///< Not used. (garbage from kexengine)
1960kColor kexColor_Tab20Light(uint i); ///< Not used. (garbage from kexengine)
1961kColor kexColor_ViridisScale(float v); ///< Not used. (garbage from kexengine)
1962kColor kexColor_LerpRGB(const kColor&in from, const kColor&in to, float time); ///< Not used. (garbage from kexengine)
1963int kexRandInt(); ///< Range -2147483648..2147483647
1964uint kexRandUInt() ///< Range 0..4294967295
1965void delay(const float time); ///< used in map scripts to delay execution of script
1966const float GAME_FRAME_TIME = 0.25f;
1967const float GAME_DELTA_TIME = 0.016666668f;
1968const float GAME_FRAME_UNIT = 4.0f;
1969const float GAME_SECONDS = 0.06666667f;
1970const float GAME_SCALE = 10.24f;
1973kDict GameModFileData; ///< Use with Game.SaveModFile and Game.LoadModFile
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
enum EnumPlayerStates AIF_TELEPORTAWAY
playing teleport out animation
enum EnumPlayerStates AIF_DAMAGEPANIC
become aggressive when target is outside its active threshold (good for forcing AI to attack their ta...
enum EnumPlayerStates AIF_REGENANIMDELAY
enum EnumPlayerStates AIF_GOBACKTOLEASH
kSys Sys
EnumGameFontType
@ GFT_BIG
@ GFT_SMALL
@ GFT_NUMBERS
@ GFT_TTF
enum EnumPlayerStates AIF_BLOWNAWAY
being blown away by explosion
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.
enum EnumPlayerStates AIF_FEIGNDEATH
const float GAME_DELTA_TIME
kColor kexColor_Tab20(uint i)
Not used. (garbage from kexengine)
enum EnumPlayerStates AIF_ATTACKING
playing an attacking animation
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)
enum EnumPlayerStates AIF_REGENERATEANIM
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 and Game.LoadModFile.
enum EnumPlayerStates AIF_RESSURECT
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
enum EnumPlayerStates AIF_AWAYFROMLEASH
EnumPlaneSide
@ PSIDE_BACK
@ PSIDE_ON
@ PSIDE_FRONT
enum EnumPlayerStates AIF_TELEPORTIN
playing teleport in animation
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)
enum EnumPlayerStates AIF_FIRSTATTACK
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
@ 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_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
NOT USED. suppose to be: can't be shot at (ignores hitscans)
@ 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.
enum EnumPlayerStates AIF_HEARDQUIETNOISE
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)
enum EnumPlayerStates AIF_WAITFORCYCLE
prevent other animations from interrupting until the current one finishes
enum EnumPlayerStates AIF_RUNNING
Is playing running animation.
EnumPlayerStates
@ PS_SWIMMING
@ PS_JUMPING
@ PS_FALLDEATH
@ PS_CLIMBING
@ PS_UNDERWATER
@ PS_WALKING
@ PS_ANTIGRAVITY
enum EnumPlayerStates AIF_WASSOLID
enum EnumPlayerStates AIF_GETATTENTION
enum EnumPlayerStates AIF_TELEPORTMOVESLOW
chasing while underground
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.
EnumCameraStates
@ CAMS_FADEIN
@ CAMS_RESTORE_TO_CLIENT
@ CAMS_ACTIVE_TO_FADEOUT
@ CAMS_IDLE
@ CAMS_FADEBACK_TO_CLIENT
@ CAMS_ACTIVE
@ CAMS_FADEOUT
kWorld World
enum EnumPlayerStates AIF_NOTHINK
don't run ai logic
enum EnumPlayerStates AIF_HEARDLOUDNOISE
enum EnumPlayerStates AIF_NOCHASE
disable chase logic
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
enum EnumPlayerStates AIF_SEETARGET
kActorFactory ActorFactory
enum EnumPlayerStates AIF_TELEPORTING
in teleport state. ignore all chase logic
uint kexRandUInt() void delay(const float time)
used in map scripts to delay execution of script
enum EnumPlayerStates AIF_REGENERATE
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 & 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
int8 opIndex(const int64 i)
Returns The ASCII code of the character at the strings index.
kStr & opAddAssign(bool b)
kStr opAdd(int64 i) const
kStr(const kStr &in s)
kStr opAdd(bool b) const
int Atoi() const
Converts string to int.
uint64 IndexOf(const kStr &in) const
Reports the zero-based index of the first occurrence of a specified string within this instance....
uint Hash() const
Returns HashID from this instance.
kStr & opAddAssign(const kStr &in s)
kStr & opAssign(const kStr &in 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 Diff(const kQuat &in rot) const
kQuat(float w, kVec3 &in point)
void Clear()
x,y,z = 0.0 w = 1.0
kStr ToString() const
kQuat opSub(const kQuat &in rot)
kQuat & opAssign(const kQuat &in rot)
kQuat(const kQuat &in other)
kQuat & opMulAssign(const kQuat &in rot)
kQuat(float x, float y, float z)
kQuat & Normalize()
kQuat opAdd(const kQuat &in rot)
kQuat opMul(const kQuat &in rot)
kQuat Slerp(const kQuat &in rot, float t) const
kQuat(float x, float y, float z, float w)
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)
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 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)
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 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.
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
const int16 GetOverrideKeyTouchTID()
used only for key pickups
bool & NoKnockBack()
Will not receive knock back movement from things like the alien weapon for example.
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)
void SpawnFx(const kStr &in fxPath, const kVec3 &in pos, const kQuat &in rot)
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, will also set the sector and optionally clear interpolation
kAngle & Roll()
const bool InWater() const
float & Height()
float & Gravity()
float & FloorHeight()
void SetSector(const uint sectorIndex)
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
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)
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 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()
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 contained inside a bounds....
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 uint SpawnFlags2() const
EnumActorSpawnFlags2.
const kAngle & PrevLerpYaw(void) const
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)
void SpawnFx(const kStr &in fxPath, const kVec3 &in pos)
kVec3 & Origin()
Position in world space.
const float GetSkyHeight() const
int & Type()
The actors Type ID.
kAnimState & AnimState()
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...
const uint SpawnFlags1() const
EnumActorSpawnFlags1.
float GetTurnYaw(const kVec3 &in lookAtLocation) const
void AddCustomRef(void)
Keeps the actor from getting freed from memory.
void SpawnProjectile(const kStr &in fxPath, const kVec3 &in pos, const kVec3 &in targetLocation, const float maxAngle)
bool HasCustomRef(void) const
kQuat & Rotation()
float & CeilingHeight()
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.
void 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.
kPlayer & Owner()
int & State()
EnumWeaponStates.
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
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
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
kAngle & CustomViewPitch()
void SetGroundBackwardSpeed(const float speed)
default = -10.24f
void SetOverrideWalkRun(const int value)
0=none(default), 1=Force Disable Walk
void SetSwimForwardAccel(const float accel)
default = 0.05f
const float GroundDeaccel() const
default = 0.5f
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
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
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 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
bool & NoWallJump(void)
default = false
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 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
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 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.
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
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 GetAreaFloorImpact(const int areaID) const
EnumImpactType.
const int GetNumSectors() 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 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 ChangeAreaArg(const int areaID, const int arg, const int16 value)
void ChangeSectorCeilingHeight(const int sectorIndex, const float height)
Changes all sectors ceiling vertices with the same areaID to the height.
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.
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)
const int GetAreaWallImpact(const int areaID) const
EnumImpactType.
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.
void ChangeSectorHeight(const int sectorIndex, const float height)
Changes all sectors floor vertices with the same areaID to the height.
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 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...
const int GetCurrentMapID()
void StopTactile(int vibHandle)
void CenterMouse()
void SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in origin, const kQuat &in rotation)
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 LifeForcePulse()
Shows the LifeForces on the HUD.
void KillAllFx()
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.
void SetPreventOpenPauseMenu(const bool value)
bool SetPicColor(const int id, const int r=255, const int g=255, const int b=255, const int a=255)
void SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in origin, const float yaw, const float pitch)
void HaltMapScript(const int scriptID)
bool IsTactilePlaying(int vibHandle, const kStr &in path)
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 PlayMovie(const kStr &in filename, const bool skippable=true)
Only .ogv files (replaces/adds .ogv extension to filename). Can not read from kpfs.
int PlayTactile(const kStr &in path, int channel, int pos)
Start controller vibration from tactile sound file. Returns a handle.
bool SetPicUV(const int id, const float s1=0.0f, const float t1=0.0f, const float s2=1.0f, const float t2=1.0f)
bool & HideAmmo()
Hide ammo display on the HUD.
float GetHUDOffset(const bool user=false)
if user is false will return the width to the edge of the screen (negative value)....
void ShowPauseMenu()
Should always check if(PlayLoop.CanOpenPauseMenu())
void AutomapDeactive(const bool toggle)
permanently deactivates the automap.
bool GetHubKeyInfo(const uint hubID, int &out nKeys, int &out remainingKeys, int &out keyBits)
bool IsTactilePlaying(int vibHandle)
void SetCursorHotPos(int x, int y)
change the mouses cursors click point (default is 0, 0)
bool & HideCrosshair()
Hide Crosshair display on the HUD.
void 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)
void SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in velocity, const kVec3 &in origin, const kQuat &in rotation)
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.
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)
make sure to call GameModFileData.Empty() after you're done loading
void StopAllTactile()
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
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"....
bool InputImageExists(const kStr &in path)
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.
bool & HideBossBar()
Hide BossBar display on the HUD.
void SaveModFile(const kStr &in filename)
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.
const bool AutomapDeactived()
void SetWorldSunLightColor(const float r, const float g, const float b)
void PlaySound(const kStr &in path)
bool MusicIsPlaying()
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()
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
bool SetTextOrigin(const int id, const float x, const float y)
bool & HideWeaponWheel()
Hide WeaponWheel display on the HUD.
void SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in origin, const float yaw, const float pitch)
void SetDamageFlash()
Shows the damage screen flash.
void SetWorldSunAmbientColor(const float r, const float g, const float b)
const uint ConButtons()
EnumPlayerConButtons.
kVec3 GetWorldSunAmbientColor()
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)
void SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in origin, const kQuat &in rotation)
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 SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in velocity, const kVec3 &in origin, const kQuat &in rotation)
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)
void LoadMenu()
Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
bool & HideTimers()
Hide Timers display on the HUD.
void ResumeMusic()
void ClearLifeForcePic()
const bool GetPreventOpenPauseMenu()
void ChangeMap(const kStr &in path)
bool RemovePic(const int id)
kVec3 GetWorldSunDirection()
void CallMapScript(const int scriptID, kActor@ instigator)
Use to call map script right away.
bool & HideAirBar()
Hide AirBar display on the HUD.
void WeaponWheelPulse()
Shows the WeaponWheel on the HUD.
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)
void RemoveTimer()
bool & HideLifeForces()
Hide LifeForces display on the HUD.
void SetArmorFlash()
Shows the armor damage screen flash.
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)
Returns false if couldn't load file. Clears and Sets GameModFileData with the contents of the loaded ...
bool & HideHelpMessages()
Hide HelpMessages display on the HUD.
kVec3 WorldToHUDPoint(const kVec3 &in origin)
void OverrideSkyHeight(const float height)
Set to 0 to stop overriding.
bool & HideRunWalk()
Hide RunWalk display on the HUD.
void SpawnFx(const kStr &in fxPath, const kVec3 &in origin, const int sectorIndex)
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.
const float ViewZFar()
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 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)