1 /* ResidualVM - A 3D game interpreter 2 * 3 * ResidualVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the AUTHORS 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 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (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, write to the Free Software 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 * 26 */ 27 28 #ifndef ICB_PSX_TMAN_H 29 #define ICB_PSX_TMAN_H 30 31 #include "engines/icb/gfx/psx_pcgpu.h" 32 33 namespace ICB { 34 35 #define MAX_NUMBER_SLOTS 8 36 #define MAX_NUMBER_PALETTES 10 37 38 #define N_TILES_X 4 39 #define N_TILES_Y 4 40 41 #define MAX_NUMBER_TILES (N_TILES_X * N_TILES_Y) 42 43 typedef struct TextureInfo { 44 // DO NOT CHANGE THIS SECTION OF THE STRUCTURE 45 // AS PSX ASSMEBLER ROUTINES RELY ON IT BEING LIKE THIS 46 int16 tsb; // tpf | abr | texture_page = getTpate( tpf, abr, x, y ); 47 int16 cba; // cy | cx = getClut(cx,cy) 48 uint8 uoffset; 49 uint8 voffset; 50 int16 padding; 51 // DO WHAT YOU LIKE FROM HERE ONWARDS 52 uint32 id; 53 uint32 age; 54 RECT16 r; 55 } TextureInfo; 56 57 typedef struct PaletteInfo { 58 uint32 id; 59 uint32 age; 60 int16 x; 61 int16 y; 62 int16 cba; // cy | cx = getClut(cx,cy) 63 int16 padding; 64 } PaletteInfo; 65 66 class TextureManager { 67 public: 68 TextureManager(); 69 TextureManager(int16 nx0, int16 ny0, int16 nx1, int16 ny1); 70 ~TextureManager(); 71 void Init(int16 nx0, int16 ny0, int16 nx1, int16 ny1); 72 TextureInfo *FindTexture(uint32 id, uint32 age); 73 TextureInfo *AddTexture(uint32 *tim_ptr, uint32 id, uint32 age, uint16 imgW, uint16 imgH); 74 75 PaletteInfo *FindPalette(uint32 id, uint32 age); 76 PaletteInfo *AddPalette(uint32 *clut_ptr, uint32 id, uint32 age); 77 78 void PurgeAll(void); 79 80 TextureInfo tSlots[MAX_NUMBER_SLOTS]; 81 PaletteInfo pSlots[MAX_NUMBER_PALETTES]; 82 uint8 inuse[MAX_NUMBER_TILES]; 83 int16 x0, y0; 84 int16 x1, y1; 85 uint16 tileW, tileH; 86 uint32 nSlotsUsed; 87 uint32 nPalettesUsed; 88 }; 89 90 } // End of namespace ICB 91 92 #endif // #ifndef PSX_TMAN_H 93