Debian Codegraph @

src/cdogs/pic_manager.h

raw symbols SCIP
1 /*
2 C-Dogs SDL
3 A port of the legendary (and fun) action/arcade cdogs.
4 Copyright (c) 2013-2016, 2018-2019, 2023-2024 Cong Xu
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9
10 Redistributions of source code must retain the above copyright notice, this
11 list of conditions and the following disclaimer.
12 Redistributions in binary form must reproduce the above copyright notice,
13 this list of conditions and the following disclaimer in the documentation
14 and/or other materials provided with the distribution.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 POSSIBILITY OF SUCH DAMAGE.
27 */
28 #pragma once
29
30 #include "blit.h"
31 #include "c_hashmap/hashmap.h"
32 #include "cpic.h"
33
34 typedef struct
35 {
36 map_t pics; // of NamedPic
37 map_t sprites; // of NamedSprites
38 map_t customPics; // of NamedPic
39 map_t customSprites; // of NamedSprites
40
41 CArray headPartNames[HEAD_PART_COUNT]; // of char *
42 CArray wallStyleNames; // of char *
43 CArray tileStyleNames; // of char *
44 CArray exitStyleNames; // of char *
45 CArray doorStyleNames; // of char *
46 CArray keyStyleNames; // of char *
47 } PicManager;
48
49 extern PicManager gPicManager;
50
51 void PicManagerInit(PicManager *pm);
52 void PicManagerLoad(PicManager *pm);
53 void PicManagerLoadDir(
54 PicManager *pm, const char *path, const char *prefix,
55 map_t pics, map_t sprites, const bool isHD);
56 void PicManagerClearCustom(PicManager *pm);
57 void PicManagerTerminate(PicManager *pm);
58 void PicManagerReloadTextures(PicManager *pm);
59
60 // Note: return ptr to NamedPic so we can store that instead of the name
61 NamedPic *PicManagerGetNamedPic(const PicManager *pm, const char *name);
62 Pic *PicManagerGetPic(const PicManager *pm, const char *name);
63 const NamedSprites *PicManagerGetSprites(
64 const PicManager *pm, const char *name);
65
66 // Get a masked pic for the styled tiles: walls, floors, rooms
67 // Simply calls GetMaskedPic but the name contains the relevant
68 // style/type names
69 NamedPic *PicManagerGetMaskedStylePic(
70 const PicManager *pm,
71 const char *name, const char *style, const char *type,
72 const color_t mask, const color_t maskAlt);
73 // To support dynamic colours, generate pics on request.
74 void PicManagerGenerateMaskedStylePic(
75 PicManager *pm, const char *name, const char *style, const char *type,
76 const color_t mask, const color_t maskAlt, const bool noAltMask);
77 // Get masked character pics
78 const NamedSprites *PicManagerGetCharSprites(
79 PicManager *pm, const char *name, const CharColors *colors);
80
81 int PicManagerGetWallStyleIndex(PicManager *pm, const char *style);
82 int PicManagerGetTileStyleIndex(PicManager *pm, const char *style);
83 int PicManagerGetExitStyleIndex(PicManager *pm, const char *style);
84 int PicManagerGetDoorStyleIndex(PicManager *pm, const char *style);
85 int PicManagerGetKeyStyleIndex(PicManager *pm, const char *style);