📄 level.h
字号:
/* LEVEL.H
*
* provides Level-Declarations & -operations
*
* Copyright 2003 by PaP / JTMK
*/
/*
Level
|
O1 -> O2 -> O3 -> ... -> On
|
SubO1 -> SubO2 -> SubO3 -> ... -> SubOn
*/
#ifndef Level_H
#define Level_H
#include "Vectors.h"
#include "bcls.h"
#include "gamedefines.h"
#define ReflectAmount 0.3
#define _Stand_Normal 0.8
#define _Hit_false 0
#define _Hit_true 1
#define _Hit_Stand 3
#define _Command_GlobalEnd 100
#define _Command_GlobalStart 0
#define _Command_Cube 1
#define _Command_Change_Attributes 2
#define _Command_Move_Vertice_With_Radius 3
#define _Command_Clone 5
#define _Command_Make_Sub 6
#define _Command_Create_Plane 7
#define _Command_Create_Kegel 8
#define _Command_Create_Torus 9
#define _Command_Set_Material 10
#define _Command_Create_Cylinder 11
#define _Command_Rotate 12
#define _Command_Merge 13
#define _Command_InsertLevel 14
#define _Command_ChangeFlags 15
#define _Command_MoveMitte 16
#define _Command_CreateItem 17
#define _Command_Change_Attributes_Opt 18
#define _Command_Insert_Opt 19
#define _Command_Cube_Opt 20
#define _Command_Set_Material_Opt 21
#define _Command_ChangeFlags_Opt 22
#define _Command_Rotate_Opt 23
#define _Command_Move_Vertice_With_Radius_Opt 24
#define _Command_CreateItem_Opt 25
#define _Command_Make_Sub2 26
#define _Command_Clone2 27
#define _Tex_Sphere 1
#define _Tex_Cube 2
#define _Tex_CylinderX 3
#define _Tex_CylinderY 4
#define _Tex_CylinderZ 5
#define _SF_WalkThrough 1
#define _SF_SkeletonNode 2
#define _SF_Player 4
#define _SF_ItemBox 8
#define _SF_Bumper 16
#define _SF_Effect 32
#define _SF_Dead 64
#define _SF_Effect_Flamer 0
#define _SF_Effect_Water 1
#define _SF_Effect_Swing 2
#define _SF_Effect_Move 3
#define _TT_X 0
#define _TT_Y 1
#define _TT_Z 2
#define _TT_Normal 3
#define _TT_Wrap 4
#define MaxMaterials 100
#pragma pack(push,1)
typedef struct
{
tP3D P1; // xmin,ymin,zmin
tP3D P2; // xmax,ymax,zmax
}tBoundBox;
typedef struct tWandVertice
{
// DONT MODIFY POSITION OF POS !!!!
tP3D Pos; // Position des Punktes (Relativ)
tP3D WorldPos; // Position des Punktes (Kartesisch)
tP3D Normal; // Normale des Punktes
tP2D TexPos; // TexturPosition
long Cnt; // Counter
tWandVertice *Child; // UnterPunkt
tWandVertice *Next; // N鋍hster Punkt
} t_WandVertice;
typedef struct tWandPoly
{
tBoundBox BoundBox; // Boundary Box
tP3D Normal; // Normale des Polygons
tWandVertice *P1,*P2,*P3;// Punkte des Polygons
tP2D Env1,Env2,Env3; // Environment Textur Koordinaten
tP2D T1,T2,T3; // TexturePunkte
tP3D Norm1,Norm2,Norm3;
tWandPoly *Next; // N鋍hstes Polygon
} t_WandPoly;
typedef struct tGrund
{
tWandPoly *Poly; // PolygonListe
tWandVertice *Vertice; // VerticeListe
tBoundBox BoundBox; // BoundBox
bool DisplayListOn;
long DisplayList;// DisplayList des Meshes
} t_Grund;
typedef struct tMaterial
{
tP3D Color; // Farbe (wenn Textured==false)
bool Textured; // Textur verwenden ?
long TexNr; // Textur Nummer
} t_Material;
struct tCommand_Create_Cube_Opt
{
char PartsI;
unsigned char EckAmount;
};
struct tCommand_Create_Plane
{
char PartsI;
float EckAmount;
};
struct tCommand_Create_Cylinder
{
char Parts,Rings;
float EckAmount;
};
struct tCommand_Create_Torus
{
char Parts,Rings;
float Radius;
};
struct tCommand_Change_Attributes_Opt
{
unsigned short Nr;
unsigned char Content;
tP3D Size,Pos;
float SizeMul;
};
struct tCommand_Create_Kegel
{
char Parts,BParts,Rings;
};
struct tCommand_MoveMitte
{
unsigned short Nr;
tP3D Pos;
};
struct tCommand_CreateItem_Opt
{
tP3D Pos;
unsigned char Flags;
unsigned char Attr;
};
struct tCommand_Move_Vertice_With_Radius_Opt
{
// 1,2,4 - Subdivs
// 8 - Sector Char(1) or Float(0)
// 16 - Vertice Char(1) or Float(0)
// 32,64,128 - Vek(1)
unsigned short SNr; // Nr des Sectors
unsigned short VNr; // Nr des Vertices
char SubDivs; // Wie oft Subdivided wird
tP3D Vek; // Move-Vektor
float Radius; // Move - Radius
};
struct tCommand_Clone
{
unsigned short SNr; // Nr des zu klonenden Sectors
};
struct tCommand_Clone2
{
unsigned char SNr; // Nr des zu klonenden Sectors
};
struct tCommand_Make_Sub
{
unsigned short SNr; // Nr des zu verschiebenden Sectors
unsigned short FNr; // Nr des neuen Vaters
};
struct tCommand_Make_Sub2
{
unsigned char SNr; // Nr des zu verschiebenden Sectors
unsigned char FNr; // Nr des neuen Vaters
};
struct tCommand_Merge
{
unsigned short SNr; // Nr des zu mergenden Sectors
unsigned short FNr; // Nr des neuen Gesamtsectors
};
struct tCommand_InsertOpt
{
unsigned char Nr;
};
struct tCommand_Set_Material_Opt
{
unsigned short SNr; // Nr des Sectors
unsigned char Material; // MaterialNummer
float Par1; // z.B. XSize
float Par2; // z.B. YSize
char TexType; // Art der Texturierung
};
struct tCommand_ChangeFlags_Opt
{
unsigned short SNr;
unsigned char Flags;
long Attr;
};
struct tCommand_Rotate_Opt
{
unsigned short SNr;
// unsigned short Amount;
char Dir;
float Amount;
};
//#ifndef BCLMemoryLoading
struct tCommand_CreateItem
{
tP3D Pos;
long Flags;
long Attr;
};
struct tCommand_Change_Attributes
{
unsigned short Nr;
tP3D Size,Pos;
float SizeMul;
};
struct tCommand_Create_Cube
{
char PartsI;
float EckAmount;
};
struct tCommand_Move_Vertice_With_Radius
{
unsigned short SNr; // Nr des Sectors
unsigned short VNr; // Nr des Vertices
char SubDivs; // Wie oft Subdivided wird
tP3D Vek; // Move-Vektor
float Radius; // Move - Radius
};
struct tCommand_InsertLevel
{
char FName[8]; // Name des einzuf黦enden Levels
};
struct tCommand_Set_Material
{
unsigned short SNr; // Nr des Sectors
unsigned short Material; // MaterialNummer
float Par1; // z.B. XSize
float Par2; // z.B. YSize
char TexType; // Art der Texturierung
};
struct tCommand_Rotate
{
unsigned short SNr;
char Dir;
float Amount;
};
struct tCommand_ChangeFlags
{
unsigned short SNr;
long Flags;
long Attr;
};
//#endif
struct tCommand
{
char Type;
void *Data;
tCommand *Next;
};
#pragma pack(pop,1)
struct tSector
{
tP3D Pos; // Position des Sektors (Katesisch)
tP3D OrgPos; // OriginalPosition (relativ)
float Roll; // RollFaktor
tP3D Size; // Gr鰏se des Sektors (Relativ)
float SizeMul; // Gr鰏senmultiplikator
float WSize; // Gr鰏senmultiplikator global
long MatNr; // Material Nummer
long Flags; // Flags
// 0 - Walk-Through-Able
// 1 - SkeletonNode ?
tP3D ModPos; // SectorModification - for Sector Effects
long Attr; // Zusatz - Attribut
long Attr2;
long Attr3;
long Attr4;
// bool Clipped;
float CamAb; // Camera - Abstand
bool IsActive; // Im Cam-Bereich ?
tBoundBox BoundBox; // Bounding - Box
tOMatrix Matrix; // OrientierungsMatrix
tGrund *Mesh; // Vertexes und Polys (relativ)
tSector *Father; // Tja, Father halt
tSector *SubSector; // SubSektoren
tSector *Next; // NachbarSektoren
};
//tGrund *CreatePolyList(long Anz,float Size,tP3D ZielPos,float TX,float TY);
tGrund *CreateSmoothPlane(float EckAmount,float Smooth);
bool IsInBoundBox(tBoundBox *Temp,tP3D *Pos,float Toleranz);
long ClipPointAgainst(tP3D Pos,tP3D *_PSpeed,tSector *Sector,float MinAb,tP3D *NewSpeed);
void DestroyGrund(tGrund *Temp);
tBoundBox ReCalcSectorBoundBoxes(tSector *Sector);
// Erzeugt leeren Sector
tSector *CreateSector();
// F黦t Sector "Child" als Subsector in "Father" ein
void AddSector(tSector *Father,tSector *Child);
// Gibt den Letzten SubSector von Temp
tSector *LastSector(tSector *Temp);
// Sucht die Position von SubS in Root
long GetNrOfSubSector(tSector *Root,tSector *SubS);
// Sucht den SubSector mit der Position Nr
tSector *GetSubSectorNr(tSector *Root,long Nr);
// Erzeugt einen Klon des Sectors
tSector *CopySector(tSector *Sector,tSector *_Father,bool MitSub,bool MitNext);
// Erzeugt leeres Command
tCommand *CreateCommand();
// F黦t ein Command zu einer CommandListe hinzu
void AddCommand(tCommand *List,tCommand *Command);
// Gibt Adresse der Nr'ten Vertices
tWandVertice *GetWandVertice(tWandVertice *Temp,long Nr);
// Wendet ein Command auf Sector an
void *CalcCommand(tCommand *C,tSector *Sector);
// L鰏cht einen Sector incl. SubSectors
void DestroySector(tSector *Temp);
// L鰏cht ein Command
void DestroyCommand(tCommand *Temp);
// Berechnet die Matrizen von Sector neu
void ReCalcMatrices(tSector *Sector,tOMatrix OldMatrix,float Size);
// Berechnet die Kartesischen Koordinaten der Meshes
void ReCalcMeshes(tSector *Sector,tOMatrix OldMatrix,tP3D OldPos);
// F黦t TempA zu Temp hinzu
void AttachMaterial(tMaterial *Temp,tMaterial *TempA);
tSector *ReCalcCommandList(tCommand *Command);
void CreateMaterials();
void CalcNormals(tGrund *Grund);
void CalcNormalsBasedOnPolys(tGrund *Grund);
void ReCalcPolyNormals(tSector *Sector);
tCommand *LoadLevel(char *fname);
tCommand *LoadLevelFromMem(unsigned char *DaAddr);
/*
tGrund *ReduceMesh(tGrund *Mesh,float Epsilon,float EckEpsilon);
void ReduceSector(tSector *Sector,float Epsilon,float EckEpsilon);
void CalcLowerVersions(tSector *Sector,long Anzahl,float RMin,float RMax);
*/
tGrund *CopyGrund(tGrund *Grund);
void DelBoundBox(tBoundBox *Temp);
//tGrund *CreatePolyList(float Radius,long Parts1,long Parts2);
void SetPointsAsTheyAre(tSector *Sector);
void SetTexture(tGrund *Temp,float TexXS,float TexYS);
void SetTextureCube(tGrund *Temp,float TexXS,float TexYS);
void SetTexPos(tP3D Normal,tP2D *Tex);
tGrund *CreateSmoothBox(float EckAmount,float Smooth);
tGrund *CreateMesh();
char CheckStand(tP3D Pos,tSector *Sector,float MinAb);
tBoundBox *CopyBoundBox(tBoundBox *Box);
long CountPolys(tWandPoly *Temp);
long CountVertices(tWandVertice *Temp);
void InitMaterials();
/*
void ReduceSector(tSector *Sector,float Epsilon);
void CorrectSector(tSector *Temp);
*/
void CorrectMesh(tGrund *Mesh);
void CorrectSector(tSector *Temp);
void DestroyWandVertice(tWandVertice *Temp);
void DestroyWandPoly(tWandPoly *Temp);
void UnChild(tWandVertice *Vert);
extern tMaterial *Material,*TempM,*Mat[MaxMaterials],*MatFeld;
extern char *TestString;
extern tP3D Err1,Err2,Err3,Err4,Err5,Err6;
extern tP3D HitNormal;
extern tSector *GlobalSector,*StandSector;
extern bool RutschAble;
extern long Materials;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -