summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2People.h
blob: 74c63d097263e9b0ee9f02d7b724ab0cd23f708f (plain)
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
#pragma once
#include "common.h"
#include "CLink.h"
#include "T2Matter.h"
#include "T2PeopleType.h"

enum {
    kSpecialFlag1 = 1,
    kSpecialFlag2 = 2, // needs to use the toilet
    kSpecialFlag4 = 4,
    kSpecialFlag8 = 8,
    kSpecialFlag10 = 0x10,
    kSpecialFlag20 = 0x20,
    kSpecialFlag40 = 0x40,
    kSpecialFlag80 = 0x80,
};

enum {
	kPeopleStyle0 = 0,
	kPeopleStyle1 = 1,
	kPeopleStyle2 = 2,
	kMaxPeopleStyle = 2
};

class AFX_CLASS_EXPORT T2People : public CLink, public T2Matter {
public:
	T2People();
	virtual ~T2People();
	virtual void SetUsed(BOOL);
	virtual unsigned int Idle(T2TowerDoc*);
	virtual void SetFavorite(BOOL);
	virtual void Draw(T2TowerDoc*, const RECT&);
	virtual T2InfoDialog* ShowInfoDialog(T2TowerDoc*);
	virtual void DrawHitMask(T2TowerDoc*);
	virtual BOOL GetSilhouetteRect(RECT&);

	void Initialize(T2PeopleDef*, T2PeopleType*);
	BOOL IsMale() const;
	BOOL IsGeneral() const;
	BOOL IsSpecialColor() const;
	void ChangeStyle(int);
	int GetWidth() const;
	int GetRouteType();
	BOOL CalcWaitPersonArea(T2FloorInfo*, RECT&);
	void CalcWalkingSilhouetteArea(RECT&) const;
	unsigned int GetCurTenantID() const;
	void GoOutTower(T2TowerDoc*);
	void IdleSearchedPerson(T2TowerDoc*);
	void ChangeStatus(int);
	void ChangeWalkStyle(int);
	void SetAnimePattern(int fillerStart, int fillerRange, int hStart, int hRange);
	BOOL StopOnHisWay(T2TenantMemberDef* tenantMemberDef, int econoType, int score, RECT rect, int bindTime, int tenantType, int tenantID, int startTime);
	BOOL CalledInTenant(T2TenantMemberDef* tenantMemberDef, int econoType, int bindTime, int tenantType, unsigned int tenantID, unsigned int startTime);
	BOOL IsGoToPool() const;
	void Return();
	void SetDestinationToOutOfTower(T2TowerDoc*);
	void ChangeDestination(unsigned int tenantID, unsigned int startTime = 0);
	int CalcCurrEstimate() const;
	void IncEstimate(int);
	void UpdateEstimation();
	int GetAverageStress() const;
	BOOL IncStress(int);
	BOOL IsVIP() const;
	BOOL IsNamed() const;
	void SetColor(int);
	void ClearColor();
	BOOL VIPEstimation();
	BOOL SearchToilet(T2TowerDoc*);
	void DrawSearchedPerson(T2TowerDoc*);
	void Draw(T2BitImage*, const RECT&);
	void Draw(T2TowerDoc*, T2Equip*);
	void DrawAt(T2TowerDoc*, T2Equip*, POINT);
	void Duplicate(T2TowerDoc*);
	void Remove(T2TowerDoc*, unsigned int);
	void TenantRemoved(unsigned int);
	void Interview(T2TowerDoc*);
	BOOL GetInterviewWords(T2TowerDoc*, CString&);
	BOOL IsMaru() const;
	BOOL IsReggae() const;
	void BreakoutEmergency(T2TowerDoc*);
	void ResolveLink(T2PeopleArrayList*);
	void GetName(CString&);
	void ClearSpecialFlag(unsigned int);
	void SetSpecialFlag(unsigned int);

	unsigned int GetPeopleID() { return GetMatterID(); }
	T2PeopleType* GetPeopleType() const { return mPeopleType; }
	unsigned int GetEconoType() { return mPeopleType->GetEconoType(); }
	BOOL IsFatSilhouette() const { return (mAttribute & 2) != 0; }
	BOOL IsInTower() const {
		return (mStatus != kStatus1) && (mStatus != kStatus16) && (mStatus != kStatus0);
	}
	int GetColor() const { return mColor; }
	BOOL IsSetSpecialFlag(unsigned int flag) const { return (mSpecialFlag & flag) == flag; }
	void SetToSleep() { mFiller = -1; }
	BOOL IsSleep() const { return (mFiller == -1); }
	BOOL IsWalk() const { return mWalk || IsSetSpecialFlag(kSpecialFlag20); }
	void SetWalk(BOOL v) { mWalk = v; }
	void SetFiller(int v) { mFiller = v; }
	void SetStyle(int v) { mStyle = v; }
	int GetStyle() const { return mStyle; }
	void SetSilhouetteDef(int i, T2SilhouetteDef* def) { mSilhouetteDef[i] = def; }
	void SetPeopleType(T2PeopleType* type) { *mPeopleType = *type; }
	void SetPrevTenantType(int v) { mPrevTenantType = v; }
	int GetPrevTenantType() const { return mPrevTenantType; }
	void InitStress() { mStress = 0; }
	int GetStress() const { return mStress; }
	int GetEstimate() const { return mEstimate; }
	unsigned int GetAge() const;
	unsigned int GetSex() const;

protected:
	virtual void LoadSelf(T2Archive&, T2TowerDoc*);
	virtual void SaveSelf(T2Archive&);

	void IdleWaitMover(T2TowerDoc*);
	void MoveToTowerEntrance(T2TowerDoc*);
	void MoveToLobby(T2TowerDoc*);
	BOOL MoveToParking(T2TowerDoc*);
	BOOL MoveToSubway(T2TowerDoc*);
	BOOL MoveToShip(T2TowerDoc*);
	void MoveByEStair(T2TowerDoc*);
	void SolveNoRoute(T2TowerDoc*);
	BOOL FindRoute(T2TowerDoc*);
	void JumpToDestination(T2TowerDoc*);
	BOOL WalkSearchedPersonRight(T2TowerDoc*);
	BOOL WalkSearchedPersonLeft(T2TowerDoc*);
	BOOL IsReachDestination(int y);
	BOOL IsRegistRequest(T2TowerDoc*);
	void ChangeSilhouette();
	void SetSilhouette();
	int CalcFreeTime(unsigned int);
	BOOL StressChanged();

	friend class T2ElevatorModule;
	friend class T2FireBurning;
	friend class T2Guardman;
	friend class T2Maru_Reggae;
    friend class T2MoverModule;
    friend class T2PeopleArray;
	friend class T2SilhouettePane;
	friend class T2StairModule;
	friend class T2Tenant;
	friend class T2VisitVIP;

	unsigned int mAttribute;
	int mColor;
	int mFiller;
	int mPrevTenantType;
	int m70;
	BOOL mWalk;
	unsigned int mSpecialFlag;
	int mStress;
	int m80;
	int mEstimate;
	T2PeopleType *mPeopleType;
	int mStyle;
	T2SilhouetteDef *mSilhouetteDef[3];

private:
	void Initialize();
};

inline unsigned int T2People::GetAge() const {
    unsigned int age = 0;
    if (mPeopleType)
        age = mPeopleType->GetAge();
    return age;
}
inline unsigned int T2People::GetSex() const {
    unsigned int sex = 1;
    if (mPeopleType)
        sex = !mPeopleType->IsMale();
    return sex;
}