ScummVM API documentation
psx_tman.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_PSX_TMAN_H
28 #define ICB_PSX_TMAN_H
29 
30 #include "engines/icb/gfx/psx_pcgpu.h"
31 
32 namespace ICB {
33 
34 #define MAX_NUMBER_SLOTS 8
35 #define MAX_NUMBER_PALETTES 10
36 
37 #define N_TILES_X 4
38 #define N_TILES_Y 4
39 
40 #define MAX_NUMBER_TILES (N_TILES_X * N_TILES_Y)
41 
42 typedef struct TextureInfo {
43  // DO NOT CHANGE THIS SECTION OF THE STRUCTURE
44  // AS PSX ASSMEBLER ROUTINES RELY ON IT BEING LIKE THIS
45  int16 tsb; // tpf | abr | texture_page = getTpate( tpf, abr, x, y );
46  int16 cba; // cy | cx = getClut(cx,cy)
47  uint8 uoffset;
48  uint8 voffset;
49  int16 padding;
50  // DO WHAT YOU LIKE FROM HERE ONWARDS
51  uint32 id;
52  uint32 age;
53  RECT16 r;
54 } TextureInfo;
55 
56 typedef struct PaletteInfo {
57  uint32 id;
58  uint32 age;
59  int16 x;
60  int16 y;
61  int16 cba; // cy | cx = getClut(cx,cy)
62  int16 padding;
63 } PaletteInfo;
64 
66 public:
68  TextureManager(int16 nx0, int16 ny0, int16 nx1, int16 ny1);
69  ~TextureManager();
70  void Init(int16 nx0, int16 ny0, int16 nx1, int16 ny1);
71  TextureInfo *FindTexture(uint32 id, uint32 age);
72  TextureInfo *AddTexture(uint32 *tim_ptr, uint32 id, uint32 age, uint16 imgW, uint16 imgH);
73 
74  PaletteInfo *FindPalette(uint32 id, uint32 age);
75  PaletteInfo *AddPalette(uint32 *clut_ptr, uint32 id, uint32 age);
76 
77  void PurgeAll(void);
78 
79  TextureInfo tSlots[MAX_NUMBER_SLOTS];
80  PaletteInfo pSlots[MAX_NUMBER_PALETTES];
81  uint8 inuse[MAX_NUMBER_TILES];
82  int16 x0, y0;
83  int16 x1, y1;
84  uint16 tileW, tileH;
85  uint32 nSlotsUsed;
86  uint32 nPalettesUsed;
87 };
88 
89 } // End of namespace ICB
90 
91 #endif // #ifndef PSX_TMAN_H
Definition: psx_tman.h:65
Definition: actor.h:32
Definition: psx_tman.h:56
Definition: psx_tman.h:42
Definition: psx_pcgpu.h:260