Skip to content

Commit

Permalink
Increase Render Distance
Browse files Browse the repository at this point in the history
- Increase base draw distance to 5000.
- Increase max draw distance to 15000.
- Add medium draw distance for certain levels.
- Remove cyclorama from depth buffer.
- Remove cyclorama requirement from gLevelClearColor.
- Change the type of gNumEnemyOfKind to int32_t.
- Raise MAX_SUPERTILE_ACTIVE_RANGE to 20.
- Change all values in gLevelSuperTileActiveRange to fit in the 8-20 range.
- Raise MAX_LIQUID_MESHES to 255.
Issue jorio#24.
  • Loading branch information
LordNyriox authored Jun 28, 2022
1 parent 90e40df commit aefe916
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/Enemies/Enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static Boolean KillEnemy(ObjNode *theEnemy);
/* VARIABLES */
/*********************/

short gNumEnemyOfKind[NUM_ENEMY_KINDS];
int32_t gNumEnemyOfKind[NUM_ENEMY_KINDS];
short gNumEnemies;


Expand Down
2 changes: 1 addition & 1 deletion src/Headers/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//

#define HITHER_DISTANCE 20.0f
#define YON_DISTANCE 2800.0f // how far the game will render objects in the view frustum
#define YON_DISTANCE 5000.0f // how far the game will render objects in the view frustum

void InitCamera(void);
void UpdateCamera(void);
Expand Down
2 changes: 1 addition & 1 deletion src/Headers/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ extern short gMoney;
extern short gNumBlueClovers;
extern short gNumCollisions;
extern short gNumEnemies;
extern short gNumEnemyOfKind[];
extern int32_t gNumEnemyOfKind[];
extern short gNumGoldClovers;
extern short gNumGreenClovers;
extern short gNumLadyBugsThisArea;
Expand Down
4 changes: 2 additions & 2 deletions src/Headers/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ typedef struct RenderModifiers

enum
{
kDrawOrder_Terrain = -128,
kDrawOrder_Cyclorama,
kDrawOrder_Cyclorama = -128, // give it a lower value than the terrain to draw it first
kDrawOrder_Terrain = -127,
kDrawOrder_Fences,
kDrawOrder_Shadows,
kDrawOrder_Default = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/Headers/terrain.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ enum

#define TERRAIN_SUPERTILE_UNIT_SIZE (SUPERTILE_SIZE*TERRAIN_POLYGON_SIZE) // world unit size of a supertile

#define MAX_SUPERTILE_ACTIVE_RANGE 5 // max value of gSuperTileActiveRange
#define MAX_SUPERTILE_ACTIVE_RANGE 20 // max value of gSuperTileActiveRange
// The largest map in the game (Night.ter) is 50x40 supertiles == 2000 supertiles.
// Therefore, the maximum useful value for MAX_SUPERTILE_ACTIVE_RANGE is 23 (because (23*2)**2 == 2116 supertiles)

Expand Down
8 changes: 4 additions & 4 deletions src/Items/Items.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ void CreateCyclorama(void)

// Notes on cyclorama status bits:
// - HIDDEN because we'll draw it manually in DrawTerrain.
// - Don't set NOZWRITE, contrary to the original source code. The cyc does appear to clip
// through the terrain and fences on the OS 9 version, effectively reducing draw distance
// somewhat. See: faraway fences seen from the starting position in level 4.
gNewObjectDefinition.flags = STATUS_BIT_DONTCULL | STATUS_BIT_NULLSHADER | STATUS_BIT_NOFOG | STATUS_BIT_HIDDEN;
// - NOZWRITE was set in the original source code.
// The cyc should not clip through the terrain or fences.
// See: faraway fences seen from the starting position in level 4.
gNewObjectDefinition.flags = STATUS_BIT_DONTCULL | STATUS_BIT_NULLSHADER | STATUS_BIT_NOFOG | STATUS_BIT_NOZWRITE | STATUS_BIT_HIDDEN;

gCyclorama = MakeNewDisplayGroupObject(&gNewObjectDefinition);
gCyclorama->RenderModifiers.drawOrder = kDrawOrder_Cyclorama;
Expand Down
2 changes: 1 addition & 1 deletion src/Items/Liquids.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static void ApplyJitterToLiquidVertex(TQ3Point3D* p, int type);
/* CONSTANTS */
/****************************/

#define MAX_LIQUID_MESHES 32
#define MAX_LIQUID_MESHES 255
#define MAX_LIQUID_SIZE 20
#define MAX_LIQUID_TRIANGLES (MAX_LIQUID_SIZE*MAX_LIQUID_SIZE*2)
#define MAX_LIQUID_VERTS ((MAX_LIQUID_SIZE+1)*(MAX_LIQUID_SIZE+1))
Expand Down
50 changes: 27 additions & 23 deletions src/System/Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ static const bool gLevelHasCeiling[NUM_LEVEL_TYPES] =

static const Byte gLevelSuperTileActiveRange[NUM_LEVEL_TYPES] =
{
5, // garden
4, // boat
5, // dragonfly
4, // hive
4, // night
4 // anthill
20, // garden
16, // boat
20, // dragonfly
8, // hive
16, // night
8 // anthill
};

static const float gLevelFogStart[NUM_LEVEL_TYPES] =
Expand All @@ -144,11 +144,11 @@ static const float gLevelFogEnd[NUM_LEVEL_TYPES] =

static const float gLevelAutoFadeStart[NUM_LEVEL_TYPES] =
{
YON_DISTANCE+400, // garden
YON_DISTANCE+5500, // garden
0, // boat
0, // dragonfly
0, // hive
YON_DISTANCE-250, // night
YON_DISTANCE+4000, // night
0, // anthill
};

Expand Down Expand Up @@ -197,8 +197,8 @@ static const TQ3ColorRGBA gLevelFogColor[NUM_LEVEL_TYPES] =
// Source port addition: on rare occasions you get to see the void "above" the cyclorama.
// To camouflage this, we make the clear color roughly match the color at the top of the cyc.
// This is not necessarily the same color as the fog!
// NOTE: If there's no cyc in a level, this value is ignored and the fog color is used instead.
static const TQ3ColorRGBA gLevelClearColorWithCyc[NUM_LEVEL_TYPES] =
// NOTE: If there's no cyc in a level, this value is still used.
static const TQ3ColorRGBA gLevelClearColor[NUM_LEVEL_TYPES] =
{
{ 0.352f, 0.380f, 1.000f, 1.000f }, // garden (DIFFERENT FROM FOG)
{ 0.900f, 0.900f, 0.850f, 1.000f }, // boat (same)
Expand Down Expand Up @@ -466,15 +466,22 @@ QD3DSetupInputType viewDef;
gBestCheckPoint = -1; // no checkpoint yet


if (gSuperTileActiveRange == 5) // set yon clipping value
switch (gLevelType) // set yon clipping value
{
gCurrentYon = YON_DISTANCE + 1700;
gCycScale = 81;
}
else
{
gCurrentYon = YON_DISTANCE;
gCycScale = 50;
case LEVEL_TYPE_LAWN: // high visibility outdoor levels
case LEVEL_TYPE_FOREST:
gCurrentYon = YON_DISTANCE + 10000;
gCycScale = 300; // gCycScale = (0.02f * gCurrentYon)
break;
case LEVEL_TYPE_POND: // low visibility outdoor levels
case LEVEL_TYPE_NIGHT:
gCurrentYon = YON_DISTANCE + 5000;
gCycScale = 200;
break;
default: // indoor levels
gCurrentYon = YON_DISTANCE;
gCycScale = 100;
break;
}


Expand Down Expand Up @@ -552,11 +559,8 @@ QD3DSetupInputType viewDef;
viewDef.lights.fogMode = kQ3FogModePlaneBasedLinear; // Source port note: plane-based linear fog accurately reproduces fog rendering on real Macs

// Source port addition: camouflage seam in sky with custom clear color that roughly matches top of cyc
if (gUseCyclorama)
{
viewDef.lights.useCustomFogColor = true; // need this so fog color will be different from clear color
viewDef.view.clearColor = gLevelClearColorWithCyc[gLevelType];
}
viewDef.lights.useCustomFogColor = true; // need this so fog color will be different from clear color
viewDef.view.clearColor = gLevelClearColor[gLevelType];

// if (gUseCyclorama && (gLevelType != LEVEL_TYPE_FOREST) && (gLevelType != LEVEL_TYPE_NIGHT))
// viewDef.view.dontClear = true;
Expand Down

1 comment on commit aefe916

@foote-darrell
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I download the actual release of this? It doesn't have any apps ot download. Following the build steps doesn't seem to work.

Please sign in to comment.