22#ifndef AGS_SHARED_AC_CHARACTER_INFO_H
23#define AGS_SHARED_AC_CHARACTER_INFO_H
25#include "common/std/vector.h"
26#include "ags/shared/ac/common_defines.h"
27#include "ags/shared/ac/game_version.h"
28#include "ags/shared/core/types.h"
29#include "ags/shared/util/bbop.h"
30#include "ags/shared/util/string.h"
45#define CHF_MANUALSCALING 1
47#define CHF_NOINTERACT 4
48#define CHF_NODIAGONAL 8
49#define CHF_ALWAYSIDLE 0x10
50#define CHF_NOLIGHTING 0x20
51#define CHF_NOTURNING 0x40
52#define CHF_NOWALKBEHINDS 0x80
53#define CHF_FLIPSPRITE 0x100
54#define CHF_NOBLOCKING 0x200
55#define CHF_SCALEMOVESPEED 0x400
56#define CHF_NOBLINKANDTHINK 0x800
57#define CHF_SCALEVOLUME 0x1000
58#define CHF_HASTINT 0x2000
59#define CHF_BEHINDSHEPHERD 0x4000
60#define CHF_AWAITINGMOVE 0x8000
61#define CHF_MOVENOTWALK 0x10000
62#define CHF_ANTIGLIDE 0x20000
63#define CHF_HASLIGHT 0x40000
64#define CHF_TINTLIGHTMASK (CHF_NOLIGHTING | CHF_HASTINT | CHF_HASLIGHT)
66#define OCHF_SPEECHCOL 0xff000000
67#define OCHF_SPEECHCOLSHIFT 24
68#define UNIFORM_WALK_SPEED 0
69#define FOLLOW_ALWAYSONTOP 0x7ffe
72#define CHANIM_MASK 0xFF
74#define CHANIM_REPEAT 0x02
75#define CHANIM_BACKWARDS 0x04
78inline int CharFlagsToObjFlags(
int chflags) {
79 using namespace AGS::Shared;
80 return FlagToFlag(chflags, CHF_NOINTERACT, OBJF_NOINTERACT) |
81 FlagToFlag(chflags, CHF_NOWALKBEHINDS, OBJF_NOWALKBEHINDS) |
82 FlagToFlag(chflags, CHF_HASTINT, OBJF_HASTINT) |
83 FlagToFlag(chflags, CHF_HASLIGHT, OBJF_HASLIGHT) |
85 FlagToNoFlag(chflags, CHF_NOLIGHTING, OBJF_USEREGIONTINTS) |
86 FlagToNoFlag(chflags, CHF_MANUALSCALING, OBJF_USEROOMSCALING) |
87 FlagToNoFlag(chflags, CHF_NOBLOCKING, OBJF_SOLID);
91#define LEGACY_MAX_CHAR_NAME_LEN 40
93enum CharacterSvgVersion {
94 kCharSvgVersion_Initial = 0,
95 kCharSvgVersion_350 = 1,
96 kCharSvgVersion_36025 = 2,
97 kCharSvgVersion_36109 = 3,
98 kCharSvgVersion_36115 = 4,
103struct CharacterInfo2;
105struct CharacterExtras;
127 short idletime, idleleft;
133 short blinkview, blinkinterval;
134 short blinktimer, blinkframe;
139 short speech_anim_speed, idle_anim_speed;
140 short blocking_width, blocking_height;
143 short walkwaitcounter;
144 uint16_t loop, frame;
147 short walkspeed, animspeed;
152 char name[LEGACY_MAX_CHAR_NAME_LEN];
153 char scrname[LEGACY_MAX_SCRIPT_NAME_LEN];
156 int get_effective_y()
const;
157 int get_baseline()
const;
158 int get_blocking_top()
const;
159 int get_blocking_bottom()
const;
162 void get_effective_walkspeeds(
int &walk_speed_x,
int &walk_speed_y)
const {
163 walk_speed_x = walkspeed;
164 walk_speed_y = ((walkspeed_y == UNIFORM_WALK_SPEED) ? walkspeed : walkspeed_y);
167 inline bool has_explicit_light()
const {
168 return (flags & CHF_HASLIGHT) != 0;
170 inline bool has_explicit_tint()
const {
171 return (flags & CHF_HASTINT) != 0;
173 inline bool is_animating()
const {
174 return (animating & CHANIM_ON) != 0;
176 inline int get_anim_repeat()
const {
177 return (animating & CHANIM_REPEAT) ? ANIM_REPEAT : ANIM_ONCE;
179 inline bool get_anim_forwards()
const {
180 return (animating & CHANIM_BACKWARDS) == 0;
182 inline int get_anim_delay()
const {
183 return (animating >> 8) & 0xFF;
185 inline void set_animating(
bool repeat,
bool forwards,
int delay) {
186 animating = CHANIM_ON |
187 (CHANIM_REPEAT * repeat) |
188 (CHANIM_BACKWARDS * !forwards) |
189 ((delay & 0xFF) << 8);
200 void UpdateFollowingExactlyCharacter();
203 void update_character_moving(
int &char_index,
CharacterExtras *chex,
int &doing_nothing);
204 int update_character_animating(
int &char_index,
int &doing_nothing);
206 void update_character_follower(
int &char_index,
std::vector<int> &followingAsSheep,
int &doing_nothing);
216 void FixupCurrentLoopAndFrame();
233#if defined (OBSOLETE)
234struct OldCharacterInfo {
244 short idletime, idleleft;
249 short walking, animating;
250 short walkspeed, animspeed;
258void ConvertOldCharacterToNew(OldCharacterInfo *oci, CharacterInfo *ci);
Definition: character_info.h:226
Definition: character_info.h:117