Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Macros | Functions | Variables
3D_VIEW.C File Reference
#include <math.h>
#include "3D_IO.H"
#include "3D_TRIG.H"
#include "GRAPHICS.H"
#include "OBJECT.H"
#include "PLAYER.H"
#include "MAP.H"
#include "MEMORY.H"
#include "PICS.H"
#include "TICKER.H"
#include "VIEW.H"

Data Structures

struct  T_3dFloorRun
 
struct  T_3dObjectColRun
 
struct  T_3dObjectRun
 
struct  T_3dObjectRunInfo
 
struct  T_3dWall
 
struct  T_3dWallRun
 
struct  T_3dWallSlice
 
struct  T_floorInfo
 
struct  T_horzFloorInfo
 
struct  T_pictureRaster
 
struct  T_vertFloorInfo
 

Macros

#define LOWER_TYPE   2
 
#define M_PI   3.14159265358979323846
 
#define MAX_FIND_SECTOR_LINES   20
 
#define MAX_FLOOR_INDEXES   40
 
#define MAX_FLOOR_INFO   5000
 
#define MAX_INTERSECTIONS   50
 
#define MAX_OBJECT_COLUMN_RUNS   8000
 
#define MAX_OBJECT_COLUMNS   50
 
#define MAX_OBJECTS   500
 
#define MAX_WALL_RUNS   8000
 
#define MAX_WALL_SLICES_PER_COLUMN   10
 
#define NEXT_IS_NONE   0
 
#define P_vgaBuffer   ((T_byte8 *)0xA0000)
 
#define SECTOR_IS_UNKNOWN   0x8000
 
#define SECTOR_IS_WALL   0xFFFF
 
#define SECTOR_NONE   0xFFFF
 
#define UPPER_TYPE   0
 
#define VIEW3D_CROSS_RATIO   (65536 / VIEW3D_WIDTH)
 
#define VIEW_3D_LEFT_ANGLE   0x2000
 
#define WALL_TYPE   1
 
#define ZMIN   ((T_sword32) 10 << 16)
 

Functions

T_word16 CalculateDistance (T_sword32 x1, T_sword32 y1, T_sword32 x2, T_sword32 y2)
 
T_word16 CalculateDistanceOld2 (T_sword16 x1, T_sword16 y1, T_sword16 x2, T_sword16 y2)
 
T_word16 CalculateDistanceOld3 (T_sword16 x1, T_sword16 y1, T_sword16 x2, T_sword16 y2)
 
T_word16 CalculateEstimateDistance (T_sword16 x1, T_sword16 y1, T_sword16 x2, T_sword16 y2)
 
T_void ClearSampleAsm (T_byte8 *ptr)
 
T_word16 DebugIFindSectorNum (T_sword16 x, T_sword16 y)
 
T_void DrawObjectColumnAsm (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm1 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm128 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm16 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm2 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm256 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm32 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm4 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm64 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureColumnAsm8 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm1 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm128 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm16 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm2 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm256 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm32 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm4 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm64 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTextureRowAsm8 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransColumnAsm (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm1 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm128 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm16 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm2 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm256 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm32 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm4 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm64 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentColumnAsm8 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTranslucentObjectColumnAsm (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm1 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm128 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm16 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm2 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm256 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm32 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm4 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm64 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransparentColumnAsm8 (T_byte8 *p_shade, T_word32 count, T_sword32 textureStep, T_sword32 textureOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm1 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm128 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm16 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm2 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm256 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm32 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm4 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm64 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_void DrawTransRowAsm8 (T_byte8 *p_shade, T_word32 count, T_sword32 xOffset, T_sword32 yOffset, T_byte8 *p_pixel)
 
T_sword32 FindInterXAsm (T_sword32 deltaX, T_sword32 deltaZ, T_sword32 tanViewAngle, T_sword32 zTop)
 
T_void IAddLowerWall (T_void)
 
T_void IAddMainWall (T_void)
 
T_void IAddObjectSlice (T_sword32 zDist, T_sword16 x, T_sword16 clipTop, T_sword16 clipBottom)
 
T_void IAddUpperWall (T_void)
 
T_void IAddWall (T_sword16 sx1, T_sword16 sx2, T_sword16 relativeBottom, T_sword16 relativeTop, T_sword16 relativeFromZ, T_sword16 relativeToZ)
 
T_void ICalculateWallMatrix (T_void)
 
E_Boolean ICheckValidRow (T_word16 row, T_word16 run)
 
E_Boolean ICheckValidRow2 (T_word16 row, T_word16 run)
 
int ICompareObjectRuns (const void *first, const void *second)
 
T_word32 IDetermineDistToLine (T_sword16 x, T_sword16 y, T_word16 lineNum)
 
T_byte8IDetermineShade (T_sword32 distance, T_word16 shadeStart)
 
T_void IDrawColumn (T_word16 x, T_word16 top, T_word16 bottom, T_byte8 color)
 
T_void IDrawFloorRun (T_word16 y, T_horzFloorInfo *p_floor)
 
T_void IDrawNode (T_word16 nodeIndex)
 
T_void IDrawObjectAndWallRuns (T_void)
 
T_void IDrawObjectColumn (T_word16 column, T_3dObjectColRun *p_objCol)
 
T_void IDrawPixel (T_byte8 *p_pixel, T_byte8 color)
 
T_void IDrawRow (T_word16 y, T_word16 left, T_word16 right, T_byte8 color)
 
T_void IDrawRuns (T_void)
 
T_void IDrawSegment (T_word16 segmentIndex)
 
T_void IDrawSSector (T_word16 ssectorIndex)
 
T_void IDrawTextureColumn (T_word16 x, T_3dWallRun *p_run)
 
T_void IDrawTextureColumnNew (T_byte8 *p_shade, T_word16 numPixels, T_word32 textureStep, T_word32 textureOffset, T_byte8 *p_pixel, T_byte8 shift)
 
T_void IDumpVertFloor (T_void)
 
T_sword32 IFindIntersectX (T_word16 line, T_sword16 y)
 
E_Boolean IFindObject (T_3dObject *p_obj)
 
T_void IFindObjects (T_void)
 
T_word16 IFindSectorNum (T_sword16 x, T_sword16 y)
 
E_Boolean IIsSegmentGood (T_word16 segmentIndex)
 
T_void IMarkOffWall (T_void)
 
T_sword16 IObjectPartition (T_sword16 p, T_sword16 r)
 
T_byte8 IOnRightOfLine (T_sword16 x, T_sword16 y, T_word16 line)
 
T_word16 IQuickSquareRoot (T_word32 value)
 
T_void ISetupDistanceTable (T_void)
 
T_void ISortObjectQuick (T_sword16 p, T_sword16 q)
 
T_void ISortObjects (T_void)
 
T_sword32 MultAndDivideAsm (T_sword32 multA, T_sword32 multB, T_sword32 divC)
 
T_sword32 MultAndShift16 (T_sword32 a, T_sword32 b)
 
T_sword32 MultAndShift22 (T_sword32 a, T_sword32 b)
 
T_sword32 MultAndShift32 (T_sword32 a, T_sword32 b)
 
T_sword32 MultAndShift6 (T_sword32 a, T_sword32 b)
 
T_void View3dAddObject (T_3dObject *p_obj)
 
T_3dObjectView3dAllocateObject (T_void)
 
T_void View3dCheckObjectListEmpty (T_void)
 
T_void View3dClipCenter (T_word16 centerWidth)
 
T_void View3dDisplayView (T_void)
 
T_void View3dDrawView (T_void)
 
T_word16 View3dFindClosestLine (T_sword16 x, T_sword16 y)
 
T_word16 View3dFindSide (T_sword16 x, T_sword16 y)
 
T_void View3dFinish (T_void)
 
T_void View3dFreeObject (T_3dObject *p_obj)
 
T_word16 View3dGetObjectAtColumn (T_word16 objPos, T_3dObject **p_obj, T_word16 column)
 
T_word16 View3dGetObjectAtXY (T_word16 objPos, T_3dObject **p_obj, T_word16 x, T_word16 y)
 
T_word16 View3dGetSectorSide (T_word16 lineNum, T_sword16 x, T_sword16 y)
 
T_word16 View3dGetSide (T_word16 lineNum, T_sword16 x, T_sword16 y)
 
T_sword32 View3dGetUpDownAngle (T_void)
 
T_void View3dGetView (T_sword16 *p_x, T_sword16 *p_y, T_sword32 *p_height, T_word16 *p_angle)
 
T_void View3dInitialize (T_void)
 
T_byte8 View3dLeftSideInCone (T_word16 nodeIndex)
 
T_byte8 View3dOnRightByNode (T_word16 nodeIndex)
 
T_byte8 View3dOnRightByNodeWithXY (T_word16 nodeIndex, T_sword16 x, T_sword16 y)
 
T_byte8 View3dOnRightByVertices (T_word16 from, T_word16 to)
 
T_byte8 View3dOnRightByVerticesXY (T_word16 from, T_word16 to, T_sword16 x, T_sword16 y)
 
T_void View3dRemapSectors (T_void)
 
T_void View3dRemoveObject (T_3dObject *p_obj)
 
T_byte8 View3dRightSideInCone (T_word16 nodeIndex)
 
T_void View3dSetDarknessAdjustment (T_sbyte8 darkAdjust)
 
T_void View3dSetHeight (T_sword32 height)
 
T_void View3dSetSize (T_word16 width, T_word16 height)
 
T_void View3dSetUpDownAngle (T_sword32 alpha)
 
T_void View3dSetView (T_sword16 x, T_sword16 y, T_sword32 height, T_word16 angle)
 
T_void View3dUnmapSectors (T_void)
 
T_void View3dUpdateSectorLightAnimation (T_void)
 

Variables

T_sword32 G_3dCosPlayerLeftAngle
 
T_sword32 G_3dCosPlayerRightAngle
 
T_sword32 G_3dSinPlayerLeftAngle
 
T_sword32 G_3dSinPlayerRightAngle
 
T_word16 G_allocatedColRun = 0
 
T_sword32 G_alpha = 0x0000
 
T_byte8G_backdrop = NULL
 T_byte8 *GG_palette ;. More...
 
T_word16 G_backdropOffset = 0
 
T_word16 G_colCount
 
T_byte8 G_colDone [MAX_VIEW3D_WIDTH]
 
T_byte8G_CurrentTexturePos
 
T_sbyte8 G_darknessAdjustment
 
E_Boolean G_didDrawWall
 
T_word16 G_firstSSector
 
T_word16 G_intCount [MAX_VIEW3D_WIDTH]
 
T_word16 G_intersections [MAX_INTERSECTIONS][MAX_VIEW3D_WIDTH]
 
T_sword16 G_maxY [MAX_VIEW3D_WIDTH]
 
T_sword16 G_minY [MAX_VIEW3D_WIDTH]
 
T_word16 G_nodeCount
 
T_word16 G_numVertFloor
 
T_byte8 G_numWallSlices [MAX_VIEW3D_WIDTH]
 
T_word16 G_objColumnEnd
 
T_word16 G_objColumnStart
 
T_3dObjectColRun G_objectColRunList [MAX_OBJECT_COLUMN_RUNS]
 
T_word16 G_objectColStart [MAX_VIEW3D_WIDTH]
 
T_word16 G_objectCount
 
T_3dObjectRun G_objectRun [MAX_OBJECTS]
 
T_word16G_remapSectorCeilingArray
 
T_word16G_remapSectorFloorArray
 
T_sword32 G_screenObjectDistance [MAX_VIEW3D_WIDTH]
 
T_word16 G_screenObjectPosition [MAX_VIEW3D_WIDTH]
 
T_word16 G_segCount
 
T_byte8 G_squareRootTable [16384]
 
T_word32 G_textureAndX =63
 
T_word32 G_textureAndY =63
 
T_word16 G_textureShift =6
 
T_sword32 G_textureStepX
 
T_sword32 G_textureStepY
 
T_vertFloorInfo G_vertFloorInfo [MAX_FLOOR_INFO]
 
T_word16 G_vertFloorStarts [MAX_VIEW3D_WIDTH]
 
T_3dWall G_wall
 
T_word16 G_wallAttempt
 
T_word16 G_wallCount
 
T_word16 G_wallRunCount
 
T_3dWallSlice G_wallSlices [MAX_VIEW3D_WIDTH][MAX_WALL_SLICES_PER_COLUMN]
 
T_byte8P_doubleBuffer
 
T_byte8 P_shadeIndex [16384]
 
T_sword16 VIEW3D_CLIP_LEFT = 100
 
T_sword16 VIEW3D_CLIP_RIGHT = 200
 
T_sword16 VIEW3D_EVEN_HALF_HEIGHT = 70
 
T_sword16 VIEW3D_HALF_HEIGHT = 70
 
T_sword16 VIEW3D_HALF_WIDTH = 150
 
T_sword16 VIEW3D_HEIGHT = 140
 
T_sword16 VIEW3D_WIDTH = 300