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
|
/* 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.
*
*/
/*
* This code is based on original Tony Tough source code
*
* Copyright (c) 1997-2003 Nayma Software
*/
#ifndef TONY_INVENTORY_H
#define TONY_INVENTORY_H
#include "common/scummsys.h"
#include "common/system.h"
#include "tony/font.h"
#include "tony/game.h"
#include "tony/gfxcore.h"
#include "tony/loc.h"
namespace Tony {
struct RMInventoryItem {
RMItem icon;
RMGfxSourceBuffer8RLEByteAA *pointer;
int status;
};
class RMInventory : public RMGfxWoodyBuffer {
private:
enum STATE {
CLOSED,
OPENING,
OPENED,
CLOSING,
SELECTING
};
protected:
int m_nItems;
RMInventoryItem *m_items;
int m_inv[256];
int m_nInv;
int m_curPutY;
uint32 m_curPutTime;
int m_curPos;
STATE m_state;
bool m_bHasFocus;
int m_nSelectObj;
int m_nCombine;
bool m_bCombining;
bool m_bBlinkingRight, m_bBlinkingLeft;
int miniAction;
RMItem miniInterface;
RMText m_hints[3];
OSystem::MutexRef m_csModifyInterface;
protected:
// Prepara l'immagine dell'inventario. Va richiamato ogni volta
// che l'inventario cambia
void Prepare(void);
// Controlla se la posizione Y del mouse � corretta, anche in base
// alla posizione dell'inventario su schermo
bool CheckPointInside(const RMPoint &pt);
public:
RMInventory();
virtual ~RMInventory();
// Prepara un frame
void DoFrame(RMGfxTargetBuffer& bigBuf, RMPointer &ptr, RMPoint mpos, bool bCanOpen);
// Inizializzazione e chiusura
void Init(void);
void Close(void);
void Reset(void);
// Overload per la rimozione da otlist
virtual void RemoveThis(CORO_PARAM, bool &result);
// Overload per il disegno (per la posizione x&y e l'interfaccina)
virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// Metodo per determinare se l'inventario sta comandando gli input
bool HaveFocus(const RMPoint &mpos);
// Metodo per determinare se la mini interfaccia � attiva
bool MiniActive(void);
// Gestisce il click sinistro del mouse (solo quando c'ha focus)
bool LeftClick(const RMPoint &mpos, int &nCombineObj);
// Gestisce il tasto destro del mouse (solo quando c'ha focus)
void RightClick(const RMPoint &mpos);
bool RightRelease(const RMPoint &mpos, RMTonyAction &curAction);
// Avverte che � finito il combine
void EndCombine(void);
public:
// Aggiunta di un oggetto all'inventario
void AddItem(int code);
RMInventory& operator+=(RMItem *item) { AddItem(item->MpalCode()); return *this; }
RMInventory& operator+=(RMItem &item) { AddItem(item.MpalCode()); return *this; }
RMInventory& operator+=(int code) { AddItem(code); return *this; }
// Rimozione di oggetto
void RemoveItem(int code);
// Siamo sopra un oggetto?
RMItem *WhichItemIsIn(const RMPoint &mpt);
bool ItemInFocus(const RMPoint &mpt);
// Cambia l'icona di un oggetto
void ChangeItemStatus(uint32 dwCode, uint32 dwStatus);
// Salvataggio
int GetSaveStateSize(void);
void SaveState(byte *state);
int LoadState(byte *state);
};
class RMInterface : public RMGfxSourceBuffer8RLEByte {
private:
bool m_bActive;
RMPoint m_mpos;
RMPoint m_openPos;
RMPoint m_openStart;
RMText m_hints[5];
RMGfxSourceBuffer8RLEByte m_hotzone[5];
RMRect m_hotbbox[5];
bool m_bPalesati;
int m_lastHotZone;
protected:
// Dice su quale zona calda si trova il punto
int OnWhichBox(RMPoint pt);
public:
virtual ~RMInterface();
// Il solito DoFrame (polling del motore grafico)
void DoFrame(RMGfxTargetBuffer& bigBuf, RMPoint mousepos);
// TRUE se � attiva (non si pu� selezionare oggetti)
bool Active();
// Inizializzazione
void Init(void);
void Close(void);
// Resetta l'interfaccia
void Reset(void);
// Avverte dei click e rilasci del mouse
void Clicked(const RMPoint &mousepos);
bool Released(const RMPoint &mousepos, RMTonyAction &action);
// Attiva o disattiva il quinto verbo
void SetPalesati(bool bOn);
bool GetPalesati(void);
// Overloading del Draw per il posizionamente
virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
};
} // End of namespace Tony
#endif
|