Subversion Repositories eduke32

Rev

Rev 8519 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5327 hendricks2 1
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
2
// Ken Silverman's official web site: "http://www.advsys.net/ken"
3
// See the included license file "BUILDLIC.TXT" for license info.
4
//
5
// This file has been modified from Ken Silverman's original release
6
// by Jonathon Fowler (jf@jonof.id.au)
7
 
8
#include "compat.h"
9
#include "build.h"
10
#include "editor.h"
11
#include "pragmas.h"
12
#include "baselayer.h"
13
#include "names.h"
14
#include "osd.h"
15
#include "cache1d.h"
16
#include "common.h"
17
#include "m32script.h"
8477 hendricks2 18
#include "keys.h"
5327 hendricks2 19
 
20
#include "common_game.h"
21
 
8456 hendricks2 22
const char *AppProperName = "EKenBuild Editor";
7537 hendricks2 23
const char *AppTechnicalName = "ekenbuild-editor";
5327 hendricks2 24
 
25
#if defined(_WIN32)
7537 hendricks2 26
#define DEFAULT_GAME_EXEC "ekenbuild.exe"
27
#define DEFAULT_GAME_LOCAL_EXEC "ekenbuild.exe"
5327 hendricks2 28
#else
7537 hendricks2 29
#define DEFAULT_GAME_EXEC "ekenbuild"
30
#define DEFAULT_GAME_LOCAL_EXEC "./ekenbuild"
5327 hendricks2 31
#endif
32
 
33
const char *DefaultGameExec = DEFAULT_GAME_EXEC;
34
const char *DefaultGameLocalExec = DEFAULT_GAME_LOCAL_EXEC;
35
 
7537 hendricks2 36
#define SETUPFILENAME "ekenbuild-editor.cfg"
5327 hendricks2 37
const char *defaultsetupfilename = SETUPFILENAME;
38
char setupfilename[BMAX_PATH] = SETUPFILENAME;
39
 
8477 hendricks2 40
#define eitherALT   (keystatus[KEYSC_LALT] || keystatus[KEYSC_RALT])
41
#define eitherCTRL  (keystatus[KEYSC_LCTRL] || keystatus[KEYSC_RCTRL])
42
#define eitherSHIFT (keystatus[KEYSC_LSHIFT] || keystatus[KEYSC_RSHIFT])
43
 
44
#define PRESSED_KEYSC(Key) (keystatus[KEYSC_##Key] && !(keystatus[KEYSC_##Key]=0))
45
 
5327 hendricks2 46
static char tempbuf[256];
47
 
48
#define NUMOPTIONS 9
49
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
50
unsigned char default_buildkeys[NUMBUILDKEYS] =
51
{
52
    0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
53
    0x1e,0x2c,0xd1,0xc9,0x33,0x34,
8460 hendricks2 54
    0x9c,0x1c,0xd,0xc,0xf,0x29
5327 hendricks2 55
};
56
 
57
 
58
 
59
 
60
 
61
//static int hang = 0;
62
//static int rollangle = 0;
63
 
64
//Detecting 2D / 3D mode:
65
//   qsetmode is 200 in 3D mode
66
//   qsetmode is 350/480 in 2D mode
67
//
68
//You can read these variables when F5-F8 is pressed in 3D mode only:
69
//
70
//   If (searchstat == 0)  WALL        searchsector=sector, searchwall=wall
71
//   If (searchstat == 1)  CEILING     searchsector=sector
72
//   If (searchstat == 2)  FLOOR       searchsector=sector
73
//   If (searchstat == 3)  SPRITE      searchsector=sector, searchwall=sprite
74
//   If (searchstat == 4)  MASKED WALL searchsector=sector, searchwall=wall
75
//
76
//   searchsector is the sector of the selected item for all 5 searchstat's
77
//
78
//   searchwall is undefined if searchstat is 1 or 2
79
//   searchwall is the wall if searchstat = 0 or 4
80
//   searchwall is the sprite if searchstat = 3 (Yeah, I know - it says wall,
81
//                                      but trust me, it's the sprite number)
82
 
83
int averagefps;
84
#define AVERAGEFRAMES 32
85
static unsigned int frameval[AVERAGEFRAMES];
86
static int framecnt = 0;
87
 
88
 
89
const char *ExtGetVer(void)
90
{
91
    return s_buildRev;
92
}
93
 
5552 hendricks2 94
int32_t ExtPreInit(int32_t argc,char const * const * argv)
5327 hendricks2 95
{
96
    UNREFERENCED_PARAMETER(argc);
97
    UNREFERENCED_PARAMETER(argv);
98
 
7537 hendricks2 99
    OSD_SetLogFile("ekenbuild-editor.log");
8333 hendricks2 100
    char tempbuf[256];
101
    snprintf(tempbuf, ARRAY_SIZE(tempbuf), "%s %s", AppProperName, s_buildRev);
102
    OSD_SetVersion(tempbuf, 10,0);
8457 hendricks2 103
    buildprintf("%s\n", tempbuf);
6142 hendricks2 104
    PrintBuildInfo();
5327 hendricks2 105
 
106
    return 0;
107
}
108
 
109
int32_t ExtInit(void)
110
{
111
    int rv = 0;
112
 
113
    /*printf("------------------------------------------------------------------------------\n");
114
    printf("   BUILD.EXE copyright(c) 1996 by Ken Silverman.  You are granted the\n");
115
    printf("   right to use this software for your personal use only.  This is a\n");
116
    printf("   special version to be used with \"Happy Fun KenBuild\" and may not work\n");
117
    printf("   properly with other Build engine games.  Please refer to license.doc\n");
118
    printf("   for distribution rights\n");
119
    printf("------------------------------------------------------------------------------\n");
120
    getch();
121
    */
122
 
8333 hendricks2 123
    OSD_SetParameters(0,2, 0,0, 4,0, 0, 0, 0); // TODO
124
 
5327 hendricks2 125
    bpp = 8;
126
    if (loadsetup(setupfilename) < 0) buildputs("Configuration file not found, using defaults.\n"), rv = 1;
127
    Bmemcpy(buildkeys, default_buildkeys, NUMBUILDKEYS);   //Trick to make build use setup.dat keys
128
    if (option[4] > 0) option[4] = 0;
129
 
130
    kensplayerheight = 32;
131
    zmode = 0;
132
 
8458 hendricks2 133
    wm_msgbox("Pre-Release Software Warning", "%s is not ready for public use. Proceed with caution!", AppProperName);
134
 
5327 hendricks2 135
#ifdef _WIN32
136
//  allowtaskswitching(0);
137
#endif
138
    return rv;
139
}
140
 
141
int32_t ExtPostStartupWindow(void)
142
{
143
    initgroupfile(G_GrpFile());
144
 
7540 hendricks2 145
    if (engineInit())
5327 hendricks2 146
    {
147
        initprintf("There was a problem initializing the engine.\n");
148
        return -1;
149
    }
150
 
8473 hendricks2 151
    Ken_PostStartupWindow();
5327 hendricks2 152
 
153
    return 0;
154
}
155
 
5345 hendricks2 156
void ExtPostInit(void)
157
{
8474 hendricks2 158
    Ken_LoadVoxels();
7540 hendricks2 159
    palettePostLoadLookups();
5345 hendricks2 160
}
161
 
5327 hendricks2 162
void ExtUnInit(void)
163
{
164
    uninitgroupfile();
165
    writesetup(setupfilename);
166
}
167
 
168
//static int daviewingrange, daaspect, horizval1, horizval2;
169
void ExtPreCheckKeys(void)
170
{
171
    int /*cosang, sinang, dx, dy, mindx,*/ i, j, k;
172
 
173
    if (keystatus[0x3e])  //F4 - screen re-size
174
    {
175
        keystatus[0x3e] = 0;
176
 
177
        //cycle through all vesa modes, then screen-buffer mode
178
        if (keystatus[0x2a]|keystatus[0x36])
179
        {
7540 hendricks2 180
            videoSetGameMode(!fullscreen, xdim, ydim, bpp, upscalefactor);
5327 hendricks2 181
        }
182
        else
183
        {
184
 
185
            //cycle through all modes
186
            j=-1;
187
 
188
            // work out a mask to select the mode
189
            for (i=0; i<validmodecnt; i++)
190
                if ((validmode[i].xdim == xdim) &&
191
                    (validmode[i].ydim == ydim) &&
192
                    (validmode[i].fs == fullscreen) &&
193
                    (validmode[i].bpp == bpp))
194
                { j=i; break; }
195
 
196
            for (k=0; k<validmodecnt; k++)
197
                if (validmode[k].fs == fullscreen && validmode[k].bpp == bpp) break;
198
 
199
            if (j==-1) j=k;
200
            else
201
            {
202
                j++;
203
                if (j==validmodecnt) j=k;
204
            }
7540 hendricks2 205
            videoSetGameMode(fullscreen, validmode[j].xdim, validmode[j].ydim, bpp, upscalefactor);
5327 hendricks2 206
        }
207
    }
208
 
209
    if (keystatus[buildkeys[BK_MODE2D_3D]])  // Enter
210
    {
211
        getmessageleng = 0;
212
        getmessagetimeoff = 0;
213
    }
214
 
215
    if (getmessageleng > 0)
216
    {
217
        if (!in3dmode())
218
            printmessage16("%s", getmessage);
219
        if (totalclock > getmessagetimeoff)
220
            getmessageleng = 0;
221
    }
222
 
223
#if 0
224
    if (keystatus[0x2a]|keystatus[0x36])
225
    {
226
        if (keystatus[0xcf]) hang = max(hang-1,-182);
227
        if (keystatus[0xc7]) hang = min(hang+1,182);
228
    }
229
    else
230
    {
231
        if (keystatus[0xcf]) hang = max(hang-8,-182);
232
        if (keystatus[0xc7]) hang = min(hang+8,182);
233
    }
234
    if (keystatus[0x4c]) { hang = 0; horiz = 100; }
235
    if (hang != 0)
236
    {
237
        walock[4094] = 255;
238
 
239
        // JBF 20031117: scale each dimension by a factor of 1.2, and work out
240
        // the aspect of the screen. Anywhere you see 'i' below was the value
241
        // '200' before I changed it. NOTE: This whole trick crashes in resolutions
242
        // above 800x600. I'm not sure why, and fixing it is not something I intend
243
        // to do in a real big hurry.
244
        dx = (xdim + (xdim >> 3) + (xdim >> 4) + (xdim >> 6)) & (~7);
245
        dy = (ydim + (ydim >> 3) + (ydim >> 4) + (ydim >> 6)) & (~7);
246
        i = scale(320,ydim,xdim);
247
 
8250 hendricks2 248
        if (waloff[4094] == 0) g_cache.allocateBlock(&waloff[4094],/*240L*384L*/ dx*dy,&walock[4094]);
7540 hendricks2 249
        renderSetTarget(4094,/*240L,384L*/ dy,dx);
5327 hendricks2 250
 
251
        cosang = sintable[(hang+512)&2047];
252
        sinang = sintable[hang&2047];
253
 
254
        dx = dmulscale1(320,cosang,i,sinang); mindx = dx;
255
        dy = dmulscale1(-i,cosang,320,sinang);
256
        horizval1 = dy*(320>>1)/dx-1;
257
 
258
        dx = dmulscale1(320,cosang,-i,sinang); mindx = min(dx,mindx);
259
        dy = dmulscale1(i,cosang,320,sinang);
260
        horizval2 = dy*(320>>1)/dx+1;
261
 
6256 hendricks2 262
        daviewingrange = divscale30(xdim>>1, mindx-16);
5327 hendricks2 263
        daaspect = scale(daviewingrange,scale(320,tilesiz[4094].x,tilesiz[4094].y),horizval2+6-horizval1);
7540 hendricks2 264
        renderSetAspect(daviewingrange,scale(daaspect,ydim*320,xdim*i));
5327 hendricks2 265
        horiz = 100-divscale15(horizval1+horizval2,daviewingrange);
266
    }
267
#endif
268
}
269
 
8455 hendricks2 270
void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura, int32_t smoothr)
5327 hendricks2 271
{
272
    int i, *longptr;
8519 hendricks2 273
    tspriteptr_t tspr;
5327 hendricks2 274
 
275
    UNREFERENCED_PARAMETER(ourx);
276
    UNREFERENCED_PARAMETER(oury);
8455 hendricks2 277
    UNREFERENCED_PARAMETER(ourz);
5327 hendricks2 278
    UNREFERENCED_PARAMETER(oura);
279
    UNREFERENCED_PARAMETER(smoothr);
280
 
281
    for (i=0,tspr=&tsprite[0]; i<spritesortcnt; i++,tspr++)
282
    {
8596 hendricks2 283
        if (usevoxels && videoGetRenderMode() != REND_POLYMER)
5327 hendricks2 284
        {
285
            switch (tspr->picnum)
286
            {
287
            case PLAYER:
8475 hendricks2 288
                if (voxid_PLAYER == -1)
289
                    break;
290
 
291
                tspr->cstat |= 48;
292
                tspr->picnum = voxid_PLAYER;
293
 
294
                longptr = (int32_t *)voxoff[voxid_PLAYER][0];
5327 hendricks2 295
                tspr->xrepeat = scale(tspr->xrepeat,56,longptr[2]);
296
                tspr->yrepeat = scale(tspr->yrepeat,56,longptr[2]);
297
                tspr->shade -= 6;
298
                break;
299
            case BROWNMONSTER:
8475 hendricks2 300
                if (voxid_BROWNMONSTER == -1)
301
                    break;
302
 
303
                tspr->cstat |= 48;
304
                tspr->picnum = voxid_BROWNMONSTER;
5327 hendricks2 305
                break;
306
            }
307
        }
308
 
309
        tspr->shade += 6;
310
        if (sector[tspr->sectnum].ceilingstat&1)
311
            tspr->shade += sector[tspr->sectnum].ceilingshade;
312
        else
313
            tspr->shade += sector[tspr->sectnum].floorshade;
314
    }
315
}
316
 
8477 hendricks2 317
static void Keys2D()
318
{
319
    if (PRESSED_KEYSC(G))  // G (grid on/off)
320
    {
321
        if (autogrid)
322
        {
323
            grid = 8*eitherSHIFT;
324
 
325
            autogrid = 0;
326
        }
327
        else
328
        {
329
            grid += (1-2*eitherSHIFT);
330
            if (grid == -1 || grid == 9)
331
            {
332
                autogrid = 1;
333
                grid = 0;
334
            }
335
        }
336
 
337
        if (autogrid)
338
            printmessage16("Grid size: 9 (autosize)");
339
        else if (!grid)
340
            printmessage16("Grid off");
341
        else
342
            printmessage16("Grid size: %d (%d units)", grid, 2048>>grid);
343
    }
344
 
345
    if (autogrid)
346
    {
347
        grid = -1;
348
 
349
        while (grid++ < 7)
350
        {
351
            if (mulscale14((2048>>grid), zoom) <= 16)
352
                break;
353
        }
354
    }
355
}
356
 
5327 hendricks2 357
void ExtCheckKeys(void)
358
{
359
    int i; //, p, y, dx, dy, cosang, sinang, bufplc, tsizy, tsizyup15;
360
    int j;
361
 
8476 hendricks2 362
    if (in3dmode())
5327 hendricks2 363
    {
364
#if 0
365
        if (hang != 0)
366
        {
367
            bufplc = waloff[4094]+(mulscale16(horiz-100,xdimenscale)+(tilesiz[4094].x>>1))*tilesiz[4094].y;
7540 hendricks2 368
            renderRestoreTarget();
5327 hendricks2 369
            cosang = sintable[(hang+512)&2047];
370
            sinang = sintable[hang&2047];
371
            dx = dmulscale1(xdim,cosang,ydim,sinang);
372
            dy = dmulscale1(-ydim,cosang,xdim,sinang);
373
 
7540 hendricks2 374
            videoBeginDrawing();
5327 hendricks2 375
            tsizy = tilesiz[4094].y;
376
            tsizyup15 = (tsizy<<15);
377
            dx = mulscale14(dx,daviewingrange);
378
            dy = mulscale14(dy,daaspect);
379
            sinang = mulscale14(sinang,daviewingrange);
380
            cosang = mulscale14(cosang,daaspect);
5984 hendricks2 381
            p = ylookup[windowxy1.y]+frameplace+windowxy2.x+1;
382
            for (y=windowxy1.y; y<=windowxy2.y; y++)
5327 hendricks2 383
            {
384
                i = divscale16(tsizyup15,dx);
385
                stretchhline(0,(xdim>>1)*i+tsizyup15,xdim>>2,i,mulscale32(i,dy)*tsizy+bufplc,p);
386
                dx -= sinang; dy += cosang; p += ylookup[1];
387
            }
388
            walock[4094] = 1;
389
 
390
            Bsprintf(tempbuf,"%d",(hang*180)>>10);
391
            printext256(0L,8L,31,-1,tempbuf,1);
7540 hendricks2 392
            videoEndDrawing();
5327 hendricks2 393
        }
394
#endif
7540 hendricks2 395
        if (keystatus[0xa]) renderSetAspect(viewingrange+(viewingrange>>8),yxaspect+(yxaspect>>8));
396
        if (keystatus[0xb]) renderSetAspect(viewingrange-(viewingrange>>8),yxaspect-(yxaspect>>8));
397
        if (keystatus[0xc]) renderSetAspect(viewingrange,yxaspect-(yxaspect>>8));
398
        if (keystatus[0xd]) renderSetAspect(viewingrange,yxaspect+(yxaspect>>8));
399
        //if (keystatus[0x38]) renderSetRollAngle(rollangle+=((keystatus[0x2a]|keystatus[0x36])*6+2));
400
        //if (keystatus[0xb8]) renderSetRollAngle(rollangle-=((keystatus[0x2a]|keystatus[0x36])*6+2));
401
        //if (keystatus[0x1d]|keystatus[0x9d]) renderSetRollAngle(rollangle=0);
5327 hendricks2 402
 
7540 hendricks2 403
        videoBeginDrawing();
5327 hendricks2 404
 
405
        i = frameval[framecnt&(AVERAGEFRAMES-1)];
7540 hendricks2 406
        j = frameval[framecnt&(AVERAGEFRAMES-1)] = timerGetTicks(); framecnt++;
5735 hendricks2 407
        if (i != j) averagefps = (averagefps*3 + (AVERAGEFRAMES*1000)/(j-i))>>2;
5327 hendricks2 408
        Bsprintf((char *)tempbuf,"%d",averagefps);
409
        printext256(0L,0L,31,-1,(char *)tempbuf,1);
410
 
7540 hendricks2 411
        videoEndDrawing();
5327 hendricks2 412
        editinput();
413
    }
414
    else
415
    {
8477 hendricks2 416
        Keys2D();
5327 hendricks2 417
    }
8484 hendricks2 418
 
419
    if ((in3dmode() && !m32_is2d3dmode()) || m32_is2d3dmode())
420
    {
421
#ifdef USE_OPENGL
422
        int bakrendmode = rendmode;
423
 
424
        if (m32_is2d3dmode())
425
            rendmode = REND_CLASSIC;
426
#endif
427
 
428
        m32_showmouse();
429
 
430
#ifdef USE_OPENGL
431
        rendmode = bakrendmode;
432
#endif
433
    }
5327 hendricks2 434
}
435
 
436
void ExtCleanUp(void)
437
{
438
}
439
 
440
void ExtPreLoadMap(void)
441
{
442
}
443
 
444
 
445
void ExtSetupMapFilename(const char *mapname)
446
{
447
    UNREFERENCED_PARAMETER(mapname);
448
}
449
 
450
void ExtLoadMap(const char *mapname)
451
{
452
    UNREFERENCED_PARAMETER(mapname);
453
}
454
 
455
int32_t ExtPreSaveMap(void)
456
{
457
    return 0;
458
}
459
 
460
void ExtSaveMap(const char *mapname)
461
{
462
    UNREFERENCED_PARAMETER(mapname);
463
}
464
 
465
const char *ExtGetSectorCaption(short sectnum)
466
{
467
    if ((sector[sectnum].lotag|sector[sectnum].hitag) == 0)
468
    {
469
        tempbuf[0] = 0;
470
    }
471
    else
472
    {
473
        Bsprintf((char *)tempbuf,"%hu,%hu",(unsigned short)sector[sectnum].hitag,
474
                 (unsigned short)sector[sectnum].lotag);
475
    }
476
    return (char *)tempbuf;
477
}
478
 
479
const char *ExtGetWallCaption(short wallnum)
480
{
481
    if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0)
482
    {
483
        tempbuf[0] = 0;
484
    }
485
    else
486
    {
487
        Bsprintf((char *)tempbuf,"%hu,%hu",(unsigned short)wall[wallnum].hitag,
488
                 (unsigned short)wall[wallnum].lotag);
489
    }
490
    return (char *)tempbuf;
491
}
492
 
493
const char *ExtGetSpriteCaption(short spritenum)
494
{
495
    if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0)
496
    {
497
        tempbuf[0] = 0;
498
    }
499
    else
500
    {
501
        Bsprintf((char *)tempbuf,"%hu,%hu",(unsigned short)sprite[spritenum].hitag,
502
                 (unsigned short)sprite[spritenum].lotag);
503
    }
504
    return (char *)tempbuf;
505
}
506
 
507
//printext16 parameters:
508
//printext16(int xpos, int ypos, short col, short backcol,
509
//           char name[82], char fontsize)
510
//  xpos 0-639   (top left)
511
//  ypos 0-479   (top left)
512
//  col 0-15
513
//  backcol 0-15, -1 is transparent background
514
//  name
515
//  fontsize 0=8*8, 1=3*5
516
 
7540 hendricks2 517
//editorDraw2dLine parameters:
518
// editorDraw2dLine(int x1, int y1, int x2, int y2, char col)
5327 hendricks2 519
//  x1, x2  0-639
520
//  y1, y2  0-143  (status bar is 144 high, origin is top-left of STATUS BAR)
521
//  col     0-15
522
 
523
void ExtShowSectorData(short sectnum)   //F5
524
{
525
    int i;
8476 hendricks2 526
    if (in3dmode())
5327 hendricks2 527
    {
528
    }
529
    else
530
    {
7540 hendricks2 531
        videoBeginDrawing();
5327 hendricks2 532
        clearmidstatbar16();             //Clear middle of status bar
533
 
534
        Bsprintf((char *)tempbuf,"Sector %d",sectnum);
535
        printext16(8,ydim16+32,11,-1,(char *)tempbuf,0);
536
 
537
        printext16(8,ydim16+48,11,-1,"8*8 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",0);
538
        printext16(8,ydim16+56,11,-1,"3*5 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",1);
539
 
540
        i=ydim16; ydim16=ydim;
7540 hendricks2 541
        editorDraw2dLine(320,i+68,344,i+80,4);       //Draw house
542
        editorDraw2dLine(344,i+80,344,i+116,4);
543
        editorDraw2dLine(344,i+116,296,i+116,4);
544
        editorDraw2dLine(296,i+116,296,i+80,4);
545
        editorDraw2dLine(296,i+80,320,i+68,4);
5327 hendricks2 546
        ydim16=i;
7540 hendricks2 547
        videoEndDrawing();
5327 hendricks2 548
    }
549
}
550
 
551
void ExtShowWallData(short wallnum)       //F6
552
{
8476 hendricks2 553
    if (in3dmode())
5327 hendricks2 554
    {
555
    }
556
    else
557
    {
7540 hendricks2 558
        videoBeginDrawing();
5327 hendricks2 559
        clearmidstatbar16();             //Clear middle of status bar
560
 
561
        Bsprintf((char *)tempbuf,"Wall %d",wallnum);
562
        printext16(8,ydim16+32,11,-1,(char *)tempbuf,0);
7540 hendricks2 563
        videoEndDrawing();
5327 hendricks2 564
    }
565
}
566
 
567
void ExtShowSpriteData(short spritenum)   //F6
568
{
8476 hendricks2 569
    if (in3dmode())
5327 hendricks2 570
    {
571
    }
572
    else
573
    {
7540 hendricks2 574
        videoBeginDrawing();
5327 hendricks2 575
        clearmidstatbar16();             //Clear middle of status bar
576
 
577
        Bsprintf((char *)tempbuf,"Sprite %d",spritenum);
578
        printext16(8,ydim16+32,11,-1,(char *)tempbuf,0);
7540 hendricks2 579
        videoEndDrawing();
5327 hendricks2 580
    }
581
}
582
 
583
void ExtEditSectorData(short sectnum)    //F7
584
{
585
    short nickdata;
586
 
8476 hendricks2 587
    if (in3dmode())
5327 hendricks2 588
    {
589
        //Ceiling
590
        if (searchstat == 1)
591
            sector[searchsector].ceilingpicnum++;   //Just a stupid example
592
 
593
        //Floor
594
        if (searchstat == 2)
595
            sector[searchsector].floorshade++;      //Just a stupid example
596
    }
597
    else                    //In 2D mode
598
    {
599
        Bsprintf((char *)tempbuf,"Sector (%d) Nick's variable: ",sectnum);
600
        nickdata = 0;
601
        nickdata = getnumber16((char *)tempbuf,nickdata,65536L,0);
602
 
603
        printmessage16(" ");              //Clear message box (top right of status bar)
604
        ExtShowSectorData(sectnum);
605
    }
606
}
607
 
608
void ExtEditWallData(short wallnum)       //F8
609
{
610
    short nickdata;
611
 
8476 hendricks2 612
    if (in3dmode())
5327 hendricks2 613
    {
614
    }
615
    else
616
    {
617
        Bsprintf((char *)tempbuf,"Wall (%d) Nick's variable: ",wallnum);
618
        nickdata = 0;
619
        nickdata = getnumber16((char *)tempbuf,nickdata,65536L,0);
620
 
621
        printmessage16(" ");              //Clear message box (top right of status bar)
622
        ExtShowWallData(wallnum);
623
    }
624
}
625
 
626
void ExtEditSpriteData(short spritenum)   //F8
627
{
628
    short nickdata;
629
 
8476 hendricks2 630
    if (in3dmode())
5327 hendricks2 631
    {
632
    }
633
    else
634
    {
635
        Bsprintf((char *)tempbuf,"Sprite (%d) Nick's variable: ",spritenum);
636
        nickdata = 0;
637
        nickdata = getnumber16((char *)tempbuf,nickdata,65536L,0);
638
        printmessage16(" ");
639
 
640
        printmessage16(" ");              //Clear message box (top right of status bar)
641
        ExtShowSpriteData(spritenum);
642
    }
643
}
644
 
645
void faketimerhandler(void)
646
{
8250 hendricks2 647
    timerUpdateClock();
5327 hendricks2 648
}
649
 
650
void M32RunScript(const char *s) { UNREFERENCED_PARAMETER(s); }
651
void G_Polymer_UnInit(void) { }
652
void SetGamePalette(int32_t j) { UNREFERENCED_PARAMETER(j); }
653
 
654
int32_t AmbienceToggle, MixRate, ParentalLock;
655
 
656
int32_t taglab_linktags(int32_t spritep, int32_t num)
657
{
658
    int32_t link = 0;
659
 
660
    g_iReturnVar = link;
661
    VM_OnEvent(EVENT_LINKTAGS, spritep ? num : -1);
662
    link = g_iReturnVar;
663
 
664
    return link;
665
}
666
 
667
int32_t taglab_getnextfreetag(int32_t *duetoptr)
668
{
669
    int32_t i, nextfreetag=1;
670
    int32_t obj = -1;
671
 
672
    for (i=0; i<MAXSPRITES; i++)
673
    {
674
        int32_t tag;
675
 
676
        if (sprite[i].statnum == MAXSTATUS)
677
            continue;
678
 
679
        tag = select_sprite_tag(i);
680
 
681
        if (tag != INT32_MIN && nextfreetag <= tag)
682
        {
683
            nextfreetag = tag+1;
684
            obj = 32768 + i;
685
        }
686
    }
687
 
688
    for (i=0; i<numwalls; i++)
689
    {
690
        int32_t lt = taglab_linktags(0, i);
691
 
692
        if ((lt&1) && nextfreetag <= wall[i].lotag)
693
            nextfreetag = wall[i].lotag+1, obj = i;
694
        if ((lt&2) && nextfreetag <= wall[i].hitag)
695
            nextfreetag = wall[i].hitag+1, obj = i;
696
    }
697
 
698
    if (duetoptr != NULL)
699
        *duetoptr = obj;
700
 
701
    if (nextfreetag < 32768)
702
        return nextfreetag;
703
 
704
    return 0;
705
}
706
 
707
int32_t S_InvalidSound(int32_t num) {
708
    UNREFERENCED_PARAMETER(num); return 1;
709
};
710
int32_t S_CheckSoundPlaying(int32_t i, int32_t num) {
711
    UNREFERENCED_PARAMETER(i); UNREFERENCED_PARAMETER(num); return 0;
712
};
713
int32_t S_SoundsPlaying(int32_t i) {
714
    UNREFERENCED_PARAMETER(i); return -1;
715
}
716
int32_t S_SoundFlags(int32_t num) {
717
    UNREFERENCED_PARAMETER(num); return 0;
718
};
719
int32_t A_PlaySound(uint32_t num, int32_t i) {
720
    UNREFERENCED_PARAMETER(num); UNREFERENCED_PARAMETER(i); return 0;
721
};
722
void S_StopSound(int32_t num) {
723
    UNREFERENCED_PARAMETER(num);
724
};
5989 hendricks2 725
void S_StopAllSounds(void) { }
5327 hendricks2 726
 
727
//Just thought you might want my getnumber16 code
728
/*
729
getnumber16(char namestart[80], short num, int maxnumber)
730
{
731
    char buffer[80];
732
    int j, k, n, danum, oldnum;
733
 
734
    danum = (int)num;
735
    oldnum = danum;
736
    while ((keystatus[0x1c] != 2) && (keystatus[0x1] == 0))  //Enter, ESC
737
    {
738
        sprintf(&buffer,"%s%ld_ ",namestart,danum);
739
        printmessage16(buffer);
740
 
741
        for(j=2;j<=11;j++)                //Scan numbers 0-9
742
            if (keystatus[j] > 0)
743
            {
744
                keystatus[j] = 0;
745
                k = j-1;
746
                if (k == 10) k = 0;
747
                n = (danum*10)+k;
748
                if (n < maxnumber) danum = n;
749
            }
750
        if (keystatus[0xe] > 0)    // backspace
751
        {
752
            danum /= 10;
753
            keystatus[0xe] = 0;
754
        }
755
        if (keystatus[0x1c] == 1)   //L. enter
756
        {
757
            oldnum = danum;
758
            keystatus[0x1c] = 2;
759
            asksave = 1;
760
        }
761
    }
762
    keystatus[0x1c] = 0;
763
    keystatus[0x1] = 0;
764
    return((short)oldnum);
765
}
766
*/
767
 
768
/*
769
 * vim:ts=4:
770
 */