project_files/frontlib/hwconsts.c
author koda
Wed, 08 Jan 2014 23:29:30 +0100
changeset 9961 c18c66d621e5
parent 7497 7e1d72fc03c7
child 10017 de822cd3df3a
permissions -rw-r--r--
consistent cmake checks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     1
/*
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     4
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     5
 * This program is free software; you can redistribute it and/or
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     6
 * modify it under the terms of the GNU General Public License
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     8
 * of the License, or (at your option) any later version.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     9
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    13
 * GNU General Public License for more details.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    14
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    15
 * You should have received a copy of the GNU General Public License
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    16
 * along with this program; if not, write to the Free Software
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    18
 */
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    19
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
#include "hwconsts.h"
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
7479
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    22
const uint32_t flib_teamcolors[] = HW_TEAMCOLOR_ARRAY;
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    23
const size_t flib_teamcolor_count = sizeof(flib_teamcolors)/sizeof(uint32_t)-1;
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    24
7497
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    25
static const flib_metascheme_setting metaSchemeSettings[] = {
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    26
	{ .name = "damagefactor",      .times1000 = false, .engineCommand = "e$damagepct",   .maxMeansInfinity = false, .min = 10, .max = 300,  .def = 100 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    27
	{ .name = "turntime",          .times1000 = true,  .engineCommand = "e$turntime",    .maxMeansInfinity = true,  .min = 1,  .max = 9999, .def = 45  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    28
	{ .name = "health",            .times1000 = false, .engineCommand = NULL,            .maxMeansInfinity = false, .min = 50, .max = 200,  .def = 100 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    29
	{ .name = "suddendeath",       .times1000 = false, .engineCommand = "e$sd_turns",    .maxMeansInfinity = true,  .min = 0,  .max = 50,   .def = 15  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    30
	{ .name = "caseprobability",   .times1000 = false, .engineCommand = "e$casefreq",    .maxMeansInfinity = false, .min = 0,  .max = 9,    .def = 5   },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    31
	{ .name = "minestime",         .times1000 = true,  .engineCommand = "e$minestime",   .maxMeansInfinity = false, .min = -1, .max = 5,    .def = 3   },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    32
	{ .name = "minesnum",          .times1000 = false, .engineCommand = "e$minesnum",    .maxMeansInfinity = false, .min = 0,  .max = 80,   .def = 4   },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    33
	{ .name = "minedudpct",        .times1000 = false, .engineCommand = "e$minedudpct",  .maxMeansInfinity = false, .min = 0,  .max = 100,  .def = 0   },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    34
	{ .name = "explosives",        .times1000 = false, .engineCommand = "e$explosives",  .maxMeansInfinity = false, .min = 0,  .max = 40,   .def = 2   },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    35
	{ .name = "healthprobability", .times1000 = false, .engineCommand = "e$healthprob",  .maxMeansInfinity = false, .min = 0,  .max = 100,  .def = 35  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    36
	{ .name = "healthcaseamount",  .times1000 = false, .engineCommand = "e$hcaseamount", .maxMeansInfinity = false, .min = 0,  .max = 200,  .def = 25  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    37
	{ .name = "waterrise",         .times1000 = false, .engineCommand = "e$waterrise",   .maxMeansInfinity = false, .min = 0,  .max = 100,  .def = 47  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    38
	{ .name = "healthdecrease",    .times1000 = false, .engineCommand = "e$healthdec",   .maxMeansInfinity = false, .min = 0,  .max = 100,  .def = 5   },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    39
	{ .name = "ropepct",           .times1000 = false, .engineCommand = "e$ropepct",     .maxMeansInfinity = false, .min = 25, .max = 999,  .def = 100 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    40
	{ .name = "getawaytime",       .times1000 = false, .engineCommand = "e$getawaytime", .maxMeansInfinity = false, .min = 0,  .max = 999,  .def = 100 }
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    41
};
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    42
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    43
static const flib_metascheme_mod metaSchemeMods[] = {
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    44
	{ .name = "fortsmode",          .bitmaskIndex = 12 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    45
	{ .name = "divteams",           .bitmaskIndex = 4  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    46
	{ .name = "solidland",          .bitmaskIndex = 2  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    47
	{ .name = "border",             .bitmaskIndex = 3  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    48
	{ .name = "lowgrav",            .bitmaskIndex = 5  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    49
	{ .name = "laser",              .bitmaskIndex = 6  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    50
	{ .name = "invulnerability",    .bitmaskIndex = 7  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    51
	{ .name = "resethealth",        .bitmaskIndex = 8  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    52
	{ .name = "vampiric",           .bitmaskIndex = 9  },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    53
	{ .name = "karma",              .bitmaskIndex = 10 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    54
	{ .name = "artillery",          .bitmaskIndex = 11 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    55
	{ .name = "randomorder",        .bitmaskIndex = 13 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    56
	{ .name = "king",               .bitmaskIndex = 14 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    57
	{ .name = "placehog",           .bitmaskIndex = 15 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    58
	{ .name = "sharedammo",         .bitmaskIndex = 16 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    59
	{ .name = "disablegirders",     .bitmaskIndex = 17 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    60
	{ .name = "disablelandobjects", .bitmaskIndex = 18 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    61
	{ .name = "aisurvival",         .bitmaskIndex = 19 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    62
	{ .name = "infattack",          .bitmaskIndex = 20 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    63
	{ .name = "resetweps",          .bitmaskIndex = 21 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    64
	{ .name = "perhogammo",         .bitmaskIndex = 22 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    65
	{ .name = "disablewind",        .bitmaskIndex = 23 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    66
	{ .name = "morewind",           .bitmaskIndex = 24 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    67
	{ .name = "tagteam",            .bitmaskIndex = 25 },
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    68
	{ .name = "bottomborder",       .bitmaskIndex = 26 }
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    69
};
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    70
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    71
const flib_metascheme flib_meta = {
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    72
	.settingCount = sizeof(metaSchemeSettings)/sizeof(flib_metascheme_setting),
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    73
	.modCount = sizeof(metaSchemeMods)/sizeof(flib_metascheme_mod),
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    74
	.settings = metaSchemeSettings,
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    75
	.mods = metaSchemeMods
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    76
};
7479
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    77
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    78
uint32_t flib_get_teamcolor(int colorIndex) {
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    79
	if(colorIndex>=0 && colorIndex < flib_teamcolor_count) {
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    80
		return flib_teamcolors[colorIndex];
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    81
	} else {
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    82
		return 0;
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    83
	}
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    84
}
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    85
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    86
int flib_get_teamcolor_count() {
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    87
	return flib_teamcolor_count;
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    88
}
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    89
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    90
int flib_get_hedgehogs_per_team() {
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    91
	return HEDGEHOGS_PER_TEAM;
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    92
}
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    93
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    94
int flib_get_weapons_count() {
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    95
	return WEAPONS_COUNT;
c8c552ee3acb frontlib: Added functions to query important constants from the library
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    96
}
7497
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    97
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    98
const flib_metascheme *flib_get_metascheme() {
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
    99
	return &flib_meta;
7e1d72fc03c7 frontlib:
Medo <smaxein@googlemail.com>
parents: 7479
diff changeset
   100
}