ScummVM API documentation
ega_resource.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
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef CHAMBER_EGA_RESOURCE_H
23
#define CHAMBER_EGA_RESOURCE_H
24
25
#include "common/array.h"
26
#include "common/file.h"
27
#include "common/stream.h"
28
#include "graphics/surface.h"
29
30
namespace
Chamber
{
31
32
// ---------------------------------------------------------------------------
33
// EgaSpriteResource
34
//
35
// Loads a .EGA sprite bank file and decodes each sprite into a CLUT8
36
// Graphics::Surface (w*4 wide × h pixels tall, 1 byte per pixel).
37
//
38
// On-disk format (reference: kult/resource.cpp, DumpEga_main.cpp):
39
// 4 bytes — junk header (skip)
40
// per sprite:
41
// uint16 size — total byte count for this record (including the 4-byte header)
42
// byte w — width in 4-pixel units → actual pixel width = w * 4
43
// byte h — height in pixels
44
// (size-4) bytes — packed 4-bpp pixel data, 2 pixels per byte:
45
// pixel_hi = (byte >> 4) & 0x0F
46
// pixel_lo = byte & 0x0F
47
// ---------------------------------------------------------------------------
48
class
EgaSpriteResource
{
49
public
:
50
EgaSpriteResource
();
51
~
EgaSpriteResource
();
52
53
void
appendFromFile(
const
char
*filename);
54
void
appendFromStream(
Common::SeekableReadStream
&stream);
55
56
Graphics::Surface
*getSprite(uint index)
const
{
return
_sprites[index]; }
57
uint getSpriteCount()
const
{
return
_sprites.
size
(); }
58
59
private
:
60
Common::Array<Graphics::Surface *>
_sprites;
61
};
62
63
// Global EGA sprite banks (allocated in kult.cpp EGA init branch)
64
extern
EgaSpriteResource
*ega_sprit_res;
// SPRIT.EGA
65
extern
EgaSpriteResource
*ega_puzzl_res;
// PUZZL.EGA + PUZZ1.EGA
66
extern
EgaSpriteResource
*ega_perso_res;
// PERSO.EGA
67
68
}
// End of namespace Chamber
69
70
#endif // CHAMBER_EGA_RESOURCE_H
Graphics::Surface
Definition:
surface.h:67
Common::Array< Graphics::Surface * >
Common::SeekableReadStream
Definition:
stream.h:745
Chamber
Definition:
anim.h:25
Common::Array::size
size_type size() const
Definition:
array.h:316
Chamber::EgaSpriteResource
Definition:
ega_resource.h:48
engines
chamber
ega_resource.h
Generated on Tue Apr 28 2026 09:08:33 for ScummVM API documentation by
1.8.13