HUD map
- Jonathan
- A Brave Victim
- Posts: 3391
- Joined: Thu Feb 03, 2005 12:50 am
- Location: Not really lurking anymore
One way to get a background:
Code: Select all
void DrawMap(bool rimWalls, bool cycleWalls, bool cycles,
double cycleSize, double border,
double x, double y, double w, double h,
double rw, double rh, double ix, double iy,
GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
...
glMultMatrixf(m);
if(a > 0) {
glColor4f(r, g, b, a);
glRectf(lx, ly, hx, hy);
}
if(rimWalls)
ˌɑrməˈɡɛˌtrɑn
- Jonathan
- A Brave Victim
- Posts: 3391
- Joined: Thu Feb 03, 2005 12:50 am
- Location: Not really lurking anymore
Only 600. 
Edit: Currently my code:

Edit: Currently my code:
Code: Select all
#define DONTDOIT
#include "rRender.h"
#include "rScreen.h"
#include "tConfiguration.h"
#include "eFloor.h"
#include "eTimer.h"
void DrawMap(bool rimWalls, bool cycleWalls, bool cycles,
double cycleSize, double border,
double x, double y, double w, double h,
double rw, double rh, double ix, double iy,
GLfloat r, GLfloat g, GLfloat b, GLfloat a);
static int simplemapmode = 0;
static tConfItem<int> simplemapmode_con("SIMPLE_MAP", simplemapmode);
static void drawsimplemap() {
if(!se_mainGameTimer) return;
// I haven't checked possible initial matrix state, so init to identity and modelview
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
if(simplemapmode & 1)
DrawMap(true, true, true,
5.5, 10,
.5, -1, .5, .5 * sr_screenWidth / sr_screenHeight,
.25 * sr_screenWidth, .25 * sr_screenWidth, 1, 0,
0, 0, 0, 0);
if(simplemapmode & 2) {
REAL r, g, b;
se_FloorColor(r, g, b);
DrawMap(true, true, true,
5.5, 10,
-1, -1, 2, 2,
sr_screenWidth, sr_screenHeight, .5, .5,
r, g, b, .5);
}
if(simplemapmode & 4) {
REAL r, g, b;
se_FloorColor(r, g, b);
unsigned xcount=30;
unsigned ycount=20;
unsigned x, y;
for(y=0; y<ycount; y++) {
for(x=0; x<xcount; x++) {
DrawMap(true, true, true,
5.5, 10,
2.0 / xcount * x - 1, 2.0 / ycount * y - 1, 2.0 / xcount, 2.0 / ycount,
2.0 / xcount * sr_screenWidth, 2.0 / ycount * sr_screenHeight, x / (xcount - 1.0), y / (ycount - 1.0),
r, g, b, .5);
}
}
}
}
static rPerFrameTask simplemaptask(&drawsimplemap);
ˌɑrməˈɡɛˌtrɑn
- Jonathan
- A Brave Victim
- Posts: 3391
- Joined: Thu Feb 03, 2005 12:50 am
- Location: Not really lurking anymore
Don't laugh if you spot the errors.
Edit: tweaked the code in glVertex2f a bit. Only six fp instructions if you have multiply-adds and a smart compiler. 
Code: Select all
static void DrawWalls(tList<gNetPlayerWall> &list) {
unsigned i, len=list.Len();
double currentTime = se_GameTime();
double wallsLength = gCycle::WallsLength();
double wallsStayUpDelay = gCycle::WallsStayUpDelay();
bool limitedLength = wallsLength > 0;
glBegin(GL_LINES);
for(i=0; i<len; i++) {
gNetPlayerWall *wall = list[i];
gCycle *cycle = wall->Cycle();
if(!cycle) continue;
double alpha = 1;
if(!cycle->Alive() && wallsStayUpDelay >= 0) {
alpha -= 2 * (currentTime - cycle->DeathTime() - wallsStayUpDelay);
if(!(alpha > 0)) continue;
}
glColor4f(cycle->color_.r, cycle->color_.g, cycle->color_.b, alpha);
double cycleDist = cycle->GetDistance();
double minDist = limitedLength && cycleDist > wallsLength ? cycleDist - wallsLength : 0;
const eCoord &begPos = wall->EndPoint(0), &endPos = wall->EndPoint(1);
tArray<gPlayerWallCoord> &coords = wall->Coords();
double begDist = wall->BegPos();
double lenDist = wall->EndPos() - begDist;
unsigned j, numcoords = coords.Len();
if(numcoords < 2) continue;
bool prevDangerous = coords[0].IsDangerous;
double prevDist = coords[0].Pos;
if(prevDist < minDist) prevDist = minDist;
prevDist = (prevDist - begDist) / lenDist;
for(j=1; j<numcoords; j++) {
bool curDangerous = coords[j].IsDangerous;
double curDist = coords[j].Pos;
if(curDist < minDist) curDist = minDist;
curDist = (curDist - begDist) / lenDist;
if(prevDangerous) {
glVertex2f(begPos.x + prevDist * (endPos.x - begPos.x), begPos.y + prevDist * (endPos.y - begPos.y));
glVertex2f(begPos.x + curDist * (endPos.x - begPos.x), begPos.y + curDist * (endPos.y - begPos.y));
}
prevDangerous = curDangerous;
prevDist = curDist;
}
}
glEnd();
}

ˌɑrməˈɡɛˌtrɑn
Ummmmm, I remember reading somewhere that this was put in cvs. How do I enable it? Is it in the 0.2.8 branch, or head?
Check out my YouTube channel: https://youtube.com/@davefancella?si=H--oCK3k_dQ1laDN
Be the devil's own, Lucifer's my name.
- Iron Maiden
Be the devil's own, Lucifer's my name.
- Iron Maiden
Not in the branch, apparently. Anybody happen to know why? I thought we were going to go ahead and include it in 0.2.8....
Check out my YouTube channel: https://youtube.com/@davefancella?si=H--oCK3k_dQ1laDN
Be the devil's own, Lucifer's my name.
- Iron Maiden
Be the devil's own, Lucifer's my name.
- Iron Maiden
So, I put #define HUD_MAP in gWall.h, but no hud map. ?
Check out my YouTube channel: https://youtube.com/@davefancella?si=H--oCK3k_dQ1laDN
Be the devil's own, Lucifer's my name.
- Iron Maiden
Be the devil's own, Lucifer's my name.
- Iron Maiden
Aha.
There's an #ifdef HUD_MAP before the gWall.h include. Got it, thanks!

Check out my YouTube channel: https://youtube.com/@davefancella?si=H--oCK3k_dQ1laDN
Be the devil's own, Lucifer's my name.
- Iron Maiden
Be the devil's own, Lucifer's my name.
- Iron Maiden