File: mentatCode.h

package info (click to toggle)
tecnoballz 0.91-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,016 kB
  • ctags: 3,067
  • sloc: cpp: 23,872; makefile: 311; sh: 197; ansic: 131
file content (185 lines) | stat: -rw-r--r-- 6,495 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
//*****************************************************************************
// copyright (c) 1991-2005 TLK Games all rights reserved
//-----------------------------------------------------------------------------
// file		: "mentatCode.h"
// created	: 2002-08-18
// updates	: 2005-02-04
// ID		: $Id: mentatCode.h,v 1.9 2005/02/04 13:31:09 gurumeditation Exp $
//-----------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
// 
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place - Suite 330, Boston, MA 02111-1307, USA.
//*****************************************************************************
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
//...............................................................................
#ifdef WIN32
#include <io.h>
#include "SDL/SDL.h"
//...............................................................................
#else //WIN32
#include <unistd.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <pthread.h>
#include <unistd.h>
#include "SDL/SDL.h"
#endif //WIN32
//...............................................................................
#include "../include/configfile.h"
//...............................................................................
#ifndef __MENTATCODE__
#define __MENTATCODE__
#define TECNOBALLZ_VERSION	"TECNOBALLZ 0.91 (2005-02-04)"
//#define TU_TRICHES		//devel only
#define BYTES_COPY		//force bytes copy (SPARC unaligned memory access)
#ifndef SCOREFILE
#define SCOREFILE "tecnoball"
#endif
#ifndef PREFIX
#define PREFIX ""
#endif
//...............................................................................
class mentatCode;
class configfile;
class scoretable;
class ressources;
class level_data;
class RAM_killer;
class ecran_hard;
class clavierMac;
#ifndef SOUNDISOFF
class audiomixer;
#endif
class liste_BOBs;
class joueurData;
class tableaux_Z;
class shop_tecno;
class gard_tecno;
class menu_tecno;
class scrolledit;
class GIF_bitMap;
//..............................................................................
const Sint32 E_NO_ERROR = 0;
const Sint32 E_GENRIQUE = -1;	// erreur generique
const Sint32 E_OUT_LIST = -2;	// erreur reservation de la liste memoire
const Sint32 E_NOMEMORY = -3;	// erreur reservation : depassement memoire
const Sint32 E_OUT_ZONE = -4;	// erreur reservation : maxium de zones memoire 
//const Sint32 E_NO_GIF87 = -5;	// fichier non GIF87a
//const Sint32 E_NORESGIF = -6;	// ressource GIF asbente
const Sint32 E_NORESOUR = -7;	// ressource non presente
const Sint32 E_SDLERROR = -8;
const Sint32 E_FILERROR = -9;
const Sint32 E_SDLMIXER = -9;
const Sint32 SINUS_MASK = 511;
const Sint32 SINUS_DECA = 7;
//..............................................................................
class mentatCode 
{
	public:
		static const Sint32	NB_OPTIONS = 19;	//number maximum of bonus bought
		static const Uint32	NDIFFICULT = 4;		//4 levels of difficulty
		static const Sint32	MAX_PLAYER = 6;	
	
	public:
		static bool		is_verbose;		//1 = verbose mode
		static Sint32		bg4_colors;		//1 = force 4 colors background
		static Sint32		resolution;		//1:320*240 or 2:640*480 pixels
		static Uint32		double_mem;		//double memory size of all allocations 
		static Sint32		arg_jumper;

	protected:
		Sint32			numero_obj;		//object number
		Sint32			erreur_num;		//error code

		//###############################################################
		// statics members 
		//###############################################################
		static Sint32		counterObj;		//number of objects
		static Sint32		hasard_val;		//random value
		static Sint32		countframe;		//frame counter
		static Sint32		num_erreur;		//error number
	
		static Sint32		super_jump;		// game phase:
								// - 0: bricks levels
								// - 1: shop
								// - 2: guards levels
								// - 3: menu

		static Sint32		hardChoice;		//difficulty
								// -1: easy
								// -2: hardChoice
								// -3: mad
								// -4: dead

		static Sint32		super_exit;		//1: game exit

		static Uint32		cheat_flag;		//E + T + B + Return (into shop)
		static Uint32		birth_flag;		//1 = all names is 040670
		static Sint32		vieInitial;		//nmber of initial lives
		static Sint32		nuOfPlayer;
		static const char	nomprefix[];
		static char		chainelog[100];
		static const Uint32	LEVEL_AREA = 12;
	
		static scoretable*	ptScoreTab;		//mange best scores
		static ressources*	pRessource;		//manage resources
		static level_data*	ptLev_data;		//manage levels
		static RAM_killer*	memGestion;		//manage memory allocation   
#ifndef SOUNDISOFF
		static audiomixer*	ptAudiomix;		//manage sounds and musics
#endif
		static ecran_hard*	ecran_gere;		//manage screen display
		static clavierMac*	keyGestion;		//manage keyboard and mouse events 
		static liste_BOBs*	BOBgestion;
		static joueurData*	joueurGere;

		static Sint16*		table_cosL;
		static Sint16*		table_sinL;
		static tableaux_Z*	tabGestion;
		static shop_tecno*	shpGestion;
		static gard_tecno*	garGestion;
		static menu_tecno*	menGestion;
		static scrolledit*	ptScrollEd;  
		static GIF_bitMap*	image_BOBs;
		static char		zeAreaCode[11];

	public:
		static Sint32		first_init(configfile* pConf);
		static Sint32		game_begin();
		static void		fullscreen();
		static void		objectKill();
		static Sint32		desinstall(configfile* pConf);
 
		static void		ecritLog(char *f_nom, char* chain);
		static void		intToASCII(Sint32 value, char *strng, Uint32 reste);

					mentatCode();
					~mentatCode();
		void			mentatInit();
		void			mentatKill();
		Sint32			retour_err();
		void			error_init(Sint32 error);
		Sint32			get_number();
		Sint32			chaine_cmp(char *srcPT, char *desPT, Sint32 taille);
		Sint32			littleWord(char *memPT);
		void			bigendianw(Uint32*, Uint32*);
		void			bigendianr(Uint32*, Uint32*);
};
#endif