1 /**
2  * @file
3  * @brief Internal data use by the UI package
4  * @note It should not be include by a file outside the UI package
5  */
6 
7 /*
8 Copyright (C) 2002-2013 UFO: Alien Invasion.
9 
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12 as published by the Free Software Foundation; either version 2
13 of the License, or (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 See the GNU General Public License for more details.
20 
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24 
25 */
26 
27 #pragma once
28 
29 #define UI_MAX_WINDOWS			128
30 #define UI_MAX_COMPONENTS		128
31 #define UI_MAX_WINDOWSTACK		32
32 #define UI_MAX_ACTIONS			2*8192
33 #define UI_MAX_VARIABLESTACK	64
34 
35 #include "node/ui_node_window.h"
36 #include "node/ui_node_model.h"
37 #include "ui_main.h"
38 #include "ui_actions.h"
39 #include "ui_behaviour.h"
40 #include "ui_nodes.h"
41 #include "ui_sprite.h"
42 #include "ui_input.h"
43 #include "ui_expression.h"
44 #include "ui_data.h"
45 
46 /**
47  * @brief Global data shared into all UI code
48  */
49 typedef struct uiGlobal_s {
50 
51 	/**
52 	 * @brief Holds shared data
53 	 * @note The array id is given via dataID in the node definitions
54 	 * @sa UI_ResetData
55 	 * @sa UI_RegisterText
56 	 * @sa UI_GetText
57 	 * @sa UI_RegisterLinkedListText
58 	 */
59 	uiSharedData_t sharedData[UI_MAX_DATAID];
60 
61 	/**
62 	 * @brief Local var for script function
63 	 */
64 	uiValue_t variableStack[UI_MAX_VARIABLESTACK];
65 
66 	int numNodes;
67 
68 	uiNode_t* windows[UI_MAX_WINDOWS];
69 	int numWindows;
70 
71 	uiNode_t* components[UI_MAX_COMPONENTS];
72 	int numComponents;
73 
74 	byte* adata, *curadata;
75 	int adataize;
76 
77 	uiNode_t* windowStack[UI_MAX_WINDOWSTACK];
78 	int windowStackPos;
79 
80 	uiAction_t actions[UI_MAX_ACTIONS];
81 	int numActions;
82 
83 	uiModel_t models[UI_MAX_MODELS];
84 	int numModels;
85 
86 	uiSprite_t sprites[UI_MAX_SPRITES];
87 	int numSprites;
88 
89 	uiKeyBinding_t keyBindings[UI_MAX_KEYBINDING];
90 	int numKeyBindings;
91 
92 } uiGlobal_t;
93 
94 extern uiGlobal_t ui_global;
95 
96 extern memPool_t* ui_sysPool;
97 extern memPool_t* ui_dynStringPool;
98 extern memPool_t* ui_dynPool;
99 
100 /**
101  * Alignment memory for structures
102  * @todo Remove it and use something from compiler
103  */
104 #define STRUCT_MEMORY_ALIGN	8
105 
106 void* UI_AllocHunkMemory(size_t size, int align, bool reset);
107 
108 void UI_FinishInit(void);
109 void UI_FinishWindowsInit(void);
110