aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/Arena.exebin176654 -> 177709 bytes
-rw-r--r--build/army/mins.txt (renamed from build/army/all maul.txt)bin25656 -> 25656 bytes
-rw-r--r--build/army/new army 0.txtbin25656 -> 25656 bytes
-rw-r--r--build/army/new army.txtbin25656 -> 25656 bytes
-rw-r--r--build/content/augments.txt32
-rw-r--r--build/content/gf.bmpbin37978 -> 37978 bytes
-rw-r--r--build/content/templates/default.txt16
-rw-r--r--design/notes.txt7
-rw-r--r--gst/generate.c63
-rw-r--r--gst/generate.h2
-rw-r--r--gst/gst.c17
-rw-r--r--gst/gst.h4
-rw-r--r--gst/info.c28
-rw-r--r--gst/info.h2
-rw-r--r--gst/units.c7
-rw-r--r--hud/hud.c31
-rw-r--r--hud/hud.h1
-rw-r--r--hud/hud_views.c11
-rw-r--r--main.c5
-rw-r--r--render/render_text.c1
-rw-r--r--test/test_gst.c2
21 files changed, 163 insertions, 66 deletions
diff --git a/build/Arena.exe b/build/Arena.exe
index 9015cd1..314abe0 100644
--- a/build/Arena.exe
+++ b/build/Arena.exe
Binary files differ
diff --git a/build/army/all maul.txt b/build/army/mins.txt
index 2bcb86e..7ff2597 100644
--- a/build/army/all maul.txt
+++ b/build/army/mins.txt
Binary files differ
diff --git a/build/army/new army 0.txt b/build/army/new army 0.txt
index be2643b..65658ce 100644
--- a/build/army/new army 0.txt
+++ b/build/army/new army 0.txt
Binary files differ
diff --git a/build/army/new army.txt b/build/army/new army.txt
index 5acae18..5d02299 100644
--- a/build/army/new army.txt
+++ b/build/army/new army.txt
Binary files differ
diff --git a/build/content/augments.txt b/build/content/augments.txt
index 77417fe..192a6dd 100644
--- a/build/content/augments.txt
+++ b/build/content/augments.txt
@@ -6,7 +6,7 @@
12.5,
15.0
],
- "base_weapon_damage_emp": [
+ "perc_weapon_damage_emp": [
5.0,
6.25,
7.5
@@ -19,7 +19,7 @@
12.5,
15.0
],
- "base_weapon_damage_fusion": [
+ "perc_weapon_damage_fusion": [
4.0,
5.0,
6.0
@@ -32,7 +32,7 @@
37.5,
45.0
],
- "base_armor_explosive": [
+ "perc_armor_explosive": [
8.0,
10.0,
12.0
@@ -81,7 +81,7 @@
1.25,
1.5
],
- "base_aoe": [
+ "base_effect_aoe": [
2.0,
2.0,
2.0
@@ -94,10 +94,10 @@
0.0,
0.0
],
- "perc_range": [
- 1.0,
- 1.25,
- 1.5
+ "perc_weapon_range": [
+ 10.0,
+ 12.5,
+ 15.0
]
},
{
@@ -108,9 +108,9 @@
7.5
],
"perc_weapon_cooldown": [
- -0.1,
- -0.125,
- -0.15000000000000002
+ -10,
+ -12.5,
+ -15
]
},
{
@@ -120,7 +120,7 @@
12.5,
15.0
],
- "base_weapon_damage_laser": [
+ "perc_weapon_damage_laser": [
8.0,
10.0,
12.0
@@ -138,7 +138,7 @@
3.75,
4.5
],
- "base_weapon_damage_laser": [
+ "perc_weapon_damage_laser": [
3.0,
3.75,
4.5
@@ -151,12 +151,12 @@
37.5,
45.0
],
- "base_weapon_damage_laser": [
+ "perc_weapon_damage_laser": [
3.0,
3.75,
4.5
],
- "base_weapon_damage_fusion": [
+ "perc_weapon_damage_fusion": [
5.0,
6.25,
7.5
@@ -169,7 +169,7 @@
6.25,
7.5
],
- "base_weapon_damage_explosive": [
+ "perc_weapon_damage_explosive": [
5.0,
6.25,
7.5
diff --git a/build/content/gf.bmp b/build/content/gf.bmp
index b2f7aa5..0c3424e 100644
--- a/build/content/gf.bmp
+++ b/build/content/gf.bmp
Binary files differ
diff --git a/build/content/templates/default.txt b/build/content/templates/default.txt
index aba99e1..1806a9c 100644
--- a/build/content/templates/default.txt
+++ b/build/content/templates/default.txt
@@ -1,6 +1,6 @@
[
{
- "name": "pussy destoryer",
+ "name": "lmao 1",
"chassis": "14",
"brain": "5",
"battery": "1",
@@ -10,7 +10,7 @@
"levels": [ 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
},
{
- "name": "withname",
+ "name": "boa 2",
"chassis": "0",
"brain": "0",
"battery": "0",
@@ -20,7 +20,7 @@
"levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
},
{
- "name": "pussy destoryer",
+ "name": "ridge",
"chassis": "0",
"brain": "5",
"battery": "1",
@@ -28,5 +28,15 @@
"armor": [ 0, 0, 0, 0, 0, 0, -1, -1 ],
"augs": [ 15, 15, 15, 15, 15, 15, -1, -1 ],
"levels": [ 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
+ },
+ {
+ "name": "min",
+ "chassis": "0",
+ "brain": "0",
+ "battery": "0",
+ "weapons": [ 0, -1, -1, -1, -1, -1, -1, -1 ],
+ "armor": [ -1, -1, -1, -1, -1, -1, -1, -1 ],
+ "augs": [ -1, -1, -1, -1, -1, -1, -1, -1 ],
+ "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
}
] \ No newline at end of file
diff --git a/design/notes.txt b/design/notes.txt
index 127dfeb..6528db6 100644
--- a/design/notes.txt
+++ b/design/notes.txt
@@ -57,6 +57,7 @@ bugs:
[ ] symmetric integration (found on 18:02:21)
(on army movement and fire, equal armies should fair equally)
[ ] cross pc net broken (found on 02:03:21)
+[ ] army saving is broken (found on 05:03:21)
[x] ip text edit rect too small (found on 02:03:21, done on 02:03:21)
[x] cannot modify level of first aug (found on 02:03:21, done on 02:03:21)
@@ -69,6 +70,7 @@ testing:
[ ] write test suite (issued on 19:02:21)
[ ] hud states/flags/input interactions (issued on 22:02:21)
+[x] implement step-by-step gst option (issued on 05:02:21, done on 05:03:21)
[x] armor calculations (issued on 18:02:21, done on 02:03:21)
@@ -90,6 +92,11 @@ view from 02:03:21 to the end:
details:
+symmetric integration (bug):
+ there seems to be a movement preference along vector 1, -1
+ mabye i'm prioritizing moves to that direction by selecting the first one
+ in the cicle and then exiting.
+
test suite:
automatic common test cases
is it necessary? yes
diff --git a/gst/generate.c b/gst/generate.c
index 1d8a340..3339ad7 100644
--- a/gst/generate.c
+++ b/gst/generate.c
@@ -10,6 +10,7 @@ void generate_init () {
}
float calc_unit_cost (infos *info, info_unit *u) {
+ if (u->chassis == -1) return 0;
stats_unit base;
stats_unit_compute(info, u, &base);
return stats_compute_cost(&info->cost_weights, &base);
@@ -24,6 +25,35 @@ int accept_cond (infos *info, info_unit *u, float cost_max) {
return 1;
}
+int gen_add_comp (infos *info, stats_unit *base, info_unit *u) {
+ int sel = rand() % 3;
+ if (sel == 0) {
+ for (int i=0; i<base->frame.slot_weapon; i++) {
+ if (u->weapons[i] == -1) {
+ u->weapons[i] = rand() % info->statslen[STATS_WEAPONS];
+ break;
+ }
+ }
+ }
+ else if (sel == 1) {
+ for (int i=0; i<base->frame.slot_armor; i++) {
+ if (u->armor[i] == -1) {
+ u->armor[i] = rand() % info->statslen[STATS_ARMOR];
+ break;
+ }
+ }
+ }
+ else if (sel == 2) {
+ for (int i=0; i<base->frame.slot_aug; i++) {
+ if (u->augs[i] == -1) {
+ u->augs[i] = rand() % info->statslen[STATS_AUGS];
+ break;
+ }
+ }
+ }
+ return sel;
+}
+
// generates randomly a valid unit
void gen_unit_attempt (infos *info, info_unit *u, float cost_max) {
info_unit_init(u);
@@ -32,27 +62,33 @@ void gen_unit_attempt (infos *info, info_unit *u, float cost_max) {
u->battery = rand() % info->statslen[STATS_BATTERY];
u->brain = rand() % info->statslen[STATS_BRAIN];
stats_unit_compute(info, u, &base);
- for (int i=0; i<base.frame.slot_weapon; i++) {
- u->weapons[i] = rand() % info->statslen[STATS_WEAPONS];
- if (!accept_cond(info, u, cost_max)) { u->weapons[i] = -1; return; }
- }
- for (int i=0; i<base.frame.slot_armor; i++) {
- u->armor[i] = rand() % info->statslen[STATS_ARMOR];
- if (!accept_cond(info, u, cost_max)) { u->armor[i] = -1; return; }
- }
- for (int i=0; i<base.frame.slot_aug; i++) {
- u->augs[i] = rand() % info->statslen[STATS_AUGS];
- if (!accept_cond(info, u, cost_max)) { u->augs[i] = -1; return; }
+ for (int i=0; i<8*8*16; i++) {
+ int sel = gen_add_comp(info, &base, u);
+ if (sel == 0) {
+ if (!accept_cond(info, u, cost_max)) {
+ u->weapons[i] = -1; return;
+ }
+ }
+ if (sel == 1) {
+ if (!accept_cond(info, u, cost_max)) {
+ u->armor[i] = -1; return;
+ }
+ }
+ if (sel == 2) {
+ if (!accept_cond(info, u, cost_max)) {
+ u->augs[i] = -1; return;
+ }
+ }
}
}
// selects the max cost generated unit
int generate_unit (infos *info, info_unit *u, float cost_max) {
- info_unit cand = *u;
+ info_unit cand;
info_unit candmax; info_unit_init(&candmax);
float cost;
for (int i=0; i<GENERATE_UNIT_MAX_ATTEMPTS; i++) {
- cand = *u;
+ info_unit_init(&cand);
gen_unit_attempt(info, &cand, cost_max);
if (accept_cond(info, &cand, cost_max)) {
if (calc_unit_cost(info, &cand)
@@ -63,6 +99,7 @@ int generate_unit (infos *info, info_unit *u, float cost_max) {
}
}
if (candmax.chassis != -1) {
+ printf("i generated!\n");
*u = candmax;
return 0;
}
diff --git a/gst/generate.h b/gst/generate.h
index a4da2d6..4c30a96 100644
--- a/gst/generate.h
+++ b/gst/generate.h
@@ -3,7 +3,7 @@
#include "info.h"
-#define GENERATE_UNIT_MAX_ATTEMPTS 48637
+#define GENERATE_UNIT_MAX_ATTEMPTS 128
void generate_init ();
int generate_unit (infos *info, info_unit *u, float cost);
diff --git a/gst/gst.c b/gst/gst.c
index d3d4ee8..3b2576f 100644
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -14,6 +14,7 @@ void gst_init (gamestate *gst) {
gst->turn = 0;
gst->coveredtime = 0;
gst->turnspeed = 0.75;
+ gst->waitstep = 0;
}
void gst_destroy (gamestate *gst) {
@@ -172,12 +173,18 @@ void gst_next_turn (gamestate *gst, infos *info, fxs *fx, float t) {
gst_spawn_bullets(gst, fx, dmgs, fire, t);
}
-void gst_process (gamestate *gst, infos *info, fxs *fx, float t) {
+void gst_process (gamestate *gst, infos *info, MKb *mkb, fxs *fx, float t) {
if (gst->state == 1) {
- if (gst->starttime > t) gst->starttime = t;
- float t_elapsed = t-gst->starttime;
- if (t_elapsed >= gst->coveredtime) {
- gst_next_turn(gst, info, fx, t);
+ if (gst->waitstep) {
+ if (mkb_search(mkb, SDL_SCANCODE_SPACE)) {
+ gst_next_turn(gst, info, fx, t);
+ }
+ } else {
+ if (gst->starttime > t) gst->starttime = t;
+ float t_elapsed = t-gst->starttime;
+ if (t_elapsed >= gst->coveredtime) {
+ gst_next_turn(gst, info, fx, t);
+ }
}
}
}
diff --git a/gst/gst.h b/gst/gst.h
index c7ba752..992d31d 100644
--- a/gst/gst.h
+++ b/gst/gst.h
@@ -6,6 +6,7 @@
#include "map.h"
#include "fxs.h"
#include "../render/render_text.h"
+#include "../mkb/mkb.h"
#include <SDL2/SDL.h>
@@ -30,6 +31,7 @@ typedef struct {
float turnspeed;
int turn_until_finish;
int over;
+ int waitstep;
} gamestate;
void gst_init (gamestate *gst);
@@ -42,7 +44,7 @@ void gst_toeditor (gamestate *gst);
void gst_next_turn (gamestate *gst, infos *info, fxs *fx, float t);
int gst_check_victory (gamestate *gst);
-void gst_process (gamestate *gst, infos *info, fxs *fx, float t);
+void gst_process (gamestate *gst, infos *info, MKb *mkb, fxs *fx, float t);
void gst_render (SDL_Renderer *rend, SDL_Texture *txsprites, txtd *textd,
gamestate *gst, infos *info, float t);
diff --git a/gst/info.c b/gst/info.c
index cb1d9f1..714222b 100644
--- a/gst/info.c
+++ b/gst/info.c
@@ -240,8 +240,8 @@ int stats_frame_sprintf (infos *info, stats_frame *frame, char arr[][64]) {
PRINT_STRUCT(frame, "capacity", capacity, .0f);
PRINT_STRUCT(frame, "recharge", recharge, .1f);
LOOP(7) {
- char str[64]; sprintf(str, "%s armor", info->damage_types[i]);
- PRINT_STRUCT(frame, str, armor[z], f);
+ char str[64]; sprintf(str, "%s armor", info->damage_types[z]);
+ PRINT_STRUCT(frame, str, armor[z], .1f);
}
return i;
}
@@ -249,7 +249,7 @@ int stats_frame_sprintf (infos *info, stats_frame *frame, char arr[][64]) {
int stats_weapon_sprintf (infos *info, stats_weapon *weap, char arr[][64]) {
int i = 0;
LOOP(7) {
- char str[64]; sprintf(str, "%s damage", info->damage_types[i]);
+ char str[64]; sprintf(str, "%s damage", info->damage_types[z]);
PRINT_STRUCT(weap, str, damage[z], .1f);
}
PRINT_STRUCT(weap, "cooldown", cooldown, .2f);
@@ -260,7 +260,7 @@ int stats_weapon_sprintf (infos *info, stats_weapon *weap, char arr[][64]) {
PRINT_STRUCT(weap, "stun", stun, .0f);
PRINT_STRUCT(weap, "charge per shot", charge_per_shot, .2f);
LOOP(7) {
- char str[64]; sprintf(str, "%s armor reduce", info->damage_types[i]);
+ char str[64]; sprintf(str, "%s armor reduce", info->damage_types[z]);
PRINT_STRUCT(weap, str, armor_reduce[z], .1f);
}
return i;
@@ -540,6 +540,25 @@ float f_add1 (float x) { return x+1; }
void cost_weights_init (stats_unit *w) {
stats_unit_init(w);
stats_unit_map(w, f_add1);
+ w->frame.hp = 0.2;
+ w->frame.weight = 0;
+ w->frame.weight_max = 0;
+ w->frame.slot_weapon = 50;
+ w->frame.slot_armor = 20;
+ w->frame.slot_aug = 10;
+ w->frame.speed = 35;
+ w->frame.capacity = 0.05;
+ LOOP(7) w->frame.armor[z] = 0.1;
+ for (int i=0; i<8; i++) {
+ LOOP(7) w->weapon[i].damage[z] = 1;
+ LOOP(7) w->weapon[i].armor_reduce[z] = 0.02;
+ w->weapon[i].cooldown = -20;
+ w->weapon[i].range = 30;
+ w->weapon[i].aoe = 240;
+ w->weapon[i].knockback = 20;
+ w->weapon[i].damage_battery = 0.01;
+ w->weapon[i].stun = 100;
+ }
}
float f_sum (float a, float b) { return a+b; }
@@ -548,6 +567,7 @@ float stats_compute_cost (stats_unit *w, stats_unit *base) {
stats_unit costed = *base;
stats_unit_mul(&costed, w);
float cost = stats_unit_fold(&costed, f_sum);
+ if (cost < 0) cost = 0;
return cost;
}
diff --git a/gst/info.h b/gst/info.h
index 4f04a34..a433aaa 100644
--- a/gst/info.h
+++ b/gst/info.h
@@ -1,7 +1,7 @@
#ifndef INFO_H
#define INFO_H
-#define MAXTEMPLATES 128
+#define MAXTEMPLATES 1024
#define MAXLEVEL 3
#include <stdint.h>
diff --git a/gst/units.c b/gst/units.c
index 0297266..b5d05a9 100644
--- a/gst/units.c
+++ b/gst/units.c
@@ -155,10 +155,8 @@ int army_move_step (infos *info, army *ar, map *m, stats_unit *ustats) {
}
}
// execution
- int sum = 0, lastsum = -1, step = 0;
+ int sum = 0, step = 0;
for (; step<MAXSOLVESTEPS; step++) {
- if (sum == lastsum) { break; }
- lastsum = sum;
sum = 0;
for (int i=0; i<mclen; i++) {
int dest[2] = {
@@ -170,9 +168,10 @@ int army_move_step (infos *info, army *ar, map *m, stats_unit *ustats) {
mcs[i].done = 1;
mcs[i].u->move_points -= 1;
orders++;
+ sum++;
}
- sum += mcs[i].done;
}
+ if (sum == 0) { break; }
}
if (step == MAXSOLVESTEPS) { printf("army: max steps reached\n"); }
if (orders > 0) return 0;
diff --git a/hud/hud.c b/hud/hud.c
index d85d618..40983a7 100644
--- a/hud/hud.c
+++ b/hud/hud.c
@@ -7,6 +7,7 @@
#include "hud_views.h"
#include "../umath/intersect.h"
+#include "../gst/generate.h"
// TODO: make sound module mabye?
#define SOUND_MOUSE_OVER 0
@@ -38,7 +39,8 @@ void init_sel_chassis (graphic_settings *gs, hud_sel *sc, txtd *t,
}
void init_form_new_unit (graphic_settings *gs, form_new_unit *fnu, txtd *t) {
- int w = 290+200+300+20*2+10*4 + 30*3 + 200, h = 145+300+20*2+10*1 + 30*2;
+ int w = 290+200+300+20*2+10*4 + 30*3 + 200;
+ int h = 145+300+20*2+10*1 +30*2 +10;
int x = gs->resx/2-w/2, y = gs->resy/2-h/2;
SDL_Rect_init(&fnu->rect_back, x, y, w, h);
@@ -58,11 +60,14 @@ void init_form_new_unit (graphic_settings *gs, form_new_unit *fnu, txtd *t) {
x+20+500+20+160+30*2, y+20+60*i +30, 150, 50);
}
- SDL_Rect_init(&fnu->rect_stats, x+w-20-200, y+20, 200, h-70 );
+ SDL_Rect_init(&fnu->rect_stats, x+w-20-200, y+20, 200, h-52 );
- int width = get_text_width("save", t);
- button bdone = { "save", 4, { x+w-4*2-width-20, y+h-4*2-11-20 } };
+ button bdone = { "save", 4, { x+5, y+h-4*2-10-5 } };
fnu->done = bdone;
+
+ int width = get_text_width("randomize", t);
+ button brand = { "randomize", 4, { x+w-4*2-width-5, y+h-4*2-10-5 } };
+ fnu->randomize = brand;
}
void init_overlay_game (graphic_settings *gs, overlay_game *og, txtd *t) {
@@ -314,12 +319,10 @@ void hud_process_form_new_unit (graphic_settings *gs, hud *h, MKb *mkb,
if (mouse_in_button(mousepos, t, &h->fnu.done)) {
hud_close_fnu(h, info);
Mix_PlayChannel( -1, sounds[SOUND_SUCCESS], 0 );
- /*
- for (int i=0; i<ar->uslen; i++) {
- unit *u = ar->us+i;
- unit_init(info, ar, m, u->gridpos[0], u->gridpos[1],
- &u->info, 0, u);
- }*/
+ }
+ if (mouse_in_button(mousepos, t, &h->fnu.randomize)) {
+ generate_unit(info, &h->fnu.uinfo, 10000);
+ Mix_PlayChannel( -1, sounds[SOUND_SUCCESS], 0 );
}
float possc[2] = { h->fnu.rect_chassis.x, h->fnu.rect_chassis.y };
float sizesc[2] = { h->fnu.rect_chassis.w, h->fnu.rect_chassis.h };
@@ -911,7 +914,7 @@ void hud_render_form_new_unit (form_new_unit *fnu, MKb *mkb,
char schassis[32] = "CHASSIS";
float wchassis = get_text_width(schassis, t)*2;
float pchassis[2] = {
- fnu->rect_chassis.x+fnu->rect_chassis.w/2 - wchassis / 2,
+ fnu->rect_chassis.x+fnu->rect_chassis.w / 2 - wchassis / 2,
fnu->rect_chassis.y+fnu->rect_chassis.h + 7
};
render_text_scaled(rend, schassis, pchassis, t, 2);
@@ -964,12 +967,14 @@ void hud_render_form_new_unit (form_new_unit *fnu, MKb *mkb,
if (err==2) strcpy(serr, "select a battery");
if (err==3) strcpy(serr, "select a controller");
if (err==4) strcpy(serr, "overburdened, remove weight");
- float werr = get_text_width(serr, t);
+ float werr = get_text_width("done", t);
float perr[2] = {
- fnu->done.pos[0]-werr-10,
+ fnu->done.pos[0]+werr+4*2+10,
fnu->done.pos[1]+fnu->done.pad
};
render_text_scaled(rend, serr, perr, t, 1);
+
+ render_button(rend, t, &fnu->randomize);
render_view_chassis(rend, t,
fnu->rect_chassis.x, fnu->rect_chassis.y,
diff --git a/hud/hud.h b/hud/hud.h
index 48c877b..0086561 100644
--- a/hud/hud.h
+++ b/hud/hud.h
@@ -65,6 +65,7 @@ typedef struct {
SDL_Rect rect_augs[8];
SDL_Rect rect_stats;
button done;
+ button randomize;
info_unit uinfo;
info_unit *uinfo_ptr;
int sel, ind;
diff --git a/hud/hud_views.c b/hud/hud_views.c
index 385501e..cd39611 100644
--- a/hud/hud_views.c
+++ b/hud/hud_views.c
@@ -43,7 +43,11 @@ void render_view_comp (SDL_Renderer* rend, txtd *t, int px, int py,
}
{
int n = stats_frame_sprintf(info, comp->perc +lvl, arr);
- for (int i=0; i<n; i++) { LABEL(px+pad, py+h, arr[i], 1); h += 15; }
+ for (int i=0; i<n; i++) {
+ char sperc[128]; sprintf(sperc, "%s%%", arr[i]);
+
+ LABEL(px+pad, py+h, sperc, 1); h += 15;
+ }
}
{
int n = stats_weapon_sprintf(info, comp->base_weapon +lvl, arr);
@@ -51,7 +55,10 @@ void render_view_comp (SDL_Renderer* rend, txtd *t, int px, int py,
}
{
int n = stats_weapon_sprintf(info, comp->perc_weapon +lvl, arr);
- for (int i=0; i<n; i++) { LABEL(px+pad, py+h, arr[i], 1); h += 15; }
+ for (int i=0; i<n; i++) {
+ char sperc[128]; sprintf(sperc, "%s%%", arr[i]);
+ LABEL(px+pad, py+h, sperc, 1); h += 15;
+ }
}
}
diff --git a/main.c b/main.c
index 5c7400b..c66cec0 100644
--- a/main.c
+++ b/main.c
@@ -99,11 +99,12 @@ int main( int argc, char* args[] ) {
infos info;
info_load(&info);
+ /* move to tests
info_unit ugen; generate_unit(&info, &ugen, 10000);
stats_unit base; stats_unit_compute(&info, &ugen, &base);
stats_unit_printf(&info, &base);
info_unit_printf(&ugen);
- printf("COST: %.2f\n", stats_compute_cost(&info.cost_weights, &base));
+ printf("COST: %.2f\n", stats_compute_cost(&info.cost_weights, &base));*/
gamestate gst;
gst_init(&gst);
@@ -180,7 +181,7 @@ int main( int argc, char* args[] ) {
gst.army_bp+0, &gst.map_editor, &textd, &gst,
&netc, &nets, sounds);
- gst_process(&gst, &info, &fx, tot_time);
+ gst_process(&gst, &info, &mkb, &fx, tot_time);
fx_process(&fx, tot_time);
render = 1;
diff --git a/render/render_text.c b/render/render_text.c
index 75b2c91..2eb5128 100644
--- a/render/render_text.c
+++ b/render/render_text.c
@@ -10,6 +10,7 @@ void char_width_init (int *char_width) {
char_width[','] = 1; char_width['-'] = 3; char_width['.'] = 1;
char_width['/'] = 4; char_width['!'] = 1;
char_width[':'] = 1; char_width[';'] = 1;
+ char_width['%'] = 4;
char_width['<'] = 3; char_width['>'] = 3; char_width['='] = 4;
char_width['I'] = 1;
char_width['f'] = 4; char_width['i'] = 1; char_width['j'] = 3;
diff --git a/test/test_gst.c b/test/test_gst.c
index 75e2606..d54e15c 100644
--- a/test/test_gst.c
+++ b/test/test_gst.c
@@ -31,7 +31,7 @@ int test_gst_mirror_match (infos *info, int n) {
float t = 0; int i=0;
for (; i < 2000; i++) {
- gst_process(&gst, info, &fx, t);
+ gst_next_turn(&gst, info, &fx, t);
t += gst.turnspeed;
if (gst.over == 1) {
break;