2
2
#include " player.h"
3
3
#include " hud.h"
4
4
#include < TFE_DarkForces/sound.h>
5
+ #include < TFE_FrontEndUI/frontEndUi.h>
5
6
#include < TFE_Jedi/Level/level.h>
6
7
#include < TFE_Jedi/Level/levelData.h>
7
8
#include < TFE_Jedi/Level/rsector.h>
8
9
#include < TFE_Jedi/Level/rwall.h>
9
10
#include < TFE_Jedi/Memory/list.h>
10
11
#include < TFE_Jedi/InfSystem/infSystem.h>
12
+ #include < TFE_Jedi/InfSystem/infTypesInternal.h>
11
13
#include < TFE_Jedi/Renderer/jediRenderer.h>
12
14
#include < TFE_Jedi/Renderer/screenDraw.h>
15
+ #include < TFE_Jedi/Renderer/RClassic_GPU/screenDrawGPU.h>
13
16
#include < TFE_Jedi/Serialization/serialization.h>
17
+ #include < TFE_Settings/settings.h>
14
18
15
19
using namespace TFE_Jedi ;
16
20
17
21
namespace TFE_DarkForces
18
22
{
19
- enum MapWallColor
20
- {
21
- WCOLOR_INVISIBLE = 0 ,
22
- WCOLOR_NORMAL = 10 ,
23
- WCOLOR_LEDGE = 12 ,
24
- WCOLOR_GRAYED_OUT = 13 ,
25
- WCOLOR_DOOR = 19 ,
26
- };
27
-
28
- enum MapObjectColor
29
- {
30
- MOBJCOLOR_DEFAULT = 19 ,
31
- MOBJCOLOR_PROJ = 6 ,
32
- MOBJCOLOR_CORPSE = 48 ,
33
- MOBJCOLOR_LANDMINE = 1 ,
34
- MOBJCOLOR_PICKUP = 152 ,
35
- MOBJCOLOR_SCENERY = 21 ,
36
- };
37
23
38
24
enum MapConstants
39
25
{
@@ -112,7 +98,7 @@ namespace TFE_DarkForces
112
98
SERIALIZE (SaveVersionInit, s_mapZ0, 0 );
113
99
SERIALIZE (SaveVersionInit, s_mapZ1, 0 );
114
100
SERIALIZE (SaveVersionInit, s_mapLayer, 0 );
115
- }
101
+ }
116
102
117
103
// _computeScreenBounds() and computeScaledScreenBounds() in the original source:
118
104
// computeScaledScreenBounds() calls _computeScreenBounds() - so merged here.
@@ -489,32 +475,86 @@ namespace TFE_DarkForces
489
475
automap_drawLine (x0, z0, x1, z1, color);
490
476
}
491
477
478
+ // Note it assumes the wall adjoins a door sector
479
+ u8 getDoorKeyColor (RWall* wall)
480
+ {
481
+ KeyItem key = (KeyItem)sector_getKey (wall->sector );
482
+ if (key == KEY_NONE)
483
+ {
484
+ key = (KeyItem)sector_getKey (wall->nextSector );
485
+ }
486
+ switch (key)
487
+ {
488
+ case KEY_YELLOW:
489
+ return TFE_Settings::getMapColorByName (" Yellow Key Wall" )->colorMapIndex ;
490
+ case KEY_RED:
491
+ return TFE_Settings::getMapColorByName (" Red Key Wall" )->colorMapIndex ;
492
+ case KEY_BLUE:
493
+ return TFE_Settings::getMapColorByName (" Blue Key Wall" )->colorMapIndex ;
494
+ default :
495
+ return TFE_Settings::getMapColorByName (" Door Wall" )->colorMapIndex ;
496
+ }
497
+ }
498
+
492
499
u8 automap_getWallColor (RWall* wall)
493
500
{
494
501
u8 color;
502
+ // Default thickness - GPU only
503
+ setLineThickness (1 .5f );
504
+
495
505
if (wall->flags1 & WF1_HIDE_ON_MAP)
496
506
{
497
- color = WCOLOR_INVISIBLE ;
507
+ color = TFE_Settings::getMapColorByName ( " Invisible Wall " )-> colorMapIndex ;
498
508
}
499
509
else if (wall->flags1 & WF1_SHOW_AS_LEDGE_ON_MAP)
500
510
{
501
- color = WCOLOR_LEDGE ;
511
+ color = TFE_Settings::getMapColorByName ( " Ledge Wall " )-> colorMapIndex ;
502
512
}
503
513
else if (wall->flags1 & WF1_SHOW_AS_DOOR_ON_MAP)
504
514
{
505
- color = WCOLOR_DOOR ;
515
+ color = TFE_Settings::getMapColorByName ( " Door Wall " )-> colorMapIndex ;
506
516
}
507
- else if (( wall->flags1 & WF1_SHOW_NORMAL_ON_MAP) || !wall-> nextSector )
517
+ else if (wall->flags1 & WF1_SHOW_NORMAL_ON_MAP)
508
518
{
509
- color = WCOLOR_NORMAL;
519
+ color = TFE_Settings::getMapColorByName (" Normal Wall" )->colorMapIndex ;
520
+ }
521
+ else if (TFE_Settings::getGameSettings ()->df_showKeyColors && (sector_getKey (wall->sector ) || (wall->nextSector && sector_getKey (wall->nextSector ))))
522
+ {
523
+ setLineThickness (2 .0f );
524
+ color = getDoorKeyColor (wall);
525
+ }
526
+ else if (TFE_Settings::getGameSettings ()->df_showMapSecrets && isSecretSector (wall->sector ) || wall->nextSector && isSecretSector (wall->nextSector ))
527
+ {
528
+
529
+ // If Secret is discovered color it as such. Do not show nextsector secrets if they are not on your current layer.
530
+ if (wall->sector ->secretDiscovered || (wall->nextSector && wall->nextSector ->secretDiscovered && wall->nextSector ->layer == s_mapLayer))
531
+ {
532
+
533
+ color = TFE_Settings::getMapColorByName (" Secret Wall" )->colorMapIndex ;
534
+ }
535
+ // If you have map reveal show the secret as not found. Do not show adjoined walls that don't match the current layer.
536
+ else if (s_mapShowSectorMode != 0 && isSecretSector (wall->sector ) && wall->sector ->layer == s_mapLayer
537
+ && !(wall->nextSector && wall->nextSector ->layer != s_mapLayer))
538
+ {
539
+ color = TFE_Settings::getMapColorByName (" Secret Not Found Wall" )->colorMapIndex ;
540
+ }
541
+ // Show it as a normal sector if no cheats and you didn't discover it.
542
+ else
543
+ {
544
+ color = TFE_Settings::getMapColorByName (" Normal Wall" )->colorMapIndex ;
545
+ }
546
+ }
547
+ else if (!wall->nextSector )
548
+ {
549
+ color = TFE_Settings::getMapColorByName (" Normal Wall" )->colorMapIndex ;
510
550
}
511
551
else if (sector_isDoor (wall->sector ) || sector_isDoor (wall->nextSector ))
512
552
{
513
- color = WCOLOR_DOOR ;
553
+ color = TFE_Settings::getMapColorByName ( " Door Wall " )-> colorMapIndex ;
514
554
}
515
555
else if (s_mapShowSectorMode == 2 )
516
556
{
517
- color = WCOLOR_GRAYED_OUT ;
557
+ color = TFE_Settings::getMapColorByName ( " Grayed Out Wall " )-> colorMapIndex ;
518
558
}
519
559
else
520
560
{
@@ -525,11 +565,11 @@ namespace TFE_DarkForces
525
565
fixed16_16 floorDelta = TFE_Jedi::abs (curFloorHeight - nextFloorHeight);
526
566
if (floorDelta >= 0x4000 ) // 0.25 units
527
567
{
528
- color = WCOLOR_LEDGE ;
568
+ color = TFE_Settings::getMapColorByName ( " Ledge Wall " )-> colorMapIndex ;
529
569
}
530
570
else
531
571
{
532
- color = WCOLOR_INVISIBLE ;
572
+ color = TFE_Settings::getMapColorByName ( " Invisible Wall " )-> colorMapIndex ;
533
573
}
534
574
}
535
575
@@ -552,7 +592,7 @@ namespace TFE_DarkForces
552
592
}
553
593
554
594
u8 color = automap_getWallColor (wall);
555
- if (color != WCOLOR_INVISIBLE )
595
+ if (color != TFE_Settings::getMapColorByName ( " Invisible Wall " )-> colorMapIndex )
556
596
{
557
597
automap_drawWall (wall, color);
558
598
}
@@ -579,28 +619,34 @@ namespace TFE_DarkForces
579
619
580
620
void automap_drawObject (SecObject* obj)
581
621
{
582
- u8 color = MOBJCOLOR_DEFAULT;
622
+
623
+ if (!TFE_Settings::getGameSettings ()->df_showMapObjects )
624
+ {
625
+ return ;
626
+ }
627
+
628
+ u8 color = TFE_Settings::getMapColorByName (" Default Object" )->colorMapIndex ;
583
629
if (obj->flags & OBJ_FLAG_NEEDS_TRANSFORM)
584
630
{
585
631
if (obj->entityFlags & ETFLAG_PROJECTILE)
586
632
{
587
- color = MOBJCOLOR_PROJ ;
633
+ color = TFE_Settings::getMapColorByName ( " Projectile Object " )-> colorMapIndex ;
588
634
}
589
635
else if (obj->entityFlags & ETFLAG_CORPSE)
590
636
{
591
- color = MOBJCOLOR_CORPSE ;
637
+ color = TFE_Settings::getMapColorByName ( " Corpse Object " )-> colorMapIndex ;
592
638
}
593
639
else if (obj->entityFlags & ETFLAG_LANDMINE)
594
640
{
595
- color = MOBJCOLOR_LANDMINE ;
641
+ color = TFE_Settings::getMapColorByName ( " Landmine Object " )-> colorMapIndex ;
596
642
}
597
643
else if (obj->entityFlags & ETFLAG_PICKUP)
598
644
{
599
- color = MOBJCOLOR_PICKUP ;
645
+ color = TFE_Settings::getMapColorByName ( " Pickup Object " )-> colorMapIndex ;
600
646
}
601
647
else if (obj->entityFlags & ETFLAG_SCENERY)
602
648
{
603
- color = MOBJCOLOR_SCENERY ;
649
+ color = TFE_Settings::getMapColorByName ( " Scenery Object " )-> colorMapIndex ;
604
650
}
605
651
606
652
ObjectType type = obj->type ;
0 commit comments