forked from EasyRPG/Player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_character.h
1377 lines (1130 loc) · 30.5 KB
/
game_character.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Player is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EP_GAME_CHARACTER_H
#define EP_GAME_CHARACTER_H
// Headers
#include <cstdint>
#include <string>
#include <unordered_set>
#include "color.h"
#include "flash.h"
#include <lcf/rpg/moveroute.h>
#include <lcf/rpg/eventpage.h>
#include <lcf/rpg/savemapeventbase.h>
#include "drawable.h"
#include "utils.h"
/**
* Game_Character class.
*/
class Game_Character {
public:
using AnimType = lcf::rpg::EventPage::AnimType;
enum Type {
Event,
Player,
Vehicle
};
static StringView TypeToStr(Type t);
/**
* Destructor.
*/
virtual ~Game_Character();
/** @return the type of character this is */
Type GetType() const;
/**
* Gets x position in tiles.
*
* @return x position.
*/
int GetX() const;
/**
* Sets x position in tiles.
*
* @param new_x new x position.
*/
void SetX(int new_x);
/**
* Gets y position in tiles.
*
* @return y position.
*/
int GetY() const;
/**
* Sets y position in tiles.
*
* @param new_y new y position.
*/
void SetY(int new_y);
/**
* Gets the map id the character was inititialy on.
*
* @return map id.
*/
int GetMapId() const;
/**
* Sets the map id the character was inititialy on.
*
* @param new_map_id New map id of character.
*/
void SetMapId(int new_map_id);
/**
* Gets character's movement direction.
*
* @return current front direction.
*/
int GetDirection() const;
/**
* Sets character's movement direction.
*
* @param new_direction New current front direction.
*/
void SetDirection(int new_direction);
/**
* Gets character's visible facing direction.
*
* @return direction of the sprite.
*/
int GetFacing() const;
/**
* Sets character's visible facing direction.
*
* @param new_facing New facing direction.
*/
void SetFacing(int new_facing);
/**
* Gets whether facing is locked.
*
* @return facing locked
*/
bool IsFacingLocked() const;
/**
* Enables or disables locked facing direction.
*
* @param locked true: locked, false: unlocked.
*/
void SetFacingLocked(bool locked);
/**
* Gets the event layer (top, same, below).
*
* @return event layer
*/
int GetLayer() const;
/**
* Sets the event layer (top, same, below).
*
* @param new_layer New event layer
*/
void SetLayer(int new_layer);
/**
* Gets whether other events can be in the same tile.
*
* @return whether event overlap is forbidden.
*/
bool IsOverlapForbidden() const;
/**
* Gets character movement speed.
*
* @return character movement speed
*/
int GetMoveSpeed() const;
/**
* Sets character movement speed.
*
* @param speed new movement speed
*/
void SetMoveSpeed(int speed);
/**
* Gets character movement frequency.
*
* @return character movement frequency
*/
int GetMoveFrequency() const;
/**
* Sets character movement frequency.
*
* @param frequency new character movement frequency
*/
void SetMoveFrequency(int frequency);
/**
* Returns the custom move route assigned via a MoveEvent.
*
* @return custom move route
*/
const lcf::rpg::MoveRoute& GetMoveRoute() const;
/**
* Sets a new custom move route. Used to assign a new MoveEvent.
*
* @param move_route new custom move route
*/
void SetMoveRoute(const lcf::rpg::MoveRoute& move_route);
/**
* Returns current index of the route assigned via a MoveEvent.
*
* @return current move route index
*/
int GetMoveRouteIndex() const;
/**
* Sets current index of a MoveEvent move route.
*
* @param new_index New custom move route index
*/
void SetMoveRouteIndex(int new_index);
/**
* Gets whether move route is overwritten by event.
*
* @return move route overwritten
*/
bool IsMoveRouteOverwritten() const;
/**
* Enables/Disables overwriting of move routes.
*
* @param force true: Use default move scheme, false: Use custom move route
*/
void SetMoveRouteOverwritten(bool force);
/**
* Checks if the forced move route has finished (repeated at least once).
*
* @return whether forced move route has finished.
*/
bool IsMoveRouteFinished() const;
/**
* Marks the forced move route as finished (repeated at least once) or not finished.
*
* @param finished true: forced move route finished, false: not finished
*/
void SetMoveRouteFinished(bool finished);
/**
* Gets sprite name. Usually the name of the graphic file.
*
* @return sprite name
*/
const std::string& GetSpriteName() const;
/** @return true if this has a tile sprite */
bool HasTileSprite() const;
/**
* Sets sprite name. Usually the name of the graphic file.
*
* @param sprite_name new sprite name
* @param index the index of the new sprite.
*/
void SetSpriteGraphic(std::string sprite_name, int index);
/**
* Sets sprite name from a move route command. Usually the name of the graphic file.
* This can be overridden to change behavior by child classes.
*
* @param sprite_name new sprite name
* @param index the index of the new sprite.
*/
virtual void MoveRouteSetSpriteGraphic(std::string sprite_name, int index);
/**
* Gets sprite index of character.
*
* @return sprite index
*/
int GetSpriteIndex() const;
/**
* Gets animation frame of character.
*
* @return anim_frame
*/
int GetAnimFrame() const;
/**
* Sets animation frame of character.
*
* @param frame new anim_frame
*/
void SetAnimFrame(int frame);
/**
* @return true if animation is paused.
*/
bool IsAnimPaused() const;
/**
* Sets whether animation is paused.
*
* @param value whether to pause the animation.
*/
void SetAnimPaused(bool value);
/**
* Updates the sprite facing direction based on current direction
*/
void UpdateFacing();
/**
* Begins a flash.
*
* @param r red color
* @param g blue color
* @param b green color
* @param power power of the flash
* @param frames Duration of the flash in frames
*/
void Flash(int r, int g, int b, int power, int frames);
/**
* Gets flash effect color.
*
* @return flash color
*/
Color GetFlashColor() const;
/**
* Returns intensity of flash effect.
*
* @return flash intensity
*/
double GetFlashLevel() const;
/**
* Sets intensity of flash effect.
*
* @param flash_level new flash intensity
*/
void SetFlashLevel(double flash_level);
/**
* Returns how many flash effect time is left.
*
* @return time left
*/
int GetFlashTimeLeft() const;
/**
* Set how long the flash effect will take.
*
* @param time_left flash duration
*/
void SetFlashTimeLeft(int time_left);
/**
* Gets the through flag (walk through everything)
*
* @return through flag
*/
bool GetThrough() const;
/**
* Sets the through flag (walk through everything)
*
* @param through through flag
*/
void SetThrough(bool through);
/** Resets the through flag to the move_route_through flag */
void ResetThrough();
/**
* @return stop_count
*/
int GetStopCount() const;
/**
* Sets the stop_count
*
* @param sc the new stop count
*/
void SetStopCount(int sc);
/**
* @return max_stop_count
*/
int GetMaxStopCount() const;
/**
* @return stepping max_stop_count for the given frequency
* @param freq input movement frequency
*/
static constexpr int GetMaxStopCountForStep(int freq);
/**
* @return turning max_stop_count for the given frequency
* @param freq input movement frequency
*/
static constexpr int GetMaxStopCountForTurn(int freq);
/**
* @return waiting max_stop_count for the given frequency
* @param freq input movement frequency
*/
static constexpr int GetMaxStopCountForWait(int freq);
/**
* @return the number of frames for animating steps while not moving
* @param speed the movement speed.
*/
static constexpr int GetStationaryAnimFrames(int speed);
/**
* @return the number of frames for animating steps while moving or continuous.
* @param speed the movement speed.
*/
static constexpr int GetContinuousAnimFrames(int speed);
/**
* @return the number of frames for animating steps while spinning.
* @param speed the movement speed.
*/
static constexpr int GetSpinAnimFrames(int speed);
/**
* Sets the max_stop_count
*
* @param sc the new max stop count
*/
void SetMaxStopCount(int sc);
/** @return true if waiting for stop count in movement to complete */
bool IsStopCountActive() const;
/**
* @return anim_count
*/
int GetAnimCount() const;
/**
* Sets the stop_count
*
* @param ac the new anim count.
*/
void SetAnimCount(int ac);
/** Resets the stepping animation */
void ResetAnimation();
/**
* Gets if character is moving.
*
* @return whether the character is moving.
*/
bool IsMoving() const;
/**
* @return whether the character is jumping.
*/
bool IsJumping() const;
/**
* Set whether the character is jumping.
*
* @param val flag indicating jumping status
*/
void SetJumping(bool val);
/**
* @return X position where jump began.
*/
int GetBeginJumpX() const;
/**
* Set X position where jump began.
*
* @param x x position where jump began
*/
void SetBeginJumpX(int x);
/**
* @return Y position where jump began.
*
* @param y y position where jump began
*/
int GetBeginJumpY() const;
/**
* Set Y position where jump began.
*/
void SetBeginJumpY(int y);
/**
* @return whether the character is flying.
*/
bool IsFlying() const;
/**
* Set whether the character is flying.
*
* @param val whether or not character is flying.
*/
void SetFlying(bool val);
/**
* @return whether the RPG_RT processed flag is set.
*/
bool IsProcessed() const;
/**
* Set the RPG_RT processed flag
*/
void SetProcessed(bool val);
/**
* @return whether the event is paused.
*/
bool IsPaused() const;
/**
* Set the paused flag
*/
void SetPaused(bool val);
/**
* Activates or deactivates the event.
*
* @param active enables or disables the event.
*/
void SetActive(bool active);
/**
* Gets if the event is active.
*
* @return if the event is active (or inactive via EraseEvent-EventCommand).
*/
bool IsActive() const;
/**
* Checks if the character is stopping.
*
* @return whether the character is stopping.
*/
bool IsStopping() const;
/**
* Moves the character to a new location.
*
* @param map_id map id
* @param x tile x.
* @param y tile y.
*/
virtual void MoveTo(int map_id, int x, int y);
/**
* Move in the direction dir.
*
* @param dir the direction to move to.
*
* @return Whether move was successful or a move or jump is already in progress.
* @post If successful, IsStopping() == false.
*/
virtual bool Move(int dir);
/**
* Jump to (x, y)
*
* @param x the x position to jump to.
* @param y the y position to jump to.
*
* @return Whether jump was successful or a move or jump is already in progress.
* @post If successful, IsStopping() == false.
*/
bool Jump(int x, int y);
/**
* Check if this can move to the given tile.
*
* @param from_x Moving from x position
* @param from_y Moving from y position
* @param to_x Moving from x position
* @param to_y Moving from y position
*
* @return true if this can occupy (to_x, to_y) from (from_x, from_y)
*/
virtual bool MakeWay(int from_x, int from_y, int to_x, int to_y);
/**
* Like CheckWay, but allows ignoring all events in the check,
* or only some events specified by event id.
*
* @param from_x See CheckWay.
* @param from_y See CheckWay.
* @param to_x See CheckWay.
* @param to_y See Checkway.
* @param ignore_all_events (Optional) If true, only consider map collision
* and completely ignore any events in the way.
* @param ignore_some_events_by_id (Optional) If specified, all events with
* ids found in this list will be ignored in the collision check.
* @return true See CheckWay.
*/
virtual bool CheckWay(int from_x, int from_y, int to_x, int to_y,
bool ignore_all_events, std::unordered_set<int> *ignore_some_events_by_id);
/** Short version of CheckWay. **/
virtual bool CheckWay(int from_x, int from_y, int to_x, int to_y);
/**
* Turns the character 90 Degree to the left.
*/
void Turn90DegreeLeft();
/**
* Turns the character 90 Degree to the right.
*/
void Turn90DegreeRight();
/**
* Turns the character by 180 degree
*/
void Turn180Degree();
/**
* Turns the character 90 Degree to the left or right
* by using a random number.
*/
void Turn90DegreeLeftOrRight();
/** @return the direction we would need to face the hero. */
int GetDirectionToHero();
/** @return the direction we would need to face away from hero. */
int GetDirectionAwayHero();
/**
* @param dir input direction
*
* @return the direction 90 degrees to the left of dir
*/
static constexpr int GetDirection90DegreeLeft(int dir);
/**
* @param dir input direction
*
* @return the direction 90 degrees to the right of dir
*/
static constexpr int GetDirection90DegreeRight(int dir);
/**
* @param dir input direction
*
* @return the direction 180 degrees to the of dir
*/
static constexpr int GetDirection180Degree(int dir);
/**
* Character looks in a random direction
*/
void TurnRandom();
/**
* Character looks towards the hero.
*/
void TurnTowardHero();
/**
* Character looks away from the hero.
*/
void TurnAwayFromHero();
/**
* Character waits for 20 frames more.
*/
void Wait();
/**
* Forces a new, temporary, move route.
*
* @param new_route new move route.
* @param frequency frequency.
*/
void ForceMoveRoute(const lcf::rpg::MoveRoute& new_route, int frequency);
/**
* Cancels a previous forced move route.
*/
void CancelMoveRoute();
/** @return height of active jump in pixels */
int GetJumpHeight() const;
/**
* Gets sprite x coordinate transformed to screen coordinate in pixels.
*
* @return screen x coordinate in pixels.
*/
virtual int GetScreenX() const;
/**
* Gets sprite y coordinate transformed to screen coordinate in pixels.
*
* @param apply_jump Apply jump height modifier if character is jumping
* @return screen y coordinate in pixels.
*/
virtual int GetScreenY(bool apply_jump = true) const;
/**
* Gets screen z coordinate
*
* @param x_offset Offset to apply to the X coordinate
* @param y_offset Offset to apply to the Y coordinate
* @return screen z coordinate
*/
virtual Drawable::Z_t GetScreenZ(int x_offset, int y_offset) const;
/**
* Gets tile graphic ID.
*
* @return tile graphic ID.
*/
int GetTileId() const;
/**
* Gets sprite x position in pixels.
*
* @return real x.
*/
int GetSpriteX() const;
/**
* Gets sprite y position in pixels.
*
* @return real y.
*/
int GetSpriteY() const;
/**
* Gets remaining step
*
* @return remaining step
*/
int GetRemainingStep() const;
/**
* Sets remaining step
*
* @param step new remaining step count
*/
void SetRemainingStep(int step);
/**
* Gets animation type.
*
* @return animation type.
*/
AnimType GetAnimationType() const;
/**
* Sets animation type.
*
* @param anim_type new animation type.
*/
void SetAnimationType(AnimType anim_type);
int DistanceXfromPlayer() const;
int DistanceYfromPlayer() const;
/**
* Tests if the character is currently on the tile at x/y or moving
* towards it.
*
* @param x X tile position
* @param y Y tile position
* @return If on tile or moving towards
*/
virtual bool IsInPosition(int x, int y) const;
/**
* Gets current opacity of character.
*
* @return opacity (0 = Invisible, 255 = opaque)
*/
int GetOpacity() const;
/**
* @return RPG_RT transparency
*/
int GetTransparency() const;
/**
* Sets transparency of the character.
*
* @param value New transparency (0 = Opaque, 7 = mostly transparent)
*/
void SetTransparency(int value);
/**
* Gets if the character is visible.
*
* @return if visible, when true Opaque value is used
*/
virtual bool IsVisible() const;
/**
* Makes character visible/not visible.
* This has a higher priority then the Opacity setting.
* Needed for the "SetHeroTransparency" command because this can't be
* altered via the "Increase Transparency" move command.
*
* @param hidden true: invisible, false: visible
*/
void SetSpriteHidden(bool hidden);
/** @return true if sprite is hidden */
bool IsSpriteHidden() const;
/**
* Tests if animation type is any fixed state.
*
* @return Whether direction is fixed
*/
static constexpr bool IsDirectionFixedAnimationType(AnimType);
/**
* Tests if the step animation is enabled.
* The animation is enabled when the animation type is not "fixed_graphic" and when
* the animation was not disabled through the move command "stop animation".
*
* @return Wheter animations are enabled.
*/
bool IsAnimated() const;
/**
* Tests if animation type is any continuous state.
*
* @return Whether animation is continuous
*/
bool IsContinuous() const;
/**
* Tests if animation is of the type spin.
*
* @return Whether animation is spin type
*/
bool IsSpinning() const;
/**
* Gets the bush depth of the tile where this character is standing
*
* @return Bush depth at this character's position
*/
int GetBushDepth() const;
enum CharsID {
CharPlayer = 10001,
CharBoat = 10002,
CharShip = 10003,
CharAirship = 10004,
CharThisEvent = 10005
};
enum Direction {
Up = 0,
Right,
Down,
Left,
UpRight,
DownRight,
DownLeft,
UpLeft
};
static bool IsDirectionDiagonal(int d);
/** Reverses a direction, ex: ReverseDir(Up) == Down. */
static int ReverseDir(int dir);
static Game_Character* GetCharacter(int character_id, int event_id);
static constexpr int GetDxFromDirection(int dir);
static constexpr int GetDyFromDirection(int dir);
protected:
explicit Game_Character(Type type, lcf::rpg::SaveMapEventBase* d);
/** Check for and fix incorrect data after loading save game */
void SanitizeData(StringView name);
/** Check for and fix incorrect move route data after loading save game */
void SanitizeMoveRoute(StringView name, const lcf::rpg::MoveRoute& mr, int32_t& idx, StringView chunk_name);
void Update();
virtual void UpdateAnimation();
virtual void UpdateNextMovementAction() = 0;
virtual void UpdateMovement(int amount);
void SetMaxStopCountForStep();
void SetMaxStopCountForTurn();
void SetMaxStopCountForWait();
void UpdateMoveRoute(int32_t& current_index, const lcf::rpg::MoveRoute& current_route, bool is_overwrite);
void IncAnimCount();
void IncAnimFrame();
void UpdateFlash();
bool BeginMoveRouteJump(int32_t& current_index, const lcf::rpg::MoveRoute& current_route);
lcf::rpg::SaveMapEventBase* data();
const lcf::rpg::SaveMapEventBase* data() const;
int original_move_frequency = 2;
// contains if any movement (<= step_forward) of a forced move route was successful
Type _type = {};
lcf::rpg::SaveMapEventBase* _data = nullptr;
};
template <typename T>
class Game_CharacterDataStorage : public Game_Character
{
public:
using Type = Game_Character::Type;
Game_CharacterDataStorage(Type typ);
Game_CharacterDataStorage(const Game_CharacterDataStorage&) = delete;
Game_CharacterDataStorage& operator=(const Game_CharacterDataStorage&) = delete;
Game_CharacterDataStorage(Game_CharacterDataStorage&&) noexcept;
Game_CharacterDataStorage& operator=(Game_CharacterDataStorage&&) noexcept;
~Game_CharacterDataStorage() = default;
T* data();
const T* data() const;
private:
T _data = {};
};
constexpr bool Game_Character::IsDirectionFixedAnimationType(AnimType at) {
return
at == lcf::rpg::EventPage::AnimType_fixed_continuous ||
at == lcf::rpg::EventPage::AnimType_fixed_graphic ||
at == lcf::rpg::EventPage::AnimType_fixed_non_continuous;
}
inline lcf::rpg::SaveMapEventBase* Game_Character::data() {
return _data;
}
inline const lcf::rpg::SaveMapEventBase* Game_Character::data() const {
return _data;
}
inline Game_Character::Type Game_Character::GetType() const {
return _type;
}
inline int Game_Character::GetX() const {
return data()->position_x;
}
inline void Game_Character::SetX(int new_x) {
data()->position_x = new_x;
}
inline int Game_Character::GetY() const {
return data()->position_y;
}
inline void Game_Character::SetY(int new_y) {
data()->position_y = new_y;
}
inline int Game_Character::GetMapId() const {
return data()->map_id;
}
inline void Game_Character::SetMapId(int new_map_id) {
data()->map_id = new_map_id;
}
inline int Game_Character::GetDirection() const {
return data()->direction;
}
inline void Game_Character::SetDirection(int new_direction) {
data()->direction = new_direction;
}
inline int Game_Character::GetFacing() const {
return data()->facing;
}
inline void Game_Character::SetFacing(int new_facing) {
data()->facing = new_facing;
}
inline bool Game_Character::IsFacingLocked() const {
return data()->lock_facing;
}
inline void Game_Character::SetFacingLocked(bool locked) {
data()->lock_facing = locked || IsDirectionFixedAnimationType(GetAnimationType());
}