project_files/frontlib/hwconsts.h
author Mrowqa
Tue, 04 Dec 2012 09:24:10 +0100
branchflibqtfrontend
changeset 8261 c8236fcbe160
parent 8132 f68b43cf510f
child 8263 a0d586321d6f
permissions -rw-r--r--
GCI2012: Corrected headers for generate documentation (doxygen)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     1
/*
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     2
 * Hedgewars, a free turn based strategy game
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     4
 * Copyright (c) 2012 Simeon Maxein <smaxein@googlemail.com>
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     5
 *
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     7
 * it under the terms of the GNU General Public License as published by
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     8
 * the Free Software Foundation; version 2 of the License
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
     9
 *
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    13
 * GNU General Public License for more details.
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    14
 *
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    15
 * You should have received a copy of the GNU General Public License
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    16
 * along with this program; if not, write to the Free Software
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    18
 */
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    19
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
/**
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
 * This file contains important constants which might need to be changed to adapt to
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
 * changes in the engine or protocols.
7479
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    23
 *
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    24
 * It also contains getter functions for some constants (in particular for constants
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    25
 * that are important for the layout of data structures), so that client code can
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    26
 * query the constants that the library was built with.
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    27
 */
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    28
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    29
#ifndef HWCONSTS_H_
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    30
#define HWCONSTS_H_
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    32
#include <inttypes.h>
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    33
#include <stddef.h>
7497
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    34
#include <stdbool.h>
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    35
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    36
#define HEDGEHOGS_PER_TEAM 8
7566
57d343ee382f frontlib: Return more filled-in team objects
Medo <smaxein@googlemail.com>
parents: 7497
diff changeset
    37
#define DEFAULT_HEDGEHOG_COUNT 4
57d343ee382f frontlib: Return more filled-in team objects
Medo <smaxein@googlemail.com>
parents: 7497
diff changeset
    38
#define DEFAULT_COLOR_INDEX 0
57d343ee382f frontlib: Return more filled-in team objects
Medo <smaxein@googlemail.com>
parents: 7497
diff changeset
    39
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    40
#define NETGAME_DEFAULT_PORT 46631
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    41
#define PROTOCOL_VERSION 42
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    42
#define MIN_SERVER_VERSION 1
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    43
8261
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    44
//! Used for sending scripts to the engine
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    45
#define MULTIPLAYER_SCRIPT_PATH "Scripts/Multiplayer/"
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    46
8062
abbcdf73327a allow the engine to use physfs on android too
Xeli
parents: 7689
diff changeset
    47
#define WEAPONS_COUNT 56
8261
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    48
// TODO allow frontend to override these?
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    49
/*! A merge of mikade/bugq colours w/ a bit of channel feedback */
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    50
#define HW_TEAMCOLOR_ARRAY  { UINT32_C(0xffff0204), /*! red    */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    51
                              UINT32_C(0xff4980c1), /*! blue   */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    52
                              UINT32_C(0xff1de6ba), /*! teal   */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    53
                              UINT32_C(0xffb541ef), /*! purple */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    54
                              UINT32_C(0xffe55bb0), /*! pink   */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    55
                              UINT32_C(0xff20bf00), /*! green  */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    56
                              UINT32_C(0xfffe8b0e), /*! orange */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    57
                              UINT32_C(0xff5f3605), /*! brown  */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    58
                              UINT32_C(0xffffff01), /*! yellow */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    59
                              /*! add new colors here */ \
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    60
                              0 } /*! Keep this 0 at the end */
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    61
8132
f68b43cf510f Added default weaponset to frontlib hwconsts
Medo <smaxein@googlemail.com>
parents: 8062
diff changeset
    62
#define AMMOLINE_DEFAULT_QT     "93919294221991210322351110012010000002111101010111110101"
f68b43cf510f Added default weaponset to frontlib hwconsts
Medo <smaxein@googlemail.com>
parents: 8062
diff changeset
    63
#define AMMOLINE_DEFAULT_PROB   "04050405416006555465544647765766666661555101011154110101"
f68b43cf510f Added default weaponset to frontlib hwconsts
Medo <smaxein@googlemail.com>
parents: 8062
diff changeset
    64
#define AMMOLINE_DEFAULT_DELAY  "00000000000002055000000400070040000000002200000006000000"
f68b43cf510f Added default weaponset to frontlib hwconsts
Medo <smaxein@googlemail.com>
parents: 8062
diff changeset
    65
#define AMMOLINE_DEFAULT_CRATE  "13111103121111111231141111111111111112111111011111110101"
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    66
7479
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    67
extern const size_t flib_teamcolor_count;
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    68
extern const uint32_t flib_teamcolors[];
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    69
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    70
/**
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    71
 * Returns the team color (ARGB) corresponding to the color index (0 if index out of bounds)
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    72
 */
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    73
uint32_t flib_get_teamcolor(int colorIndex);
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    74
7479
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    75
/**
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    76
 * Returns the number of team colors (i.e. the length of the flib_teamcolors array)
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    77
 */
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    78
int flib_get_teamcolor_count();
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    79
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    80
/**
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    81
 * Returns the HEDGEHOGS_PER_TEAM constant
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    82
 */
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    83
int flib_get_hedgehogs_per_team();
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    84
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    85
/**
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    86
 * Returns the WEAPONS_COUNT constant
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    87
 */
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    88
int flib_get_weapons_count();
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    89
8261
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    90
/*!
7497
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    91
 * These structs define the meaning of values in the flib_scheme struct, i.e. their correspondence to
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    92
 * ini settings, engine commands and positions in the network protocol (the last is encoded in the
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    93
 * order of settings/mods).
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    94
 */
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    95
typedef struct {
8261
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    96
    const char *name;				//! A name identifying this setting (used as key in the schemes file)
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    97
    const char *engineCommand;		//! The command needed to send the setting to the engine. May be null if the setting is not sent to the engine (for the "health" setting)
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    98
    const bool maxMeansInfinity;	//! If true, send a very high number to the engine if the setting is equal to its maximum
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
    99
    const bool times1000;			//! If true (for time-based settings), multiply the setting by 1000 before sending it to the engine.
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
   100
    const int min;					//! The smallest allowed value
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
   101
    const int max;					//! The highest allowed value
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
   102
    const int def;					//! The default value
7497
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   103
} flib_metascheme_setting;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   104
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   105
typedef struct {
8261
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
   106
    const char *name;				//! A name identifying this mod (used as key in the schemes file)
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
   107
    const int bitmaskIndex;			//! Mods are sent to the engine in a single integer, this field describes which bit of that integer is used
c8236fcbe160 GCI2012: Corrected headers for generate documentation (doxygen)
Mrowqa
parents: 8132
diff changeset
   108
    								//! for this particular mod.
7497
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   109
} flib_metascheme_mod;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   110
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   111
typedef struct {
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   112
	const int settingCount;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   113
	const int modCount;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   114
	const flib_metascheme_setting *settings;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   115
	const flib_metascheme_mod *mods;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   116
} flib_metascheme;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   117
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   118
extern const flib_metascheme flib_meta;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   119
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   120
const flib_metascheme *flib_get_metascheme();
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   121
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
   122
#endif