engine-c: denser Evolved heavies + harvester cargo bed
This commit is contained in:
parent
88631a5be6
commit
c3fd57f86c
3 changed files with 49 additions and 12 deletions
|
|
@ -359,7 +359,7 @@ static void place_showcase(Game *g, Faction human, Faction enemy) {
|
|||
}
|
||||
}
|
||||
|
||||
int raid[40];
|
||||
int raid[56];
|
||||
int rn = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
raid[rn++] = unit_spawn(g, UT_MUTANT, enemy,
|
||||
|
|
@ -369,17 +369,41 @@ static void place_showcase(Game *g, Faction human, Faction enemy) {
|
|||
raid[rn++] = unit_spawn(g, UT_BUGGY, enemy, rx + 8, ry - 28);
|
||||
raid[rn++] = unit_spawn(g, UT_BUGGY, enemy, rx + 28, ry - 34);
|
||||
raid[rn++] = unit_spawn(g, UT_BUGGY, enemy, rx + 48, ry - 22);
|
||||
raid[rn++] = unit_spawn(g, UT_JEEP, enemy, rx + 16, ry + 18);
|
||||
raid[rn++] = unit_spawn(g, UT_JEEP, enemy, rx + 36, ry + 8);
|
||||
raid[rn++] = unit_spawn(g, UT_TANK, enemy, rx + 52, ry + 4);
|
||||
raid[rn++] = unit_spawn(g, UT_TANK, enemy, rx + 68, ry - 12);
|
||||
raid[rn++] = unit_spawn(g, UT_TANK, enemy, rx + 80, ry + 18);
|
||||
raid[rn++] = unit_spawn(g, UT_RAVAGER, enemy, rx + 58, ry - 36);
|
||||
raid[rn++] = unit_spawn(g, UT_RAVAGER, enemy, rx + 74, ry - 24);
|
||||
raid[rn++] = unit_spawn(g, UT_RAVAGER, enemy, rx + 42, ry - 44);
|
||||
raid[rn++] = unit_spawn(g, UT_FLAME, enemy, rx + 22, ry + 28);
|
||||
raid[rn++] = unit_spawn(g, UT_FLAME, enemy, rx + 40, ry + 34);
|
||||
raid[rn++] = unit_spawn(g, UT_FLAME, enemy, rx + 8, ry + 40);
|
||||
raid[rn++] = unit_spawn(g, UT_MISSILE, enemy, rx + 62, ry - 28);
|
||||
raid[rn++] = unit_spawn(g, UT_MISSILE, enemy, rx + 78, ry - 8);
|
||||
raid[rn++] = unit_spawn(g, UT_MISSILE, enemy, rx + 94, ry + 6);
|
||||
raid[rn++] = unit_spawn(g, UT_ARTILLERY, enemy, rx + 85, ry + 10);
|
||||
raid[rn++] = unit_spawn(g, UT_ARTILLERY, enemy, rx + 98, ry - 18);
|
||||
for (int i = 0; i < 8; i++)
|
||||
raid[rn++] = unit_spawn(g, UT_INFANTRY, enemy,
|
||||
rx - 28 + (i % 4) * 14, ry - 8 + (i / 4) * 14);
|
||||
|
||||
|
||||
/* seed Survivor harvester beds so cargo silhouette is visible in shot */
|
||||
{
|
||||
int hi = 0;
|
||||
for (int i = 0; i < g->unit_count; i++) {
|
||||
Unit *u = &g->units[i];
|
||||
if (u->dead || u->type != UT_HARVESTER || u->faction != human) continue;
|
||||
float cap = (float)unit_def(u->type, u->faction)->cargo;
|
||||
/* stagger: empty-ish / mid / full across harvesters */
|
||||
float fracs[] = { 0.25f, 0.70f, 1.0f, 0.45f };
|
||||
u->cargo = cap * fracs[hi % 4];
|
||||
hi++;
|
||||
}
|
||||
}
|
||||
|
||||
/* pre-damage for HP-bar variety (sim may add more) */
|
||||
for (int i = 0; i < g->unit_count; i++) {
|
||||
Unit *u = &g->units[i];
|
||||
|
|
|
|||
|
|
@ -208,22 +208,34 @@ static void draw_unit(Unit *u, int sx, int sy) {
|
|||
tyre_mark(LX(8,23), LY(8,23), SI(3), ph, 0);
|
||||
tyre_mark(LX(22,23), LY(22,23), SI(3), ph, 0);
|
||||
break;
|
||||
case UT_HARVESTER:
|
||||
/* cabin nose + scrap bed ridges + wheels */
|
||||
case UT_HARVESTER: {
|
||||
/* cabin nose + cargo bed (empty dark → gold fill by u->cargo) + wheels */
|
||||
fill_rect(sx-SI(14), sy-SI(9), SI(28), SI(18), ok, og, ob);
|
||||
fill_rect(sx-SI(12), sy-SI(7), SI(24), SI(14), br, bg, bb);
|
||||
fill_rect(LX(4,10)-SI(1), LY(4,10)-SI(2), SI(8), SI(8), lr, lg, lb); /* cabin */
|
||||
fill_rect(LX(5,9)-SI(1), LY(5,9)-SI(1), SI(6), SI(3), 35, 55, 75); /* cabin glass */
|
||||
fill_rect(sx-SI(4), sy-SI(5), SI(14), SI(10), 200, 170, 90); /* bed */
|
||||
line(LX(14,10), LY(14,10), LX(26,10), LY(26,10), 160, 130, 70);
|
||||
line(LX(14,13), LY(14,13), LX(26,13), LY(26,13), 160, 130, 70);
|
||||
line(LX(14,16), LY(14,16), LX(26,16), LY(26,16), 160, 130, 70);
|
||||
int bed_w = SI(14), bed_h = SI(10);
|
||||
int bed_x = sx - SI(4), bed_y = sy - SI(5);
|
||||
fill_rect(bed_x, bed_y, bed_w, bed_h, 55, 48, 32); /* empty bed */
|
||||
float cap = (float)unit_def(u->type, u->faction)->cargo;
|
||||
float fill = (cap > 0.0f) ? (u->cargo / cap) : 0.0f;
|
||||
if (fill < 0.0f) fill = 0.0f;
|
||||
if (fill > 1.0f) fill = 1.0f;
|
||||
int fw = (int)(bed_w * fill + 0.5f);
|
||||
if (fw > 0)
|
||||
fill_rect(bed_x, bed_y, fw, bed_h, 200, 170, 90); /* cargo gold */
|
||||
if (fill > 0.15f) {
|
||||
line(LX(14,10), LY(14,10), LX(26,10), LY(26,10), 160, 130, 70);
|
||||
line(LX(14,13), LY(14,13), LX(26,13), LY(26,13), 160, 130, 70);
|
||||
line(LX(14,16), LY(14,16), LX(26,16), LY(26,16), 160, 130, 70);
|
||||
}
|
||||
disc(LX(8,23), LY(8,23), SI(4), mr, mg, mb);
|
||||
disc(LX(22,23), LY(22,23), SI(4), mr, mg, mb);
|
||||
tyre_mark(LX(8,23), LY(8,23), SI(4), ph, 1);
|
||||
tyre_mark(LX(22,23), LY(22,23), SI(4), ph, 1);
|
||||
line(LX(5,7), LY(5,7), LX(5,2), LY(5,2), lr, lg, lb);
|
||||
break;
|
||||
}
|
||||
case UT_JEEP:
|
||||
/* open cabin + roll bar + MG */
|
||||
fill_rect(sx-SI(11), sy-SI(6), SI(22), SI(12), ok, og, ob);
|
||||
|
|
|
|||
|
|
@ -139,15 +139,16 @@ SDL_Texture *sprites_make_unit(SDL_Renderer *r, UnitType t, Faction f) {
|
|||
disc(s, 22, 23, 3, tr, tg, tb, 255);
|
||||
break;
|
||||
case UT_HARVESTER:
|
||||
/* cabin nose + scrap bed ridges + wheels */
|
||||
/* cabin + mid-loaded cargo bed (static atlas; no live Unit) */
|
||||
fill_rect(s, 1, 6, 28, 18, ok, og, ob, 255);
|
||||
fill_rect(s, 3, 8, 24, 14, base.r, base.g, base.b, 255);
|
||||
fill_rect(s, 3, 8, 8, 8, lite.r, lite.g, lite.b, 255); /* cabin */
|
||||
fill_rect(s, 4, 8, 6, 3, 35, 55, 75, 255); /* cabin glass */
|
||||
fill_rect(s, 11, 10, 14, 10, 200, 170, 90, 255); /* bed */
|
||||
line(s, 14, 10, 26, 10, 160, 130, 70, 255);
|
||||
line(s, 14, 13, 26, 13, 160, 130, 70, 255);
|
||||
line(s, 14, 16, 26, 16, 160, 130, 70, 255);
|
||||
fill_rect(s, 11, 10, 14, 10, 55, 48, 32, 255); /* empty bed */
|
||||
fill_rect(s, 11, 10, 8, 10, 200, 170, 90, 255); /* ~half cargo gold */
|
||||
line(s, 14, 10, 19, 10, 160, 130, 70, 255);
|
||||
line(s, 14, 13, 19, 13, 160, 130, 70, 255);
|
||||
line(s, 14, 16, 19, 16, 160, 130, 70, 255);
|
||||
disc(s, 8, 23, 4, tr, tg, tb, 255);
|
||||
disc(s, 22, 23, 4, tr, tg, tb, 255);
|
||||
line(s, 5, 7, 5, 2, lite.r, lite.g, lite.b, 255);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue