aboutsummaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-25 16:36:55 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-25 16:36:55 +0100
commit2f345b1d6e130177efe4fa47d5b2bd11f352ce85 (patch)
tree3db145e227d3c90d683f0ca021f066e37c92154f /gst
parente8bc1eab9a45b8893701e3acbd008fe259c53a4c (diff)
guillotined dead code
Diffstat (limited to 'gst')
-rw-r--r--gst/info.c629
-rw-r--r--gst/info.h86
2 files changed, 3 insertions, 712 deletions
diff --git a/gst/info.c b/gst/info.c
index 721863b..0a7222d 100644
--- a/gst/info.c
+++ b/gst/info.c
@@ -41,240 +41,7 @@ void info_unit_init (info_unit *u) {
for(int i=0; i<16; u->augs[i] = -1, i++);
for(int i=0; i<34; u->levels[i] = 0, i++);
}
-
-float info_unit_get_capacity(infos *info, info_unit *u) {
- float sum = 0;
- int lc = u->levels[LEVEL_CHASSIS];
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].add_capacity[lvl];
- }
- }
- int lvl = u->levels[LEVEL_BATTERY];
- sum += info->batteries[u->battery].capacity[lvl];
- return sum;
-}
-
-float info_unit_get_upkeep(infos *info, info_unit *u) {
- float sum = 0;
- int lc = u->levels[LEVEL_CHASSIS];
- int lbr = u->levels[LEVEL_BRAIN];
- for(int i=0; i<8; i++) {
- if (u->weapons[i] != -1 && info->chassis[u->chassis].slot_weapon[lc]) {
- int lvl = u->levels[LEVEL_WEAPONS+i];
- sum += info->weapons[u->weapons[i]].upkeep[lvl];
- }
- if (u->armor[i] != -1 && info->chassis[u->chassis].slot_armor[lc]) {
- int lvl = u->levels[LEVEL_ARMOR+i];
- sum += info->armors[u->armor[i]].upkeep[lvl];
- }
- }
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].upkeep[lvl];
- }
- }
- sum += info->chassis[u->chassis].upkeep[lc];
- sum += info->brains[u->brain].upkeep[lbr];
- return sum;
-}
-
-float info_unit_get_weight (infos *info, info_unit *u) {
- float sum = 0;
- int lc = u->levels[LEVEL_CHASSIS];
- if (u->battery != -1) {
- int lb = u->levels[LEVEL_BATTERY];
- sum += info->batteries[u->battery].weight[lb];
- }
- for(int i=0; i<8; i++) {
- if (u->weapons[i] != -1 && i<info->chassis[u->chassis].slot_weapon[lc]) {
- int lvl = u->levels[LEVEL_WEAPONS+i];
- sum += info->weapons[u->weapons[i]].weight[lvl];
- }
- if (u->armor[i] != -1 && i<info->chassis[u->chassis].slot_armor[lc]) {
- int lvl = u->levels[LEVEL_ARMOR+i];
- sum += info->armors[u->armor[i]].weight[lvl];
- }
- }
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].weight[lvl];
- }
- }
- return sum;
-}
-
-float info_unit_get_dps (infos *info, info_unit *u) {
- int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
- for(int i=0; i<8; i++) {
- if (u->weapons[i] != -1 && i<info->chassis[u->chassis].slot_weapon[lc]) {
- info_weapon *w = info->weapons+u->weapons[i];
- int lw = u->levels[LEVEL_WEAPONS+i];
- float damage = info_unit_get_damage(info, u, i);
- sum += damage/w->cooldown[lw];
- }
- }
- return sum;
-}
-
-float info_unit_get_health(infos *info, info_unit *u) {
- int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].add_hp[lvl];
- }
- }
- float mult = (1 + sum/100.0f);
- if (mult < 0) mult = 0;
- float ret = info->chassis[u->chassis].hp[lc] * mult;
- return ret;
-}
-
-float info_unit_get_speed(infos *info, info_unit *u) {
- int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].add_speed[lvl];
- }
- }
- sum += info->chassis[u->chassis].speed[lc];
- return sum;
-}
-
-float info_unit_get_damage (infos *info, info_unit *u, int w) {
- int lc = u->levels[LEVEL_CHASSIS];
- int damage_type = info->weapons[u->weapons[w]].damage_type;
- float sum = 0;
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].add_damage[damage_type][lvl];
- }
- }
- float mult = (1 + sum/100.0f);
- if (mult < 0) mult = 0;
- int lw = u->levels[LEVEL_WEAPONS+w];
- float dam = info->weapons[u->weapons[w]].damage[lw] * mult;
- return dam;
-}
-
-float info_unit_get_damage_target (infos *info, info_unit *u, int w,
- info_unit *t)
-{
- // u shoots at t with w, which is lol
- int damage_type = info->weapons[u->weapons[w]].damage_type;
- float reduction_perc = info_unit_get_armor(info, t, damage_type);
- float damage = info_unit_get_damage(info, u, w);
- float mult = (1 - reduction_perc / 100.0f);
- return damage * mult;
-}
-
-float info_unit_get_aoe (infos *info, info_unit *u, int w) {
- int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- //sum += info->augs[u->augs[i]].add_aoe[lvl];
- }
- }
- int lw = u->levels[LEVEL_WEAPONS+w];
- float dam = info->weapons[u->weapons[w]].aoe[lw] + sum;
- return dam;
-}
-
-float info_unit_get_knockback (infos *info, info_unit *u, int w) {
- int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- //sum += info->augs[u->augs[i]].add_knockback[lvl];
- }
- }
- int lw = u->levels[LEVEL_WEAPONS+w];
- float dam = info->weapons[u->weapons[w]].knockback[lw] + sum;
- return dam;
-}
-
-float info_unit_get_stun (infos *info, info_unit *u, int w) {
- // TODO
- return 0;
-}
-
-float info_unit_get_cooldown(infos *info, info_unit *u, int w) {
- int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].add_cooldown[lvl];
- }
- }
- int lw = u->levels[LEVEL_WEAPONS+w];
- sum += info->weapons[u->weapons[w]].cooldown[lw];
- return sum;
-}
-
-float info_unit_get_range(infos *info, info_unit *u, int w) {
- int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].add_range[lvl];
- }
- }
- int lw = u->levels[LEVEL_WEAPONS+w];
- sum += info->weapons[u->weapons[w]].range[lw];
- return sum;
-}
-
-float info_unit_get_maxrange(infos *info, info_unit *u) {
- int lc = u->levels[LEVEL_CHASSIS];
- float max = 0;
- for(int i=0; i<info->chassis[u->chassis].slot_weapon[lc]; i++) {
- if (u->weapons[i] != -1) {
- float range = info_unit_get_range(info, u, i);
- if (range > max) { max = range; }
- }
- }
- return max;
-}
-
-float info_unit_get_charge_per_shot (infos *info, info_unit *u, int w) {
- float sum = 0;
- int lw = u->levels[LEVEL_WEAPONS+w];
- sum += info->weapons[u->weapons[w]].charge_per_shot[lw];
- return sum;
-}
-
-float info_unit_get_armor(infos *info, info_unit *u, int d) {
- int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
- for(int i=0; i<8; i++) {
- if (u->armor[i] != -1 && i<info->chassis[u->chassis].slot_armor[lc]) {
- int lvl = u->levels[LEVEL_ARMOR+i];
- sum += info->armors[u->armor[i]].armor[d][lvl];
- }
- }
- for(int i=0; i<16; i++) {
- if (u->augs[i] != -1 && info->chassis[u->chassis].slot_aug[lc]) {
- int lvl = u->levels[LEVEL_AUGS+i];
- sum += info->augs[u->augs[i]].add_armor[d][lvl];
- }
- }
- return sum;
-}
-
+/*
float info_unit_get_cost (infos *info, info_unit *u) {
// see design/notes.txt:implement cost function
float sum = 0;
@@ -321,78 +88,7 @@ float info_unit_get_cost (infos *info, info_unit *u) {
return sum;
}
-
-
-
-void weapon_init (info_weapon *w) {
- strcpy(w->name, "nameless");
- for (int l=0; l<MAXLEVEL; l++) {
- w->damage_type = 0;
- w->weight[l] = 0;
- w->cooldown[l] = 1;
- w->damage[l] = 0;
- w->range[l] = 0;
- w->aoe[l] = 0;
- w->knockback[l] = 0;
- w->stun[l] = 0;
- for (int i=0; i<7; i++) { w->reduce_armor[i][l]=0; }
- w->upkeep[l] = 0;
- w->charge_per_shot[l] = 0;
- }
-}
-
-void chassis_init (info_chassis *c) {
- strcpy(c->name, "nameless");
- for (int l=0; l<MAXLEVEL; l++) {
- c->slot_weapon[l] = 0;
- c->slot_armor[l] = 0;
- c->slot_aug[l] = 0;
- c->weight_max[l] = 0;
- c->hp[l] = 0;
- c->upkeep[l] = 0;
- }
-}
-
-void battery_init (info_battery *b) {
- strcpy(b->name, "nameless");
- for (int l=0; l<MAXLEVEL; l++) {
- b->weight[l] = 0;
- b->capacity[l] = 0;
- b->recharge[l] = 0;
- }
-}
-
-void armor_init (info_armor *a) {
- strcpy(a->name, "nameless");
- for (int l=0; l<MAXLEVEL; l++) {
- a->weight[l] = 0;
- for (int i=0; i<7; i++) { a->armor[i][l]=0; }
- a->upkeep[l] = 0;
- }
-}
-
-void aug_init (info_aug *a) {
- strcpy(a->name, "nameless");
- for (int l=0; l<MAXLEVEL; l++) {
- a->weight[l] = 0;
- for (int i=0; i<7; i++) { a->add_damage[i][l]=0; }
- for (int i=0; i<7; i++) { a->add_armor[i][l]=0; }
- a->add_range[l] = 0;
- a->add_cooldown [l]= 0;
- a->add_speed[l] = 0;
- a->add_hp[l] = 0;
- a->add_capacity[l] = 0;
- a->upkeep[l] = 0;
- }
-}
-
-void brain_init (info_brain *a) {
- strcpy(a->name, "nameless");
- for (int l=0; l<MAXLEVEL; l++) {
- a->upkeep[l] = 0;
- }
-}
-
+*/
void info_unit_parse (char *json, info_unit *u, jsmntok_t *t, int r,
infos *info)
@@ -442,284 +138,6 @@ void info_unit_parse (char *json, info_unit *u, jsmntok_t *t, int r,
}
}
-void info_weapon_parse (char *json, info_weapon *w, jsmntok_t *t, int r,
- infos *info)
-{
- weapon_init(w);
- int obj_i = 0, dict_i = -1;
- for (int i=0; i<r; i+=1) {
- if (t[i].type == JSMN_STRING) {
- char key[32]; substr_token(json, key, t+i);
- if (strcmp(key, "name") == 0) {
- substr_token(json, w->name, t+i+1);
- i++;
- }
- if (strcmp(key, "damage_type") == 0) {
- char val[32]; substr_token(json, val, t+i+1);
- w->damage_type = damage_type_map(val);
- i++;
- }
- if (strcmp(key, "weight") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->weight, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "cooldown") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->cooldown, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "damage") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->damage, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "range") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->range, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "aoe") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->aoe, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "knockback") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->knockback, t+i+2, rt-1, 'i');
- i += rt;
- }
- if (strcmp(key, "damage_battery") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->damage_battery, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "stun") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->stun, t+i+2, rt-1, 'f');
- i += rt;
- }
- for (int h=0; h<7; h++) {
- char strkey[32]; sprintf(strkey, "reduce_%s",
- info->damage_types[h]);
- if (strcmp(key, strkey) == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->reduce_armor[h], t+i+2, rt-1, 'f');
- i += rt;
- break;
- }
- }
- if (strcmp(key, "upkeep") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->upkeep, t+i+2, rt-1, 'f');
- i += rt;
- }
- }
- }
-}
-
-void info_chassis_parse (char *json, info_chassis *c, jsmntok_t *t, int r,
- infos *info)
-{
- chassis_init(c);
- int obj_i = 0, dict_i = -1;
- for (int i=0; i<r; i+=1) {
- if (t[i].type == JSMN_STRING) {
- char key[32]; substr_token(json, key, t+i);
- if (strcmp(key, "name") == 0) {
- substr_token(json, c->name, t+i+1);
- i++;
- }
- if (strcmp(key, "slot_weapon") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, c->slot_weapon, t+i+2, rt-1, 'i');
- i += rt;
- }
- if (strcmp(key, "slot_armor") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, c->slot_armor, t+i+2, rt-1, 'i');
- i += rt;
- }
- if (strcmp(key, "slot_aug") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, c->slot_aug, t+i+2, rt-1, 'i');
- i += rt;
- }
- if (strcmp(key, "weight_max") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, c->weight_max, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "hp") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, c->hp, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "speed") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, c->speed, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "upkeep") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, c->upkeep, t+i+2, rt-1, 'f');
- i += rt;
- }
- }
- }
-}
-
-void info_battery_parse (char *json, info_battery *b, jsmntok_t *t, int r,
- infos *info)
-{
- battery_init(b);
- int obj_i = 0, dict_i = -1;
- for (int i=0; i<r; i+=1) {
- if (t[i].type == JSMN_STRING) {
- char key[32]; substr_token(json, key, t+i);
- if (strcmp(key, "name") == 0) {
- substr_token(json, b->name, t+i+1);
- i++;
- }
- if (strcmp(key, "weight") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, b->weight, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "capacity") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, b->capacity, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "recharge") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, b->recharge, t+i+2, rt-1, 'i');
- i += rt;
- }
- }
- }
-}
-
-void info_armor_parse (char *json, info_armor *a, jsmntok_t *t, int r,
- infos *info)
-{
- armor_init(a);
- int obj_i = 0, dict_i = -1;
- for (int i=0; i<r; i+=1) {
- if (t[i].type == JSMN_STRING) {
- char key[32]; substr_token(json, key, t+i);
- if (strcmp(key, "name") == 0) {
- substr_token(json, a->name, t+i+1);
- i++;
- }
- if (strcmp(key, "weight") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->weight, t+i+2, rt-1, 'f');
- i += rt;
- }
- for (int h=0; h<7; h++) {
- if (strcmp(key, info->damage_types[h]) == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->armor[h], t+i+2, rt-1, 'f');
- i += rt;
- }
- }
- if (strcmp(key, "upkeep") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->upkeep, t+i+2, rt-1, 'f');
- i += rt;
- }
- }
- }
-}
-
-void info_aug_parse (char *json, info_aug *a, jsmntok_t *t, int r,
- infos *info)
-{
- aug_init(a);
- int obj_i = 0, dict_i = -1;
- for (int i=0; i<r; i+=1) {
- if (t[i].type == JSMN_STRING) {
- char key[32]; substr_token(json, key, t+i);
- if (strcmp(key, "name") == 0) {
- substr_token(json, a->name, t+i+1);
- i++;
- }
- if (strcmp(key, "weight") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->weight, t+i+2, rt-1, 'f');
- i += rt;
- }
- for (int h=0; h<7; h++) {
- char strkey[32]; sprintf(strkey, "damage_%s",
- info->damage_types[h]);
- if (strcmp(key, strkey) == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->add_damage[h], t+i+2, rt-1, 'f');
- i += rt;
- break;
- }
- }
- for (int h=0; h<7; h++) {
- char strkey[32]; sprintf(strkey, "armor_%s",
- info->damage_types[h]);
- if (strcmp(key, strkey) == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->add_armor[h], t+i+2, rt-1, 'f');
- i += rt;
- break;
- }
- }
- if (strcmp(key, "add_range") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->add_range, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "add_cooldown") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->add_cooldown, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "add_hp") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->add_hp, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "add_capacity") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->add_capacity, t+i+2, rt-1, 'f');
- i += rt;
- }
- if (strcmp(key, "upkeep") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->upkeep, t+i+2, rt-1, 'f');
- i += rt;
- }
- }
- }
-}
-
-void info_brain_parse (char *json, info_brain *a, jsmntok_t *t, int r,
- infos *info)
-{
- brain_init(a);
- int obj_i = 0, dict_i = -1;
- for (int i=0; i<r; i+=1) {
- if (t[i].type == JSMN_STRING) {
- char key[32]; substr_token(json, key, t+i);
- if (strcmp(key, "name") == 0) {
- substr_token(json, a->name, t+i+1);
- i++;
- }
- if (strcmp(key, "upkeep") == 0) {
- int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, a->upkeep, t+i+2, rt-1, 'f');
- i += rt;
- }
- }
- }
-}
-
void info_parse_json (infos *info, char *json, char *obj) {
jsmn_parser p; jsmn_init(&p);
jsmntok_t t[MAXTOKENS];
@@ -733,36 +151,6 @@ void info_parse_json (infos *info, char *json, char *obj) {
info->templates+index, t+i+1, rt, info);
info->templateslen ++;
}
- if (strcmp(obj, "weapon") == 0) {
- info_weapon_parse(json,
- info->weapons+index, t+i+1, rt, info);
- info->weaponslen ++;
- }
- if (strcmp(obj, "chassis") == 0) {
- info_chassis_parse(json,
- info->chassis+index, t+i+1, rt, info);
- info->chassislen ++;
- }
- if (strcmp(obj, "battery") == 0) {
- info_battery_parse(json,
- info->batteries+index, t+i+1, rt, info);
- info->batterieslen ++;
- }
- if (strcmp(obj, "armor") == 0) {
- info_armor_parse(json,
- info->armors+index, t+i+1, rt, info);
- info->armorslen ++;
- }
- if (strcmp(obj, "aug") == 0) {
- info_aug_parse(json,
- info->augs+index, t+i+1, rt, info);
- info->augslen ++;
- }
- if (strcmp(obj, "brain") == 0) {
- info_brain_parse(json,
- info->brains+index, t+i+1, rt, info);
- info->brainslen ++;
- }
index ++;
i += rt-1;
}
@@ -1189,19 +577,6 @@ void info_load (infos *info) {
int size = 1024*64;
char json[size];
type_damage_map(info->damage_types);
- info->augslen = 0;
- info_read_file(json, "content/weapons.txt", size);
- info_parse_json(info, json, "weapon");
- info_read_file(json, "content/chassis.txt", size);
- info_parse_json(info, json, "chassis");
- info_read_file(json, "content/batteries.txt", size);
- info_parse_json(info, json, "battery");
- info_read_file(json, "content/armor.txt", size);
- info_parse_json(info, json, "armor");
- info_read_file(json, "content/augments.txt", size);
- info_parse_json(info, json, "aug");
- info_read_file(json, "content/brains.txt", size);
- info_parse_json(info, json, "brain");
info_read_file(json, "content/templates/default.txt", size);
info_parse_json(info, json, "template");
diff --git a/gst/info.h b/gst/info.h
index 1e22ea6..eab1a51 100644
--- a/gst/info.h
+++ b/gst/info.h
@@ -77,102 +77,18 @@ typedef struct {
int8_t levels[35];
} info_unit;
-typedef struct {
- char name[32];
- int damage_type;
- float weight[MAXLEVEL];
- float cooldown[MAXLEVEL];
- float damage[MAXLEVEL];
- float range[MAXLEVEL];
- float aoe[MAXLEVEL];
- int knockback[MAXLEVEL];
- float damage_battery[MAXLEVEL];
- int stun[MAXLEVEL];
- float reduce_armor[7][MAXLEVEL];
- float upkeep[MAXLEVEL];
- float charge_per_shot[MAXLEVEL];
-} info_weapon;
-
-typedef struct {
- char name[32];
- int slot_weapon[MAXLEVEL];
- int slot_armor[MAXLEVEL];
- int slot_aug[MAXLEVEL];
- float weight_max[MAXLEVEL];
- float hp[MAXLEVEL];
- float speed[MAXLEVEL];
- float upkeep[MAXLEVEL];
-} info_chassis;
-
-typedef struct {
- char name[32];
- float weight[MAXLEVEL];
- float capacity[MAXLEVEL];
- int recharge[MAXLEVEL];
-} info_battery;
-
-typedef struct {
- char name[32];
- float weight[MAXLEVEL];
- float armor[7][MAXLEVEL];
- float upkeep[MAXLEVEL];
-} info_armor;
-
-typedef struct {
- char name[32];
- float weight[MAXLEVEL];
- float add_damage[7][MAXLEVEL];
- float add_armor[7][MAXLEVEL];
- float add_range[MAXLEVEL];
- float add_cooldown[MAXLEVEL];
- float add_speed[MAXLEVEL];
- float add_hp[MAXLEVEL];
- float add_capacity[MAXLEVEL];
- float upkeep[MAXLEVEL];
-} info_aug;
-
-typedef struct {
- char name[32];
- float upkeep[MAXLEVEL];
-} info_brain;
typedef struct {
char damage_types[7][32];
info_unit templates[MAXTEMPLATES];
int templateslen;
- info_weapon weapons[64];
- int weaponslen;
- info_chassis chassis[32];
- int chassislen;
- info_battery batteries[32];
- int batterieslen;
- info_armor armors[32];
- int armorslen;
- info_aug augs[32];
- int augslen;
- info_brain brains[32];
- int brainslen;
stats_comp *stats[6];
int statslen[6];
} infos;
void info_unit_init (info_unit *u);
-float info_unit_get_capacity (infos *info, info_unit *u);
-float info_unit_get_upkeep (infos *info, info_unit *u);
-float info_unit_get_weight (infos *info, info_unit *u);
-float info_unit_get_dps (infos *info, info_unit *u);
-float info_unit_get_health(infos *info, info_unit *u);
-float info_unit_get_speed(infos *info, info_unit *u);
-float info_unit_get_damage(infos *info, info_unit *u, int w);
-float info_unit_get_charge_per_shot(infos *info, info_unit *u, int w);
-float info_unit_get_damage_target(infos *info, info_unit *u, int w,
- info_unit *t);
-float info_unit_get_cooldown(infos *info, info_unit *u, int w);
-float info_unit_get_range(infos *info, info_unit *u, int w);
-float info_unit_get_maxrange(infos *info, info_unit *u);
-float info_unit_get_armor(infos *info, info_unit *u, int d);
-float info_unit_get_cost(infos *info, info_unit *u);
+
int stats_frame_sprintf (infos *info, stats_frame *frame, char arr[][64]);
int stats_weapon_sprintf (infos *info, stats_weapon *weap, char arr[][64]);