MCPcopy Create free account
hub / github.com/ZDoom/Raze / renderDrawMapView

Function renderDrawMapView

source/core/automap.cpp:500–587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498//---------------------------------------------------------------------------
499
500static void renderDrawMapView(const DVector2& cpos, const DVector2& cangvect, const DVector2& xydim)
501{
502 TArray<FVector4> vertices;
503 TArray<DCoreActor*> floorsprites;
504
505 for (int i = (int)sector.Size() - 1; i >= 0; i--)
506 {
507 auto sect = &sector[i];
508 if (!gFullMap && !show2dsector[i]) continue;
509
510 //Collect floor sprites to draw
511 TSectIterator<DCoreActor> it(sect);
512 while (auto act = it.Next())
513 {
514 if (act->spr.cstat & CSTAT_SPRITE_INVISIBLE)
515 continue;
516
517 if (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) // floor and slope sprites
518 {
519 if ((act->spr.cstat & (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_YFLIP)) == (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_YFLIP))
520 continue; // upside down
521 floorsprites.Push(act);
522 }
523 }
524
525 if (sect->floorstat & CSTAT_SECTOR_SKY) continue;
526
527 auto flortex = sect->floortexture;
528 if (!flortex.isValid()) continue;
529
530 auto translation = TRANSLATION(Translation_Remap + curbasepal, sector[i].floorpal);
531 PalEntry light = shadeToLight(sector[i].floorshade);
532
533 for (auto section : sectionsPerSector[i])
534 {
535 TArray<int>* indices;
536 auto mesh = sectionGeometry.get(&sections[section], 0, { 0.f, 0.f }, &indices);
537 vertices.Resize(mesh->vertices.Size());
538 for (unsigned j = 0; j < mesh->vertices.Size(); j++)
539 {
540 auto v = OutAutomapVector(DVector2(mesh->vertices[j].X - cpos.X, -mesh->vertices[j].Y - cpos.Y), cangvect, gZoom, xydim);
541 vertices[j] = { float(v.X), float(v.Y), mesh->texcoords[j].X, mesh->texcoords[j].Y };
542 }
543
544 twod->AddPoly(TexMan.GetGameTexture(flortex, true), vertices.Data(), vertices.Size(), (unsigned*)indices->Data(), indices->Size(), translation, light,
545 LegacyRenderStyles[STYLE_Translucent], &viewport3d);
546 }
547 }
548 qsort(floorsprites.Data(), floorsprites.Size(), sizeof(DCoreActor*), [](const void* a, const void* b)
549 {
550 auto A = *(DCoreActor**)a;
551 auto B = *(DCoreActor**)b;
552 if (A->spr.pos.Z < B->spr.pos.Z) return 1;
553 if (A->spr.pos.Z > B->spr.pos.Z) return -1;
554 return A->time - B->time; // ensures stable sort.
555 });
556
557 vertices.Resize(4);

Callers 1

DrawOverheadMapFunction · 0.85

Calls 15

TRANSLATIONFunction · 0.85
shadeToLightFunction · 0.85
OutAutomapVectorFunction · 0.85
GetFlatSpritePositionFunction · 0.85
GetRenderStyleFunction · 0.85
GetAlphaFromBlendFunction · 0.85
AddPolyMethod · 0.80
GetGameTextureMethod · 0.80
sectorMethod · 0.80
spritetextureMethod · 0.80
SizeMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected