-
Notifications
You must be signed in to change notification settings - Fork 12
/
am_main.c
866 lines (730 loc) · 16.7 KB
/
am_main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
/* am_main.c -- automap */
#include "doomdef.h"
#include "p_local.h"
#ifdef MARS
#include "mars.h"
#endif
#define STEPVALUE 0x800000
#define SCALESTEP 0x7ff8
#define MAXSCALE 18 * FRACUNIT
#define MINSCALE 2 * FRACUNIT
#define DEFAULTSCALE 6 * FRACUNIT
#ifdef MARS
#define CRY_RED 191
#define CRY_BLUE 207
#define CRY_GREEN 127
#define CRY_BROWN 79
#define CRY_YELLOW 167
#define CRY_GREY 94
#define CRY_AQUA 250
#define CRY_THINGS 223
#else
#define CRY_RED 0xd260
#define CRY_BLUE 0x3080
#define CRY_GREEN 0x6f80
#define CRY_BROWN 0xba20
#define CRY_YELLOW 0xff80
#define CRY_GREY 0x9826
#define CRY_AQUA 0x6aa0
#define CRY_THINGS CRY_AQUA
#endif
static VINT blink = 0;
static VINT pause;
static uint16_t linesdrawn = 0;
static fixed_t scale;
static VINT amcurmap = -1;
#define NOSELENGTH 0x200000 /* PLAYER'S TRIANGLE */
#define MOBJLENGTH 0x100000
static fixed_t oldplayerx;
static fixed_t oldplayery;
static fixed_t oldscale;
#ifndef MARS
int blockx;
int blocky;
#endif
#ifdef JAGUAR
/* CHEATING STUFF */
typedef enum
{
ch_allmap,
ch_things,
ch_maxcheats
} cheat_e;
const char cheatstrings[][11] = /* order should mirror cheat_e */
{
"8002545465", /* allmap cheat */
"8005778788" /* show things cheat */
};
char currentcheat[11]="0000000000";
#endif
VINT showAllThings = 0; /* CHEAT VARS */
VINT showAllLines = 0;
static void DrawLine(uint8_t *fb,pixel_t color, fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, fixed_t miny, fixed_t maxy);
/*================================================================= */
/* */
/* Start up Automap */
/* */
/*================================================================= */
void AM_Start(void)
{
linesdrawn = 0;
if (amcurmap != gamemapinfo.mapNumber)
{
scale = DEFAULTSCALE;
oldscale = DEFAULTSCALE;
amcurmap = gamemapinfo.mapNumber;
}
#ifdef JAGUAR
showAllThings = showAllLines = 0;
#endif
players[consoleplayer].automapflags &= ~AF_ACTIVE;
}
/*================================================================= */
/* */
/* Check for cheat codes for automap fun stuff! */
/* */
/*================================================================= */
#ifdef JAGUAR
cheat_e AM_CheckCheat(int buttons,int oldbuttons)
{
int codes[9] = {BT_1,BT_2,BT_3,BT_4,BT_5,BT_6,BT_7,BT_8,BT_9};
char chars[9] = "123456789";
char c;
int i;
/* CONVERT BUTTON PRESS TO A CHARACTER */
c = 'z';
for (i = 0; i < 9; i++)
if ((buttons & codes[i]) && !(oldbuttons & codes[i]))
{
c = chars[i];
break;
}
if (c == 'z') /* NO 1-9 BUTTON PRESSED */
return -1;
/* SHIFT STRING LEFT A CHARACTER */
for (i = 1; i < 10; i++)
currentcheat[i-1] = currentcheat[i];
currentcheat[9] = c;
currentcheat[10] = 0;
/* SEE IF STRING MATCHES A CHEATSTRING */
for (i = 0; i < ch_maxcheats; i++)
if (!D_strncasecmp(currentcheat,cheatstrings[i],10))
return i;
return -1;
}
#endif
#ifdef JAGUAR
static void DrawLine(pixel_t color, fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, fixed_t miny, fixed_t maxy)
{
int dx, dy;
int adx, ady;
int quadcolor;
int xstep, ystep;
int count = 1;
*(int*)0xf02200 = (int)workingscreen; /* a1 base register */
*(int*)0xf02204 = (4 << 3) /* 16 bit pixels */
+ (29 << 9) /* 160 width image */
+ (3 << 16) /* add increment */
; /* a1 flags */
*(int*)0xf02208 = (180 << 16) + 160; /* a1 clipping size */
*(int*)0xf0220c = (y1 << 16) + x1; /* a1 pixel pointer */
*(int*)0xf02218 = zero; /* a1 pixel pointer fraction */
quadcolor = (color << 16) + color;
*(int*)0xf02240 = quadcolor;
*(int*)0xf02244 = quadcolor; /* source data register */
dx = x2 - x1;
adx = dx < 0 ? -dx : dx;
dy = y2 - y1;
ady = dy < 0 ? -dy : dy;
if (!dx)
{
xstep = 0;
ystep = dy > 0 ? 0x10000 : -0x10000;
count = ady; /* count */
}
else if (!dy)
{
ystep = 0;
xstep = dx > 0 ? 0x10000 : -0x10000;
count = adx; /* count */
}
else if (adx > ady)
{
if (dx > 0)
xstep = 0x10000;
else
xstep = -0x10000;
ystep = (dy << 16) / adx;
count = adx; /* count */
}
else
{
if (dy > 0)
ystep = 0x10000;
else
ystep = -0x10000;
xstep = (dx << 16) / ady;
count = ady; /* count */
}
*(int*)0xf0223c = (1 << 16) + count; /* count */
*(int*)0xf0221c = (ystep & 0xffff0000) + (((unsigned)xstep) >> 16); /* a1 icrement */
*(int*)0xf02220 = (ystep << 16) + (xstep & 0xffff); /* a1 icrement frac */
*(int*)0xf02238 = (1 << 6) /* enable clipping */
+ (12 << 21); /* copy source */
}
#elif defined(MARS)
static inline void putPixel(byte* fb, pixel_t c, unsigned x, unsigned y, fixed_t brightness)
{
if (brightness <= 0)
brightness = 0;
else if (brightness >= FRACUNIT)
brightness = 0x7;
else
brightness = ((unsigned)brightness >> 13) & 0x7;
y >>= FRACBITS;
x >>= FRACBITS;
y <<= 6;
fb[(y << 2) + y + x] = c - brightness;
}
static void DrawLine(uint8_t *fb, pixel_t color, fixed_t x0, fixed_t y0, fixed_t x1, fixed_t y1, fixed_t miny, fixed_t maxy)
{
fixed_t dx, dy;
fixed_t gradient;
fixed_t x, steep, temp;
fixed_t xpxl1, xpxl2, inters;
fixed_t minyfrac = miny * FRACUNIT;
if ((x0 < 0 && x1 < 0) || (x0 >= 320 && x1 >= 320))
return;
if ((y0 < miny && y1 < miny) || (y0 >= maxy && y1 >= maxy))
return;
steep = D_abs(y1 - y0) > D_abs(x1 - x0);
if (steep)
{
// x and y should be reversed
temp = x0, x0 = y0, y0 = temp;
temp = x1, x1 = y1, y1 = temp;
}
if (x0 > x1)
{
temp = x0, x0 = x1, x1 = temp;
temp = y0, y0 = y1, y1 = temp;
}
x0 <<= FRACBITS;
y0 <<= FRACBITS;
x1 <<= FRACBITS;
y1 <<= FRACBITS;
// compute the slope
dx = x1 - x0;
dy = y1 - y0;
gradient = FRACUNIT;
if (dx != 0)
gradient = FixedDiv(dy, dx);
xpxl1 = x0;
xpxl2 = x1;
inters = y0;
if (steep)
{
if (xpxl1 < minyfrac)
{
inters += gradient * (((minyfrac-xpxl1)) >> FRACBITS);
xpxl1 = minyfrac;
}
}
else
{
if (xpxl1 < 0)
{
inters += gradient * ((-xpxl1) >> FRACBITS);
xpxl1 = 0;
}
}
// main loop
if (steep)
{
if (xpxl2 > (maxy-1) * FRACUNIT) xpxl2 = (maxy - 1) * FRACUNIT;
for (x = xpxl1; x <= xpxl2; x += FRACUNIT, inters += gradient)
{
fixed_t y = inters & ~(FRACUNIT - 1);
fixed_t b = inters & (FRACUNIT - 1);
if (y >= 0 && y <= 318 * FRACUNIT)
{
putPixel(fb, color, y, x, FRACUNIT - b);
putPixel(fb, color, y + FRACUNIT, x, b);
}
}
}
else if (y0 == y1)
{
fixed_t y;
int c1, c2;
int16_t *sfb;
x0 >>= FRACBITS;
x1 >>= FRACBITS;
y0 >>= FRACBITS;
if (x0 < 0)
x0 = 0;
if (x1 > 319)
x1 = 319;
y = y0;
if (y >= 222)
return;
if (y < miny)
return;
if (y >= maxy)
{
if (maxy < 223)
return;
}
c1 = ((color - 0x7) << 8) | (color - 0x7);
c2 = (color << 8) | color;
x = x0;
fb = &fb[(y << 8) + (y << 6) + x];
if (x & 1)
{
fb[0] = c1 & 0xff;
fb[320] = c2 & 0xff;
fb++;
x++;
}
sfb = (int16_t*)fb;
for ( ; x <= (x1 & ~1); x += 2)
{
sfb[0] = c1;
sfb[160] = c2;
sfb++;
}
if (x < x1)
{
fb = (byte*)sfb;
fb[0] = c1 & 0xff;
fb[320] = c2 & 0xff;
}
}
else
{
fixed_t maxyfrac = (maxy - 2) * FRACUNIT;
if (xpxl2 > 319 * FRACUNIT) xpxl2 = 319 * FRACUNIT;
for (x = xpxl1; x <= xpxl2; x += FRACUNIT, inters += gradient)
{
fixed_t y = inters & ~(FRACUNIT - 1);
fixed_t b = inters & (FRACUNIT - 1);
if (y >= minyfrac && y <= maxyfrac)
{
putPixel(fb, color, x, y, FRACUNIT - b);
putPixel(fb, color, x, y + FRACUNIT, b);
}
}
}
}
#endif
/*
==================
=
= AM_Control
=
= Called by P_PlayerThink before any other player processing
=
= Button bits can be eaten by clearing them in ticbuttons[playernum]
==================
*/
void AM_Control (player_t *player)
{
int buttons, oldbuttons;
fixed_t step;
#ifdef JAGUAR
cheat_e cheatcode;
#endif
int actionbtns = BT_ATTACK | BT_STRAFE | BT_USE;
buttons = ticbuttons[playernum];
oldbuttons = oldticbuttons[playernum];
if ( (buttons & BT_AUTOMAP) && !(oldbuttons & BT_AUTOMAP) )
{
player->automapflags ^= AF_ACTIVE;
player->automapx = oldplayerx = player->mo->x;
player->automapy = oldplayery = player->mo->y;
linesdrawn = UINT16_MAX;
#ifndef MARS
blockx = 80;
blocky = 90;
#endif
}
/* IF <5 LINES DRAWN, MOVE TO LAST POSITION! */
if (linesdrawn < 5)
{
player->automapx = oldplayerx;
player->automapy = oldplayery;
scale = oldscale;
}
else
{
oldplayerx = player->automapx;
oldplayery = player->automapy;
oldscale = scale;
}
if ( !(player->automapflags & AF_ACTIVE) )
return;
blink = blink&7; /* BLINK PLAYER'S BOX */
blink++;
pause++; /* PAUSE BETWEEN SCALINGS */
step = scale * 16;
if (buttons & BT_A)
step *= 2;
#ifdef JAGUAR
cheatcode = AM_CheckCheat(buttons,oldbuttons);
switch(cheatcode)
{
case ch_allmap:
showAllLines ^= 1;
break;
case ch_things:
showAllThings ^= 1;
default:
break;
}
#endif
ticbuttons[playernum] &= ~actionbtns;
oldticbuttons[playernum] &= ~actionbtns;
if (buttons & BT_C) /* IF 'C' IS HELD DOWN, MOVE AROUND */
{
player->automapx = player->mo->x;
player->automapy = player->mo->y;
ticbuttons[playernum] &= ~(BT_C | BT_STRAFELEFT | BT_STRAFERIGHT);
oldticbuttons[playernum] &= ~(BT_C | BT_STRAFELEFT | BT_STRAFERIGHT);
return;
}
if (buttons & BT_RIGHT)
{
player->automapx+=step;
}
if (buttons & BT_LEFT)
{
player->automapx-=step;
}
if (buttons & BT_UP)
{
if (buttons & BT_B)
{
scale -= SCALESTEP;
if (scale < MINSCALE)
scale = MINSCALE;
}
else
player->automapy+=step;
}
if (buttons & BT_DOWN)
{
if (buttons & BT_B)
{
scale += SCALESTEP;
if (scale > MAXSCALE)
scale = MAXSCALE;
}
else
player->automapy-=step;
}
ticbuttons[playernum] &= ~(BT_B | BT_LEFT | BT_RIGHT | BT_UP | BT_DOWN);
}
static void AM_DrawMapStats(void)
{
int i;
char buf[128];
int kc, sc, ic;
int kcol, scol, icol;
switch (netgame)
{
default:
kc = sc = ic = 0;
kcol = scol = icol = COLOR_WHITE;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
kc += players[i].killcount;
sc += players[i].secretcount;
ic += players[i].itemcount;
}
if (kc == totalkills)
kcol = CRY_AQUA;
if (sc == totalsecret)
scol = CRY_AQUA;
if (ic == totalitems)
icol = CRY_AQUA;
D_snprintf(buf, sizeof(buf), "^%02xK:%d/%d ^%02xI:%d/%d ^%02xS:%d/%d",
kcol, kc, totalkills,
icol, ic, totalitems,
scol, sc, totalsecret);
I_Print8(12, 20, buf);
break;
case gt_coop:
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
D_snprintf(buf, sizeof(buf), "P%d K:%d/%d I:%d/%d S:%d/%d", i + 1,
players[i].killcount, totalkills,
players[i].itemcount, totalitems,
players[i].secretcount, totalsecret);
I_Print8(12, 20 - MAXPLAYERS + 1 + i, buf);
}
break;
case gt_deathmatch:
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
D_snprintf(buf, sizeof(buf), "P%d Frags: %d", i + 1, players[i].frags);
I_Print8(12, 20 - MAXPLAYERS + 1 + i, buf);
}
break;
}
I_Print8(12, 21, gamemapinfo.name);
}
/*
==================
=
= AM_Drawer
=
= Draws the current frame to workingscreen
==================
*/
extern int workpage;
extern pixel_t *screens[2]; /* [SCREENWIDTH*SCREENHEIGHT]; */
static void AM_Drawer_ (int c)
{
int i;
player_t *p;
line_t *line;
int x1,y1;
int x2,y2;
int ox,oy;
int outcode;
int outcode2;
int color;
int drawn; /* HOW MANY LINES DRAWN? */
int miny, maxy;
extern VINT sbar_height;
int am_y;
int am_height;
int am_halfh;
byte *fb;
am_y = 0;
am_height = I_FrameBufferHeight() - sbar_height;
if (splitscreen)
{
am_y = sbar_height;
am_height -= sbar_height;
}
am_halfh = am_height / 2;
#ifdef JAGUAR
workingscreen = screens[workpage];
/* D_memset (workingscreen, 0, 160*180*2); */
*(int *)0xf0220c = zero; /* a1 pixel pointers */
*(int *)0xf02200 = (int)workingscreen; /* a1 base register */
*(int *)0xf02204 = (4<<3) /* 16 bit pixels */
+ (29<<9) /* 160 wide */
+ (0<<16) /* add phrase */
; /* a1 flags */
*(int *)0xf02240 = zero2;
*(int *)0xf02244 = ZERO; /* source data register */
*(int *)0xf0223c = 0x10000 + 160*180; /* count */
*(int *)0xf02238 = (12<<21); /* copy source */
#endif
p = &players[consoleplayer];
ox = p->automapx;
oy = p->automapy;
line = lines;
drawn = 0;
if (c == 0)
{
miny = 0;
maxy = am_height-1;
}
else if (c == 1)
{
miny = 0;
maxy = am_halfh;
}
else if (c == 2)
{
miny = am_halfh-1;
maxy = am_height-1;
}
fb = (byte*)I_FrameBuffer();
fb += am_y * 320;
{
int* p = (int*)(fb + 320 * ((miny + 1)&~1));
int* p_end = (int*)(fb + 320 * ((maxy + 1) & ~1));
D_memset(p, 0, (p_end-p)*sizeof(*p));
}
for (i=0 ; i<numlines ; i++,line++)
{
int flags;
vertex_t *v1, *v2;
flags = line->flags;
if ((!(flags & ML_MAPPED) || /* IF NOT MAPPED OR DON'T DRAW */
flags & ML_DONTDRAW) &&
(!(p->powers[pw_allmap] + showAllLines)))
continue;
v1 = &vertexes[line->v1];
v2 = &vertexes[line->v2];
y1 = v1->y;
y2 = v2->y;
y1 -= oy;
y2 -= oy;
y1 = IDiv(y1, scale);
y2 = IDiv(y2, scale);
y1 = am_halfh-y1;
y2 = am_halfh-y2;
outcode = (y1 > maxy) << 1;
outcode |= (y1 < miny) ;
outcode2 = (y2 > maxy) << 1;
outcode2 |= (y2 < miny) ;
if (outcode & outcode2) continue;
x1 = v1->x;
x2 = v2->x;
x1 -= ox;
x2 -= ox;
x1 = IDiv(x1, scale);
x2 = IDiv(x2, scale);
outcode = (x1 > 160) << 1;
outcode |= (x1 < -160);
outcode2 = (x2 > 160) << 1;
outcode2 |= (x2 < -160);
if (outcode & outcode2) continue;
x1 += 160;
x2 += 160;
/* */
/* Figure out color */
/* */
color = CRY_BROWN;
if ((p->powers[pw_allmap] +
showAllLines) && /* IF COMPMAP && !MAPPED YET */
!(flags & ML_MAPPED))
color = CRY_GREY;
else
if (!(flags & ML_TWOSIDED)) /* ONE-SIDED LINE */
color = CRY_RED;
else
if (line->special == 97 || /* TELEPORT LINE */
line->special == 39)
color = CRY_GREEN;
else
if (flags & ML_SECRET)
color = CRY_RED;
else
if (line->special)
color = CRY_BLUE; /* SPECIAL LINE */
else
if (LD_BACKSECTOR(line) != NULL &&
LD_FRONTSECTOR(line)->floorheight !=
LD_BACKSECTOR(line)->floorheight)
color = CRY_YELLOW;
else
if (LD_BACKSECTOR(line) != NULL &&
LD_FRONTSECTOR(line)->ceilingheight !=
LD_BACKSECTOR(line)->ceilingheight)
color = CRY_BROWN;
DrawLine (fb,color,x1,y1,x2,y2,miny,maxy);
drawn++;
}
if (c > 1)
return;
#ifdef MARS
Mars_R_SecWait();
#endif
linesdrawn = drawn;
if (blink > 2)
{
fixed_t c;
fixed_t s;
fixed_t x1,y1;
fixed_t nx1,ny1;
fixed_t nx2,ny2;
fixed_t nx3,ny3;
angle_t angle;
player_t *pl;
for (i=0;i<MAXPLAYERS;i++)
{
if ((i != consoleplayer) &&
(netgame != gt_coop))
continue;
pl = &players[i];
x1 = (pl->mo->x - players[consoleplayer].automapx);
y1 = (pl->mo->y - players[consoleplayer].automapy);
angle = pl->mo->angle;
color = !i ? CRY_GREEN : CRY_YELLOW;
c = finecosine(angle >> ANGLETOFINESHIFT);
s = finesine(angle >> ANGLETOFINESHIFT);
nx1 = FixedMul(c,NOSELENGTH) + x1;
ny1 = FixedMul(s,NOSELENGTH) + y1;
c = finecosine(((angle - ANG90) - ANG45) >> ANGLETOFINESHIFT);
s = finesine(((angle - ANG90) - ANG45) >> ANGLETOFINESHIFT);
nx2 = FixedMul(c, NOSELENGTH) + x1;
ny2 = FixedMul(s, NOSELENGTH) + y1;
c = finecosine(((angle + ANG90) + ANG45) >> ANGLETOFINESHIFT);
s = finesine(((angle + ANG90) + ANG45) >> ANGLETOFINESHIFT);
nx3 = FixedMul(c, NOSELENGTH) + x1;
ny3 = FixedMul(s, NOSELENGTH) + y1;
nx1 = IDiv(nx1, scale);
nx2 = IDiv(nx2, scale);
nx3 = IDiv(nx3, scale);
ny1 = IDiv(ny1, scale);
ny2 = IDiv(ny2, scale);
ny3 = IDiv(ny3, scale);
DrawLine(fb,color,160+nx1,am_halfh-ny1,160+nx2,am_halfh-ny2, 0, am_height-1);
DrawLine(fb,color,160+nx2,am_halfh-ny2,160+nx3,am_halfh-ny3, 0, am_height-1);
DrawLine(fb,color,160+nx1,am_halfh-ny1,160+nx3,am_halfh-ny3, 0, am_height-1);
}
}
/* SHOW ALL MAP THINGS (CHEAT) */
if (showAllThings)
{
fixed_t x1,y1;
fixed_t nx1,ny1;
fixed_t nx2,ny2;
fixed_t nx3,ny3;
mobj_t *mo;
mobj_t *next;
for (mo = mobjhead.next; mo != (void *)&mobjhead; mo=next)
{
next = mo->next;
if (mo == p->mo)
continue;
x1 = mo->x - p->automapx;
y1 = mo->y - p->automapy;
nx1 = x1;
ny1 = y1 - MOBJLENGTH;
nx2 = x1 - MOBJLENGTH;
ny2 = y1 + MOBJLENGTH;
nx3 = x1 + MOBJLENGTH;
nx1 = IDiv(nx1, scale);
nx2 = IDiv(nx2, scale);
nx3 = IDiv(nx3, scale);
ny1 = IDiv(ny1, scale);
ny2 = IDiv(ny2, scale);
ny3 = ny2;
DrawLine(fb,CRY_THINGS,160+nx1,am_halfh-ny1,160+nx2,am_halfh-ny2, 0, am_height-1);
DrawLine(fb,CRY_THINGS,160+nx2,am_halfh-ny2,160+nx3,am_halfh-ny3, 0, am_height-1);
DrawLine(fb,CRY_THINGS,160+nx1,am_halfh-ny1,160+nx3,am_halfh-ny3, 0, am_height-1);
}
}
AM_DrawMapStats();
}
#ifdef MARS
void Mars_Sec_AM_Drawer(void)
{
Mars_ClearCache();
AM_Drawer_(2);
}
void AM_Drawer(void)
{
Mars_AM_BeginDrawer();
AM_Drawer_(1);
Mars_AM_EndDrawer();
}
#else
void AM_Drawer(void)
{
AM_Drawer_(0);
}
#endif