diff options
author | jacopo grandi <jak.sk8@hotmail.it> | 2021-02-22 20:18:25 +0100 |
---|---|---|
committer | jacopo grandi <jak.sk8@hotmail.it> | 2021-02-22 20:18:25 +0100 |
commit | f26a86bcc78c1946f55b6a399039e3bd8fb5dd16 (patch) | |
tree | 31feba3fa57b57a9997e34c7b46cf5f5886e9f07 | |
parent | 4842b67ab590250d95ad4be5fe61380a09b1e8ea (diff) |
fix maxrange and testing
-rw-r--r-- | build/army/balance 1000 melee.txt | bin | 0 -> 21560 bytes | |||
-rw-r--r-- | build/army/balance 1000 the second.txt | bin | 0 -> 21560 bytes | |||
-rw-r--r-- | build/army/balance 1000.txt | bin | 0 -> 21560 bytes | |||
-rw-r--r-- | build/army/balance melee maul.txt | bin | 0 -> 21560 bytes | |||
-rw-r--r-- | build/army/best army ever.txt | bin | 21560 -> 21560 bytes | |||
-rw-r--r-- | build/army/range test.txt | bin | 21560 -> 21560 bytes | |||
-rw-r--r-- | build/army/worst.txt | bin | 21560 -> 21560 bytes | |||
-rw-r--r-- | build/content/templates/default.txt | 60 | ||||
-rw-r--r-- | build/test.exe | bin | 786658 -> 786658 bytes | |||
-rw-r--r-- | design/notes.txt | 3 | ||||
-rw-r--r-- | gst/info.c | 7 | ||||
-rw-r--r-- | gst/units.c | 6 |
12 files changed, 68 insertions, 8 deletions
diff --git a/build/army/balance 1000 melee.txt b/build/army/balance 1000 melee.txt Binary files differnew file mode 100644 index 0000000..86ffd09 --- /dev/null +++ b/build/army/balance 1000 melee.txt diff --git a/build/army/balance 1000 the second.txt b/build/army/balance 1000 the second.txt Binary files differnew file mode 100644 index 0000000..6db93ae --- /dev/null +++ b/build/army/balance 1000 the second.txt diff --git a/build/army/balance 1000.txt b/build/army/balance 1000.txt Binary files differnew file mode 100644 index 0000000..a44f973 --- /dev/null +++ b/build/army/balance 1000.txt diff --git a/build/army/balance melee maul.txt b/build/army/balance melee maul.txt Binary files differnew file mode 100644 index 0000000..fede815 --- /dev/null +++ b/build/army/balance melee maul.txt diff --git a/build/army/best army ever.txt b/build/army/best army ever.txt Binary files differindex 1ed86d2..7e76ce1 100644 --- a/build/army/best army ever.txt +++ b/build/army/best army ever.txt diff --git a/build/army/range test.txt b/build/army/range test.txt Binary files differindex 44a5c2b..949cda9 100644 --- a/build/army/range test.txt +++ b/build/army/range test.txt diff --git a/build/army/worst.txt b/build/army/worst.txt Binary files differindex 79686b5..aac287a 100644 --- a/build/army/worst.txt +++ b/build/army/worst.txt diff --git a/build/content/templates/default.txt b/build/content/templates/default.txt index f99915c..b5bff58 100644 --- a/build/content/templates/default.txt +++ b/build/content/templates/default.txt @@ -38,5 +38,65 @@ "armor": [ 0, 0, 0, 0, -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 ] + }, + { + "name": "600 dude", + "chassis": "8", + "brain": "0", + "battery": "1", + "weapons": [ 2, -1, -1, -1, -1, -1, -1, -1 ], + "armor": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "augs": [ 8, 8, -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 ] + }, + { + "name": "300 bot dude", + "chassis": "0", + "brain": "0", + "battery": "0", + "weapons": [ 7, -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 ] + }, + { + "name": "400 perfect duud", + "chassis": "2", + "brain": "0", + "battery": "0", + "weapons": [ 0, 0, -1, -1, -1, -1, -1, -1 ], + "armor": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "augs": [ 16, -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 ] + }, + { + "name": "1000 tank boi", + "chassis": "11", + "brain": "0", + "battery": "0", + "weapons": [ 18, 16, -1, -1, -1, -1, -1, -1 ], + "armor": [ 0, 0, 0, -1, -1, -1, -1, -1 ], + "augs": [ 8, 8, -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 ] + }, + { + "name": "1000 melee bot friendo", + "chassis": "5", + "brain": "3", + "battery": "0", + "weapons": [ 10, 10, -1, -1, -1, -1, -1, -1 ], + "armor": [ 0, 0, 8, -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 ] + }, + { + "name": "2000 maul dodo", + "chassis": "4", + "brain": "0", + "battery": "1", + "weapons": [ 9, -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/build/test.exe b/build/test.exe Binary files differindex d68d851..01857dc 100644 --- a/build/test.exe +++ b/build/test.exe diff --git a/design/notes.txt b/design/notes.txt index 5333555..dabdd19 100644 --- a/design/notes.txt +++ b/design/notes.txt @@ -1,11 +1,11 @@ tasks: (date) -[ ] implement stats hud view (issued on 18:02:21) [ ] implement net hud and minilobby (issued on 18:02:21) [ ] implement brain behaviour (issued on 18:02:21) [ ] implement lobby cost constraints (issued on 18:02:21) [ ] implement edit unit directly (issued on 18:02:21) [ ] implement persistent settings ini (issued on 18:02:21) +[ ] implement stats hud view (issued on 18:02:21) [ ] implement move animation (issued on 18:02:21) [ ] implement fire animation (issued on 18:02:21) [ ] implement explosions (issued on 18:02:21) @@ -15,6 +15,7 @@ tasks: (date) [ ] design component sprites (issued on 18:02:21) [ ] implement sound (issued on 18:02:21) + [x] implement army hud view (issued on 18:02:21, done on 22:02:21) [x] implement naming template and army (issued on 18:02:21, done on 22:02:21) [x] implement cost function (issued on 18:02:21, done on 20:02:21) @@ -240,13 +240,14 @@ float info_unit_get_range(infos *info, info_unit *u, int w) { float info_unit_get_maxrange(infos *info, info_unit *u) { int lc = u->levels[LEVEL_CHASSIS]; - float sum = 0; + float max = 0; for(int i=0; i<info->chassis[u->chassis].slot_weapon[lc]; i++) { if (u->weapons[i] != -1) { - sum += info_unit_get_range(info, u, i); + float range = info_unit_get_range(info, u, i); + if (range > max) { max = range; } } } - return sum; + return max; } float info_unit_get_charge_per_shot (infos *info, info_unit *u, int w) { diff --git a/gst/units.c b/gst/units.c index 409f9b1..89c9489 100644 --- a/gst/units.c +++ b/gst/units.c @@ -64,7 +64,6 @@ void unit_remove (army *ar, map *m, unit *u) { ar->uslen--; ar->grid[xytoi(m, tx, ty)] = u; ar->grid[xytoi(m, ux, uy)] = NULL; - printf("ar->uslen: %d\n", ar->uslen); } void unit_dead (army *ar, map *m, unit *u) { @@ -76,7 +75,6 @@ void unit_search (infos *info, army *ar, map *m, unit *u, { for (int f=0; f<32; t[f] = NULL, f++); int mult[4][2] = { {1, 1},{1,-1},{-1,-1},{-1,1} }, x, y, dx, dy, tmp; - *t = NULL; for (int r=1; r<range*1.42 && *t==NULL; r++) { for (int k=0; k<4 && *t==NULL; k++) { for (int j=0; j<r && *t==NULL; j++) { @@ -96,8 +94,8 @@ void unit_search (infos *info, army *ar, map *m, unit *u, float diff[2] = { u->gridpos[0] - (*t)->gridpos[0], u->gridpos[1] - (*t)->gridpos[1] - }; float mag = vec2_mag(diff); - if (mag > range) *t = NULL; + }; float mag = vec2_mag2(diff); + if (mag > range*range) *t = NULL; } }}} } |