aboutsummaryrefslogtreecommitdiff
path: root/actor.h
blob: 8453c0488ee423457191f4b640386e7ebcdafef1 (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
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 * Copyright (C) 2001/2002 The ScummVM project
 *
 * This program 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 2
 * of the License, or (at your option) any later version.

 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header$
 *
 */


#ifndef ACTOR_H
#define ACTOR_H

#include "scummsys.h"

class Scumm;

struct ActorWalkData {
	int16 destx,desty;			// Final destination
	byte destbox;
	int16 destdir;
	byte curbox;
	int16 x,y;					// Current position
	int16 newx,newy;			// Next position on our way to the destination
	int32 XYFactor, YXFactor;
	uint16 xfrac,yfrac;
	int point3x, point3y;
};

struct CostumeData {
	byte active[16];
	uint16 animCounter1;
	byte animCounter2;
	uint16 stopped;
	uint16 curpos[16];
	uint16 start[16];
	uint16 end[16];
	uint16 frame[16];
};

class Actor {

//protected:
public:
	int x, y, top, bottom;
	int elevation;
	uint width;
	byte number;
	uint16 facing;
	uint16 costume;
	byte room;
	byte talkColor;
	byte scalex,scaley;
	byte charset;
	int16 newDirection;
	byte moving;
	byte ignoreBoxes;
	byte forceClip;
	byte initFrame, walkFrame, standFrame, talkFrame1, talkFrame2;
	bool needRedraw, needBgReset, costumeNeedsInit, visible;
	byte shadow_mode;
	bool flip;
	uint speedx,speedy;
	byte frame;
	byte walkbox;
	byte mask;
	byte animProgress, animSpeed;
	int16 new_1,new_2;
	uint16 talk_script, walk_script;
	byte new_3;
	int8 layer;
	ActorWalkData walkdata;
	int16 animVariable[16];
	uint16 sound[8];
	CostumeData cost;
	byte palette[64];

protected:
	Scumm	*_scumm;

public:

	// Constructor
	Actor(Scumm *scumm) : _scumm(scumm) {}

//protected:
	void hideActor();
	void showActor();

	void initActor(int mode);
	void setActorWalkSpeed(uint newSpeedX, uint newSpeedY);
	int calcMovementFactor(int newx, int newy);
	int actorWalkStep();
	int remapDirection(int dir);
	void setupActorScale();
	void stopActorMoving();
	void startWalkAnim(int cmd, int angle);
	void startAnimActor(int frame);
	void setActorBox(int box);

	int updateActorDirection();
	void setActorDirection(int direction);

	void adjustActorPos();	
	void turnToDirection(int newdir);
	void walkActor();
	void setActorCostume(int c);
	byte *getActorName();
	void startWalkActor(int x, int y, int dir);
	
	void remapActor(int b, int c, int d, int e);
	void walkActorOld();
};

#endif