From f7acf7c2d343681955d60d91728f9bbd8d8f8cc2 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 17 Apr 2025 13:48:24 +0200 Subject: [PATCH] fix up the automap again got the rest of stuff working in a horrible way automap aswell as minigen stuff looks good now --- src/am_map.c | 180 +++++++++++++++++++++++++++++++++++---------------- src/p_spec.c | 7 +- src/screen.c | 10 +-- 3 files changed, 135 insertions(+), 62 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index 69f7e4f65..c8172837a 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -898,6 +898,38 @@ static void AM_drawGrid(INT32 color) } } +static INT32 GetDamage(INT32 special) +{ + switch (special) + { + case 1: // Damage (Generic) + return 1; + case 6: // Death Pit (Camera Tilt) + return 6; + case 7: // Death Pit (No Camera Tilt) + return 7; + case 8: // Instant Kill + return 8; + default: + return 0; + } +} + +static INT32 GetOffroad(INT32 special) +{ + switch (special) + { + case 2: // Offroad (Weak) + return 2; + case 3: // Offroad + return 3; + case 4: // Offroad (Strong) + return 4; + default: + return 0; + } +} + #define SLOPEPARAMS(slope, end1, end2, normalheight) \ if (slope) { \ end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y) + FRACUNIT/2) >> FRACBITS; \ @@ -945,8 +977,27 @@ static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondaryst continue; if (rovb2 != secb2) continue; + + // this is fucking horrible + INT32 damage1, damage2; + INT32 offroad1, offroad2; + INT32 special1, special2; + special1 = GETSECSPECIAL(sectors[rover->secnum].special, 1); + special2 = GETSECSPECIAL(sectors[secondaryrover->secnum].special, 1); + + damage1 = GetDamage(special1); + damage2 = GetDamage(special2); + offroad1 = GetOffroad(special1); + offroad2 = GetOffroad(special2); + + if (damage1 != damage2 + //|| sectors[rover->secnum].friction != sectors[secondaryrover->secnum].friction + || offroad1 != offroad2) + continue; + break; } + if (secondaryrover == NULL) break; } @@ -1011,29 +1062,28 @@ static void AM_drawWalls(UINT8 pass) } else { - //dont think kart even supports those idk? - /*if (lines[i].flags & (ML_IMPASSABLE|ML_BLOCKPLAYERS)) + if (lines[i].flags & ML_IMPASSIBLE) // (ML_IMPASSABLE|ML_BLOCKPLAYERS) { if (pass & PASS_SOLID) AM_drawMline(&l, TSWALLCOLORS); // Completely solid course boundary } - else if ((lines[i].flags & ML_MIDSOLID) + else if ((lines[i].flags & ML_EFFECT4) // ML_MIDSOLID && sides[lines->sidenum[0]].midtexture) { if (pass & PASS_SOLID) AM_drawMline(&l, TSWALLCOLORS); // solid midtexture, likely a course boundary - }*/ + } if ((backf1 != frontf1 && abs(backf1 - frontf1) > maxstep) || (backf2 != frontf2 && abs(backf2 - frontf2) > maxstep)) { if (pass & PASS_SOLID) AM_drawMline(&l, TSWALLCOLORS); // floor-wall, likely a course boundary } - /*else if (lines[i].special == 2001) // guh its a sector effect in kart idk how to make it work tbh lol + else if (GETSECSPECIAL(lines[i].frontsector->special, 4) == 10 || GETSECSPECIAL(lines[i].backsector->special, 4) == 10) { if (pass & PASS_SOLID) AM_drawMline(&l, TSFINISHLINE); // finish line - }*/ + } else if (backf1 != frontf1 || backf2 != frontf2) { if (pass & PASS_INTANGIBLE) @@ -1055,54 +1105,52 @@ static void AM_drawWalls(UINT8 pass) } else { - { - ffloor_t *rover = NULL; + ffloor_t *rover = NULL; - if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors) + if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors) + { + if (lines[i].backsector->ffloors == NULL) { - if (lines[i].backsector->ffloors == NULL) + // Check frontside for one solid + for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next) { - // Check frontside for one solid - for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next) - { - if (!(rover->flags & FF_EXISTS)) - continue; - if (!(rover->flags & FF_BLOCKPLAYER)) - continue; - break; - } - } - else if (lines[i].frontsector->ffloors == NULL) - { - // Check backside for one solid - for (rover = lines[i].backsector->ffloors; rover; rover = rover->next) - { - if (!(rover->flags & FF_EXISTS)) - continue; - if (!(rover->flags & FF_BLOCKPLAYER)) - continue; - break; - } - } - else - { - // Check to see if any secnums exist in one but not the other. - rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors); - if (rover == NULL) - rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors); + if (!(rover->flags & FF_EXISTS)) + continue; + if (!(rover->flags & FF_BLOCKPLAYER)) + continue; + break; } } - if (rover != NULL) + else if (lines[i].frontsector->ffloors == NULL) { - if (pass & PASS_FOF) - AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet + // Check backside for one solid + for (rover = lines[i].backsector->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS)) + continue; + if (!(rover->flags & FF_BLOCKPLAYER)) + continue; + break; + } } - else if (!am_minigen) + else { - if (pass & PASS_INTANGIBLE) - AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line + // Check to see if any secnums exist in one but not the other. + rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors); + if (rover == NULL) + rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors); } } + if (rover != NULL) + { + if (pass & PASS_FOF) + AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet + } + else if (!am_minigen) + { + if (pass & PASS_INTANGIBLE) + AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line + } } } } @@ -1180,18 +1228,11 @@ static inline void AM_drawPlayers(void) player_t *p; INT32 color = GREENS; - if (!multiplayer) - { - AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<mo->angle, DWHITE, plr->mo->x, plr->mo->y); - return; - } - - // multiplayer (how??) for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || players[i].spectator) continue; - + if (!players[i].mo) continue; @@ -1213,7 +1254,37 @@ static inline void AM_drawThings(UINT8 colors) t = sectors[i].thinglist; while (t) { - AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<angle, colors, t->x, t->y); + if (!t->player) + AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<angle, colors, t->x, t->y); + t = t->snext; + } + } +} + +static inline void AM_drawSpecialThingsOnly(UINT8 colors) +{ + size_t i; + + for (i = 0; i < numsectors; i++) + { + mobj_t *t = NULL; + + // this is fucking horrible + const INT32 special = GETSECSPECIAL(sectors[i].special, 1); + + if (GetDamage(special) == 0 + //|| sectors[i].friction < ORIG_FRICTION + || GetOffroad(special) == 0) + continue; + + t = sectors[i].thinglist; + while (t) + { + if (t->type == MT_RANDOMITEM + || t->type == MT_RING + || t->type == MT_WAYPOINT + || (t->flags & MF_SPRING)) + AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<angle, colors, t->x, t->y); t = t->snext; } } @@ -1261,8 +1332,8 @@ void AM_Drawer(void) AM_clearFB(BACKGROUND); if (draw_grid) AM_drawGrid(GRIDCOLORS); AM_drawWalls(PASS_FOF|PASS_INTANGIBLE|PASS_SOLID); - AM_drawPlayers(); AM_drawThings(THINGCOLORS); + AM_drawPlayers(); if (!followplayer) AM_drawCrosshair(XHAIRCOLORS); } @@ -1318,6 +1389,7 @@ minigen_t *AM_MinimapGenerate(INT32 mul) //AM_clearFB(BACKGROUND); memset(am_buf, 0xff, (f_w*f_h)); + AM_drawSpecialThingsOnly(BACKGROUND); AM_drawWalls(PASS_FOF); AM_drawWalls(PASS_INTANGIBLE); AM_drawWalls(PASS_SOLID); diff --git a/src/p_spec.c b/src/p_spec.c index 7dc7ce6bb..42345e6dd 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3287,9 +3287,10 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers if (roversector || P_MobjReadyToTrigger(player->mo, sector)) P_DamageMobj(player->mo, NULL, NULL, 1); break; - case 2: // Damage (Water) // SRB2kart - These three damage types are now offroad sectors - case 3: // Damage (Fire) - case 4: // Damage (Electrical) + // SRB2kart - These three damage types are now offroad sectors + case 2: // Offroad (Weak) + case 3: // Offroad + case 4: // Offroad (Strong) break; case 5: // Spikes // Don't do anything. In Soviet Russia, spikes find you. diff --git a/src/screen.c b/src/screen.c index 1d83a409d..0a9468d25 100644 --- a/src/screen.c +++ b/src/screen.c @@ -455,7 +455,7 @@ void SCR_DisplayTicRate(void) // draw "FPS" if (cv_ticrate.value == 1) V_DrawFixedPatch(306< (benchmark - 5)) ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE); else if (fps < 20) @@ -474,10 +474,10 @@ void SCR_DisplayTicRate(void) // draw total frame: V_DrawPingNum(x, 190, fpsflags, cap, ticcntcolor); - + x -= digits * 4; - // draw "/" + // draw "/" V_DrawFixedPatch(x< servermaxping)) // only show 2 (warning) if our ping is at a bad level { INT32 dispy = (cv_ticrate.value == 1) ? 165 : ((cv_ticrate.value == 2 || cv_ticrate.value == 4) ? 172 : ((cv_ticrate.value == 3) ? 163 : 181)); // absolute buttpain