Subversion Repositories eduke32

Rev

Rev 4006 | Rev 4128 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2542 helixhorne 1
//
2
// Common non-engine code/data for EDuke32 and Mapster32
3
//
4
 
5
#include "compat.h"
2726 hendricks2 6
#include "build.h"
2549 helixhorne 7
#include "scriptfile.h"
2554 helixhorne 8
#include "cache1d.h"
9
#include "kplib.h"
10
#include "baselayer.h"
3220 hendricks2 11
#include "names.h"
2542 helixhorne 12
 
3581 hendricks2 13
#ifdef _WIN32
14
# include "winbits.h"
3671 hendricks2 15
# include <shlwapi.h>
16
# include <winnt.h>
17
# ifndef KEY_WOW64_32KEY
18
#  define KEY_WOW64_32KEY 0x0200
19
# endif
3581 hendricks2 20
#endif
21
 
2542 helixhorne 22
#include "common.h"
2726 hendricks2 23
#include "common_game.h"
2542 helixhorne 24
 
2789 hendricks2 25
int32_t g_gameType = GAMEFLAG_DUKE;
2542 helixhorne 26
 
2726 hendricks2 27
// grp/con/def handling
28
 
2796 helixhorne 29
const char *defaultgamegrp[GAMECOUNT] = { "DUKE3D.GRP", "NAM.GRP", "NAPALM.GRP", "WW2GI.GRP" };
30
const char *defaultdeffilename[GAMECOUNT] = { "duke3d.def", "nam.def", "napalm.def", "ww2gi.def" };
31
const char *defaultconfilename = "GAME.CON";
32
const char *defaultgameconfilename[GAMECOUNT] = { "EDUKE.CON", "NAM.CON", "NAPALM.CON", "WW2GI.CON" };
2726 hendricks2 33
 
34
// g_grpNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
35
char *g_grpNamePtr = NULL;
36
// g_defNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
37
char *g_defNamePtr = NULL;
38
// g_scriptNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
39
char *g_scriptNamePtr = NULL;
40
 
41
void clearGrpNamePtr(void)
42
{
43
    if (g_grpNamePtr != NULL)
44
        Bfree(g_grpNamePtr);
45
    // g_grpNamePtr assumed to be assigned to right after
46
}
47
 
48
void clearDefNamePtr(void)
49
{
50
    if (g_defNamePtr != NULL)
51
        Bfree(g_defNamePtr);
52
    // g_defNamePtr assumed to be assigned to right after
53
}
54
 
55
void clearScriptNamePtr(void)
56
{
57
    if (g_scriptNamePtr != NULL)
58
        Bfree(g_scriptNamePtr);
59
    // g_scriptNamePtr assumed to be assigned to right after
60
}
61
 
2796 helixhorne 62
const char *G_DefaultGrpFile(void)
2726 hendricks2 63
{
64
    if (DUKE)
65
        return defaultgamegrp[GAME_DUKE];
66
    // order is important for the following three because GAMEFLAG_NAM overlaps all
67
    else if (NAPALM)
68
        return defaultgamegrp[GAME_NAPALM];
69
    else if (WW2GI)
70
        return defaultgamegrp[GAME_WW2GI];
71
    else if (NAM)
72
        return defaultgamegrp[GAME_NAM];
73
 
74
    return defaultgamegrp[0];
75
}
2796 helixhorne 76
const char *G_DefaultDefFile(void)
2726 hendricks2 77
{
78
    if (DUKE)
79
        return defaultdeffilename[GAME_DUKE];
80
    else if (WW2GI)
81
        return defaultdeffilename[GAME_WW2GI];
82
    else if (NAPALM)
83
    {
2752 helixhorne 84
        if (!testkopen(defaultdeffilename[GAME_NAPALM],0) && testkopen(defaultdeffilename[GAME_NAM],0))
3618 hendricks2 85
            return defaultdeffilename[GAME_NAM]; // NAM/NAPALM Sharing
2726 hendricks2 86
        else
87
            return defaultdeffilename[GAME_NAPALM];
88
    }
89
    else if (NAM)
90
    {
2752 helixhorne 91
        if (!testkopen(defaultdeffilename[GAME_NAM],0) && testkopen(defaultdeffilename[GAME_NAPALM],0))
3618 hendricks2 92
            return defaultdeffilename[GAME_NAPALM]; // NAM/NAPALM Sharing
2726 hendricks2 93
        else
94
            return defaultdeffilename[GAME_NAM];
95
    }
96
 
97
    return defaultdeffilename[0];
98
}
2796 helixhorne 99
const char *G_DefaultConFile(void)
2726 hendricks2 100
{
2752 helixhorne 101
    if (DUKE && testkopen(defaultgameconfilename[GAME_DUKE],0))
2726 hendricks2 102
        return defaultgameconfilename[GAME_DUKE];
2752 helixhorne 103
    else if (WW2GI && testkopen(defaultgameconfilename[GAME_WW2GI],0))
2726 hendricks2 104
        return defaultgameconfilename[GAME_WW2GI];
105
    else if (NAPALM)
106
    {
2752 helixhorne 107
        if (!testkopen(defaultgameconfilename[GAME_NAPALM],0))
2726 hendricks2 108
        {
2752 helixhorne 109
            if (testkopen(defaultgameconfilename[GAME_NAM],0))
3618 hendricks2 110
                return defaultgameconfilename[GAME_NAM]; // NAM/NAPALM Sharing
2726 hendricks2 111
        }
112
        else
113
            return defaultgameconfilename[GAME_NAPALM];
114
    }
115
    else if (NAM)
116
    {
2752 helixhorne 117
        if (!testkopen(defaultgameconfilename[GAME_NAM],0))
2726 hendricks2 118
        {
2752 helixhorne 119
            if (testkopen(defaultgameconfilename[GAME_NAPALM],0))
3618 hendricks2 120
                return defaultgameconfilename[GAME_NAPALM]; // NAM/NAPALM Sharing
2726 hendricks2 121
        }
122
        else
123
            return defaultgameconfilename[GAME_NAM];
124
    }
125
 
126
    return defaultconfilename;
127
}
128
 
2796 helixhorne 129
const char *G_GrpFile(void)
2726 hendricks2 130
{
131
    if (g_grpNamePtr == NULL)
132
        return G_DefaultGrpFile();
133
    else
134
        return g_grpNamePtr;
135
}
3654 terminx 136
 
2796 helixhorne 137
const char *G_DefFile(void)
2726 hendricks2 138
{
139
    if (g_defNamePtr == NULL)
140
        return G_DefaultDefFile();
141
    else
142
        return g_defNamePtr;
143
}
3654 terminx 144
 
2796 helixhorne 145
const char *G_ConFile(void)
2726 hendricks2 146
{
147
    if (g_scriptNamePtr == NULL)
148
        return G_DefaultConFile();
149
    else
150
        return g_scriptNamePtr;
151
}
152
 
153
//////////
154
 
3976 helixhorne 155
#define NUMPSKYMULTIS 5
156
EDUKE32_STATIC_ASSERT(NUMPSKYMULTIS <= MAXPSKYMULTIS);
157
EDUKE32_STATIC_ASSERT(PSKYOFF_MAX <= MAXPSKYTILES);
158
 
3975 helixhorne 159
// Set up new-style multi-psky handling.
3976 helixhorne 160
void G_InitMultiPsky(int32_t CLOUDYOCEAN__DYN, int32_t MOONSKY1__DYN, int32_t BIGORBIT1__DYN, int32_t LA__DYN)
3220 hendricks2 161
{
162
    int32_t i;
163
 
3976 helixhorne 164
    psky_t *defaultsky = &multipsky[0];
165
    psky_t *oceansky = &multipsky[1];
166
    psky_t *moonsky = &multipsky[2];
167
    psky_t *spacesky = &multipsky[3];
168
    psky_t *citysky = &multipsky[4];
3220 hendricks2 169
 
3975 helixhorne 170
    static int32_t inited;
171
    if (inited)
172
        return;
173
    inited = 1;
3220 hendricks2 174
 
3976 helixhorne 175
    multipskytile[0] = -1;
176
    multipskytile[1] = CLOUDYOCEAN__DYN;
177
    multipskytile[2] = MOONSKY1__DYN;
178
    multipskytile[3] = BIGORBIT1__DYN;
179
    multipskytile[4] = LA__DYN;
3220 hendricks2 180
 
3976 helixhorne 181
    pskynummultis = NUMPSKYMULTIS;
3220 hendricks2 182
 
3975 helixhorne 183
    // When adding other multi-skies, take care that the tileofs[] values are
184
    // <= PSKYOFF_MAX. (It can be increased up to MAXPSKYTILES, but should be
185
    // set as tight as possible.)
186
 
3976 helixhorne 187
    // The default sky properties (all others are implicitly zero):
188
    defaultsky->lognumtiles = 3;
189
    defaultsky->horizfrac = 32768;
190
 
191
    // CLOUDYOCEAN
192
    // Aligns with the drawn scene horizon because it has one itself.
193
    oceansky->lognumtiles = 3;
194
    oceansky->horizfrac = 65536;
195
 
3220 hendricks2 196
    // MOONSKY1
197
    //        earth          mountain   mountain         sun
3975 helixhorne 198
    moonsky->lognumtiles = 3;
199
    moonsky->horizfrac = 32768;
200
    moonsky->tileofs[6] = 1;
201
    moonsky->tileofs[1] = 2;
202
    moonsky->tileofs[4] = 2;
203
    moonsky->tileofs[2] = 3;
3220 hendricks2 204
 
205
    // BIGORBIT1   // orbit
206
    //       earth1         2           3           moon/sun
3975 helixhorne 207
    spacesky->lognumtiles = 3;
208
    spacesky->horizfrac = 32768;
209
    spacesky->tileofs[5] = 1;
210
    spacesky->tileofs[6] = 2;
211
    spacesky->tileofs[7] = 3;
212
    spacesky->tileofs[2] = 4;
3220 hendricks2 213
 
214
    // LA // la city
215
    //       earth1         2           3           moon/sun
3975 helixhorne 216
    citysky->lognumtiles = 3;
217
    citysky->horizfrac = 16384+1024;
218
    citysky->tileofs[0] = 1;
219
    citysky->tileofs[1] = 2;
220
    citysky->tileofs[2] = 1;
221
    citysky->tileofs[3] = 3;
222
    citysky->tileofs[4] = 4;
223
    citysky->tileofs[5] = 0;
224
    citysky->tileofs[6] = 2;
225
    citysky->tileofs[7] = 3;
3220 hendricks2 226
 
3975 helixhorne 227
    for (i=0; i<pskynummultis; ++i)
228
    {
229
        int32_t j;
230
        for (j=0; j<(1<<multipsky[i].lognumtiles); ++j)
231
            Bassert(multipsky[i].tileofs[j] <= PSKYOFF_MAX);
232
    }
3976 helixhorne 233
}
3220 hendricks2 234
 
3976 helixhorne 235
void G_SetupGlobalPsky(void)
236
{
237
    int32_t i, mskyidx=0;
238
 
239
    // NOTE: Loop must be running backwards for the same behavior as the game
240
    // (greatest sector index with matching parallaxed sky takes precedence).
241
    for (i=numsectors-1; i>=0; i--)
242
    {
243
        if (sector[i].ceilingstat & 1)
244
        {
4006 helixhorne 245
            mskyidx = getpskyidx(sector[i].ceilingpicnum);
3976 helixhorne 246
            if (mskyidx > 0)
247
                break;
248
        }
249
    }
250
 
251
    g_pskyidx = mskyidx;
3220 hendricks2 252
}
253
 
254
//////////
255
 
3582 hendricks2 256
#ifdef GEKKO
257
#include "gctypes.h" // for bool
258
void L2Enhance();
259
void CON_EnableGecko(int channel,int safe);
260
bool fatInit (uint32_t cacheSize, bool setAsDefaultDevice);
261
#endif
262
 
263
void G_ExtPreInit(void)
264
{
265
#ifdef GEKKO
266
    L2Enhance();
267
    CON_EnableGecko(1, 1);
268
    Bprintf("Console started\n");
269
    fatInit(28, true);
270
#endif
271
}
272
 
3622 terminx 273
#ifdef _WIN32
3637 terminx 274
const char * G_GetInstallPath(int32_t insttype)
3622 terminx 275
{
3637 terminx 276
    static char spath[NUMINSTPATHS][BMAX_PATH];
277
    static int32_t success[NUMINSTPATHS] = { -1, -1 };
3622 terminx 278
    int32_t siz = BMAX_PATH;
279
 
3637 terminx 280
    if (success[insttype] == -1)
281
    {
3671 hendricks2 282
        HKEY HKLM32;
283
        LONG keygood = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_READ | KEY_WOW64_32KEY, &HKLM32);
284
        // KEY_WOW64_32KEY gets us around Wow6432Node on 64-bit builds
285
 
286
        if (keygood == ERROR_SUCCESS)
4127 hendricks2 287
        {
3671 hendricks2 288
            switch (insttype)
289
            {
290
            case INSTPATH_STEAM:
291
                success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App 225140", "InstallLocation", NULL, spath[insttype], (LPDWORD)&siz);
292
                break;
293
            case INSTPATH_GOG:
294
                success[insttype] = SHGetValueA(HKLM32, "SOFTWARE\\GOG.com\\GOGDUKE3D", "PATH", NULL, spath[insttype], (LPDWORD)&siz);
295
                break;
296
            }
4127 hendricks2 297
 
298
            RegCloseKey(HKLM32);
299
        }
3637 terminx 300
    }
3622 terminx 301
 
3637 terminx 302
    if (success[insttype] == ERROR_SUCCESS)
303
        return spath[insttype];
3622 terminx 304
 
305
    return NULL;
306
}
307
#endif
308
 
3581 hendricks2 309
void G_AddSearchPaths(void)
310
{
311
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
312
    addsearchpath("/usr/share/games/jfduke3d");
313
    addsearchpath("/usr/local/share/games/jfduke3d");
314
    addsearchpath("/usr/share/games/eduke32");
315
    addsearchpath("/usr/local/share/games/eduke32");
316
#elif defined(__APPLE__)
317
    addsearchpath("/Library/Application Support/JFDuke3D");
318
    addsearchpath("/Library/Application Support/EDuke32");
319
#elif defined (_WIN32)
3615 terminx 320
    // detect Steam and GOG versions of Duke3D
321
    char buf[BMAX_PATH];
3671 hendricks2 322
    const char* instpath;
3615 terminx 323
 
3671 hendricks2 324
    if ((instpath = G_GetInstallPath(INSTPATH_STEAM)))
3622 terminx 325
    {
3671 hendricks2 326
        Bsprintf(buf, "%s/gameroot", instpath);
3622 terminx 327
        addsearchpath(buf);
3615 terminx 328
 
3671 hendricks2 329
        Bsprintf(buf, "%s/gameroot/addons", instpath);
3622 terminx 330
        addsearchpath(buf);
3615 terminx 331
    }
332
 
3671 hendricks2 333
    if ((instpath = G_GetInstallPath(INSTPATH_GOG)))
334
        addsearchpath(instpath);
3581 hendricks2 335
#endif
336
}
337
 
3654 terminx 338
void G_CleanupSearchPaths(void)
339
{
340
#ifdef _WIN32
341
    char buf[BMAX_PATH];
3671 hendricks2 342
    const char* instpath;
3654 terminx 343
 
3671 hendricks2 344
    if ((instpath = G_GetInstallPath(INSTPATH_STEAM)))
3654 terminx 345
    {
3671 hendricks2 346
        Bsprintf(buf, "%s/gameroot", instpath);
3654 terminx 347
        removesearchpath(buf);
348
 
3671 hendricks2 349
        Bsprintf(buf, "%s/gameroot/addons", instpath);
3654 terminx 350
        removesearchpath(buf);
351
    }
352
 
3671 hendricks2 353
    if ((instpath = G_GetInstallPath(INSTPATH_GOG)))
354
        removesearchpath(instpath);
3654 terminx 355
#endif
356
}
357
 
3581 hendricks2 358
//////////
359
 
2542 helixhorne 360
struct strllist *CommandPaths, *CommandGrps;
361
 
362
void G_AddGroup(const char *buffer)
363
{
364
    char buf[BMAX_PATH];
365
 
3176 helixhorne 366
    struct strllist *s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
2542 helixhorne 367
 
368
    Bstrcpy(buf, buffer);
369
 
370
    if (Bstrchr(buf,'.') == 0)
371
        Bstrcat(buf,".grp");
372
 
373
    s->str = Bstrdup(buf);
374
 
375
    if (CommandGrps)
376
    {
377
        struct strllist *t;
378
        for (t = CommandGrps; t->next; t=t->next) ;
379
        t->next = s;
380
        return;
381
    }
382
    CommandGrps = s;
383
}
384
 
385
void G_AddPath(const char *buffer)
386
{
3176 helixhorne 387
    struct strllist *s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
2542 helixhorne 388
    s->str = Bstrdup(buffer);
389
 
390
    if (CommandPaths)
391
    {
392
        struct strllist *t;
393
        for (t = CommandPaths; t->next; t=t->next) ;
394
        t->next = s;
395
        return;
396
    }
397
    CommandPaths = s;
398
}
2549 helixhorne 399
 
400
//////////
401
 
402
int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens)
403
{
404
    char *tok;
405
    int32_t i;
406
 
407
    if (!sf) return T_ERROR;
408
    tok = scriptfile_gettoken(sf);
409
    if (!tok) return T_EOF;
410
 
411
    for (i=ntokens-1; i>=0; i--)
412
    {
413
        if (!Bstrcasecmp(tok, tl[i].text))
414
            return tl[i].tokenid;
415
    }
416
    return T_ERROR;
417
}
2554 helixhorne 418
 
419
//////////
420
 
2752 helixhorne 421
// returns: 1 if file could be opened, 0 else
422
int32_t testkopen(const char *filename, char searchfirst)
423
{
424
    int32_t fd = kopen4load(filename, searchfirst);
425
    if (fd >= 0)
426
        kclose(fd);
427
    return (fd >= 0);
428
}
429
 
2554 helixhorne 430
// checks from path and in ZIPs, returns 1 if NOT found
431
int32_t check_file_exist(const char *fn)
432
{
433
    int32_t opsm = pathsearchmode;
434
    char *tfn;
435
 
436
    pathsearchmode = 1;
437
    if (findfrompath(fn,&tfn) < 0)
438
    {
439
        char buf[BMAX_PATH];
440
 
441
        Bstrcpy(buf,fn);
442
        kzfindfilestart(buf);
443
        if (!kzfindfile(buf))
444
        {
445
            initprintf("Error: file \"%s\" does not exist\n",fn);
446
            pathsearchmode = opsm;
447
            return 1;
448
        }
449
    }
450
    else Bfree(tfn);
451
    pathsearchmode = opsm;
452
 
453
    return 0;
454
}
2555 helixhorne 455
 
456
 
457
//// FILE NAME / DIRECTORY LISTS ////
458
void fnlist_clearnames(fnlist_t *fnl)
459
{
460
    klistfree(fnl->finddirs);
461
    klistfree(fnl->findfiles);
462
 
463
    fnl->finddirs = fnl->findfiles = NULL;
464
    fnl->numfiles = fnl->numdirs = 0;
465
}
466
 
467
// dirflags, fileflags:
468
//  -1 means "don't get dirs/files",
469
//  otherwise ORed to flags for respective klistpath
470
int32_t fnlist_getnames(fnlist_t *fnl, const char *dirname, const char *pattern,
471
                        int32_t dirflags, int32_t fileflags)
472
{
473
    CACHE1D_FIND_REC *r;
474
 
475
    fnlist_clearnames(fnl);
476
 
477
    if (dirflags != -1)
478
        fnl->finddirs = klistpath(dirname, "*", CACHE1D_FIND_DIR|dirflags);
479
    if (fileflags != -1)
480
        fnl->findfiles = klistpath(dirname, pattern, CACHE1D_FIND_FILE|fileflags);
481
 
482
    for (r=fnl->finddirs; r; r=r->next)
483
        fnl->numdirs++;
484
    for (r=fnl->findfiles; r; r=r->next)
485
        fnl->numfiles++;
486
 
487
    return(0);
488
}
489
 
490
 
3269 terminx 491
// loads all group (grp, zip, pk3/4) files in the given directory
2555 helixhorne 492
void G_LoadGroupsInDir(const char *dirname)
493
{
3269 terminx 494
    static const char *extensions[4] = { "*.grp", "*.zip", "*.pk3", "*.pk4" };
2555 helixhorne 495
 
496
    char buf[BMAX_PATH];
497
    int32_t i;
498
 
499
    fnlist_t fnlist = FNLIST_INITIALIZER;
500
 
3269 terminx 501
    for (i=0; i<4; i++)
2555 helixhorne 502
    {
503
        CACHE1D_FIND_REC *rec;
504
 
505
        fnlist_getnames(&fnlist, dirname, extensions[i], -1, 0);
506
 
507
        for (rec=fnlist.findfiles; rec; rec=rec->next)
508
        {
509
            Bsnprintf(buf, sizeof(buf), "%s/%s", dirname, rec->name);
510
            initprintf("Using group file \"%s\".\n", buf);
511
            initgroupfile(buf);
512
        }
513
 
514
        fnlist_clearnames(&fnlist);
515
    }
516
}
517
 
518
void G_DoAutoload(const char *dirname)
519
{
520
    char buf[BMAX_PATH];
521
 
522
    Bsnprintf(buf, sizeof(buf), "autoload/%s", dirname);
523
    G_LoadGroupsInDir(buf);
524
}
2560 helixhorne 525
 
526
////
527
 
528
// returns a buffer of size BMAX_PATH
529
char *dup_filename(const char *fn)
530
{
3176 helixhorne 531
    char *buf = (char *)Bmalloc(BMAX_PATH);
2560 helixhorne 532
 
533
    return Bstrncpyz(buf, fn, BMAX_PATH);
534
}
3004 helixhorne 535
 
536
 
537
// Copy FN to WBUF and append an extension if it's not there, which is checked
538
// case-insensitively.
539
// Returns: 1 if not all characters could be written to WBUF, 0 else.
540
int32_t maybe_append_ext(char *wbuf, int32_t wbufsiz, const char *fn, const char *ext)
541
{
542
    const int32_t slen=Bstrlen(fn), extslen=Bstrlen(ext);
543
    const int32_t haveext = (slen>=extslen && Bstrcasecmp(&fn[slen-extslen], ext)==0);
544
 
545
    Bassert((intptr_t)wbuf != (intptr_t)fn);  // no aliasing
546
 
547
    // If 'fn' has no extension suffixed, append one.
548
    return (Bsnprintf(wbuf, wbufsiz, "%s%s", fn, haveext ? "" : ext) >= wbufsiz);
549
}
3243 helixhorne 550
 
551
 
3489 helixhorne 552
// Approximations to 2D and 3D Euclidean distances. Initial EDuke32 SVN import says
3243 helixhorne 553
// in jmact/mathutil.c: "Ken's reverse-engineering job".
554
// Note that jmact/mathutil.c contains practically the same code, but where the
555
// individual x/y(/z) distances are passed instead.
556
int32_t ldist(const spritetype *s1, const spritetype *s2)
557
{
558
    int32_t x = klabs(s1->x-s2->x);
559
    int32_t y = klabs(s1->y-s2->y);
560
 
561
    if (x<y) swaplong(&x,&y);
562
 
563
    {
564
        int32_t t = y + (y>>1);
565
        return (x - (x>>5) - (x>>7)  + (t>>2) + (t>>6));
566
    }
567
}
568
 
569
int32_t dist(const spritetype *s1, const spritetype *s2)
570
{
571
    int32_t x = klabs(s1->x-s2->x);
572
    int32_t y = klabs(s1->y-s2->y);
573
    int32_t z = klabs((s1->z-s2->z)>>4);
574
 
575
    if (x<y) swaplong(&x,&y);
576
    if (x<z) swaplong(&x,&z);
577
 
578
    {
579
        int32_t t = y + z;
580
        return (x - (x>>4) + (t>>2) + (t>>3));
581
    }
582
}
3321 helixhorne 583
 
584
 
585
// Clear OSD background
586
void COMMON_clearbackground(int32_t numcols, int32_t numrows)
587
{
588
    UNREFERENCED_PARAMETER(numcols);
589
 
590
# ifdef USE_OPENGL
3784 terminx 591
    if (getrendermode() >= REND_POLYMOST && qsetmode==200)
3321 helixhorne 592
    {
593
        setpolymost2dview();
594
        bglColor4f(0,0,0,0.67f);
595
        bglEnable(GL_BLEND);
596
        bglRectd(0,0, xdim,8*numrows+8);
597
        bglColor4f(0,0,0,1);
598
        bglRectd(0,8*numrows+4, xdim,8*numrows+8);
599
        return;
600
    }
601
# endif
602
 
603
    CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]);
604
}