aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood/klayman.h
blob: 69f9a34dc6e31ebe4302ad5de5edc488ac635127 (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
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef NEVERHOOD_KLAYMAN_H
#define NEVERHOOD_KLAYMAN_H

#include "neverhood/neverhood.h"
#include "neverhood/sprite.h"
#include "neverhood/graphics.h"
#include "neverhood/resource.h"

namespace Neverhood {

// TODO: This code is horrible and weird and a lot of stuff needs renaming once a better name is found

class Klayman;

struct KlaymanTableItem {
	int value;
	void (Klayman::*callback)();
};

class Klayman : public AnimatedSprite {
public:
	Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority, int objectPriority);

	void sub41FD30();
	void sub41FDA0();
	void sub41FDF0();
	void sub41FE60();
	void sub41FEB0();

protected:
	Entity *_parentScene;
	Entity *_attachedSprite;
	int _statusE0;
	bool _flagE1;
	bool _flagE2;
	bool _flagE3;
	bool _flagE4;
	bool _flagE5;
	int16 _x4, _y4;
	int16 _counter, _counterMax;
	int16 _counter3, _counter3Max;
	int16 _counter1;
	int16 _counter2;
	bool _flagF6;
	bool _flagF7;
	bool _flagF8;
	int _status2;
	bool _flagFA;
	SoundResource _soundResource1;
	SoundResource _soundResource2;
	int _status;
	const KlaymanTableItem *_table;
	int _tableCount;
	int _tableMaxValue;
	/*
	00000114 field114		dd ?
	00000118 field118		dw ?
	*/
	bool _soundFlag;
	int _resourceHandle;
	virtual void xUpdate();
	virtual uint32 xHandleMessage(int messageNum, const MessageParam &param);
	void update();

	void setKlaymanTable(const KlaymanTableItem *table, int tableCount);
	void setKlaymanTable1();
	void setKlaymanTable2();
	void setKlaymanTable3();

	void sub41FD40();
	void sub41FD90();
	uint32 handleMessage41EB10(int messageNum, const MessageParam &param, Entity *sender);

	void sub41FDB0();
	uint32 handleMessage41E980(int messageNum, const MessageParam &param, Entity *sender);

	void sub41FE00();
	void sub41FE50();
	uint32 handleMessage41E9E0(int messageNum, const MessageParam &param, Entity *sender);
	
	void sub41FE70();
	uint32 handleMessage41EF80(int messageNum, const MessageParam &param, Entity *sender);
	
	void sub41FEC0();
	uint32 handleMessage41EFE0(int messageNum, const MessageParam &param, Entity *sender);

	void sub41D320(uint32 fileHash, AnimationCb callback);
	void update41D2B0();

	bool sub41CF10(AnimationCb callback);
	void sub41C7B0();
	void sub41C770();
	void sub41C790();
	
	void sub41FC80();
	void update41D0F0();
	uint32 handleMessage41D360(int messageNum, const MessageParam &param, Entity *sender);

	void sub41FF00();
	uint32 handleMessage41D480(int messageNum, const MessageParam &param, Entity *sender);
	
	void sub41FCF0();
	
	uint32 handleMessage41F140(int messageNum, const MessageParam &param, Entity *sender);

	void sub41C930(int16 x, bool flag);
	
};

} // End of namespace Neverhood

#endif /* NEVERHOOD_KLAYMAN_H */