diff --git a/gzdoom.vcproj b/gzdoom.vcproj new file mode 100644 index 000000000..46e600254 --- /dev/null +++ b/gzdoom.vcproj @@ -0,0 +1,7159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9436154bb..1b6dcb019 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,7 @@ include( CheckCXXSourceCompiles ) include( CheckFunctionExists ) include( CheckCXXCompilerFlag ) include( FindPkgConfig ) +include( FindOpenGL ) option( NO_ASM "Disable assembly code" ) if( CMAKE_COMPILER_IS_GNUCXX ) @@ -201,6 +202,22 @@ else( WIN32 ) endif( FPU_CONTROL_DIR ) endif( WIN32 ) +if( X64 ) + set( NO_ASM ON ) +endif( X64 ) + +# Check if we have OpenGL + +if( NOT OPENGL_FOUND ) + message( FATAL_ERROR "OpenGL is required for building." ) +endif( NOT OPENGL_FOUND ) +if( NOT OPENGL_GLU_FOUND ) + message( FATAL_ERROR "OpenGL GLU is required for building." ) +endif( NOT OPENGL_GLU_FOUND ) + +set( ZDOOM_LIBS ${ZDOOM_LIBS} ${OPENGL_LIBRARIES} ) +include_directories( ${OPENGL_INCLUDE_DIR} ) + # Decide on the name of the FMOD library we want to use. if( NOT FMOD_LIB_NAME AND MSVC ) @@ -528,6 +545,7 @@ if( WIN32 ) win32/i_movie.cpp win32/i_system.cpp win32/st_start.cpp + win32/win32gliface.cpp win32/win32video.cpp ) if( CMAKE_COMPILER_IS_GNUCXX ) # CMake is not set up to compile and link rc files with GCC. :( @@ -549,6 +567,7 @@ else( WIN32 ) sdl/i_main.cpp sdl/i_movie.cpp sdl/i_system.cpp + sdl/sdlglvideo.cpp sdl/sdlvideo.cpp sdl/st_start.cpp ) if( APPLE ) @@ -841,6 +860,57 @@ add_executable( zdoom WIN32 menu/playermenu.cpp menu/readthis.cpp menu/videomenu.cpp + gl/data/gl_sections.cpp + gl/data/gl_data.cpp + gl/data/gl_portaldata.cpp + gl/data/gl_setup.cpp + gl/data/gl_vertexbuffer.cpp + gl/dynlights/a_dynlight.cpp + gl/utility/gl_clock.cpp + gl/utility/gl_cycler.cpp + gl/utility/gl_geometric.cpp + gl/renderer/gl_renderer.cpp + gl/renderer/gl_renderstate.cpp + gl/renderer/gl_lightdata.cpp + gl/textures/gl_hwtexture.cpp + gl/textures/gl_texture.cpp + gl/textures/gl_material.cpp + gl/textures/gl_hirestex.cpp + gl/textures/gl_bitmap.cpp + gl/textures/gl_translate.cpp + gl/textures/gl_hqresize.cpp + gl/textures/gl_skyboxtexture.cpp + gl/scene/gl_bsp.cpp + gl/scene/gl_fakeflat.cpp + gl/scene/gl_clipper.cpp + gl/scene/gl_decal.cpp + gl/scene/gl_drawinfo.cpp + gl/scene/gl_flats.cpp + gl/scene/gl_walls.cpp + gl/scene/gl_sprite.cpp + gl/scene/gl_skydome.cpp + gl/scene/gl_renderhacks.cpp + gl/scene/gl_weapon.cpp + gl/scene/gl_scene.cpp + gl/scene/gl_sky.cpp + gl/scene/gl_portal.cpp + gl/scene/gl_walls_draw.cpp + gl/scene/gl_vertex.cpp + gl/scene/gl_spritelight.cpp + gl/dynlights/gl_dynlight.cpp + gl/dynlights/gl_glow.cpp + gl/dynlights/gl_dynlight1.cpp + gl/dynlights/gl_lightbuffer.cpp + gl/shaders/gl_shader.cpp + gl/shaders/gl_texshader.cpp + gl/system/gl_interface.cpp + gl/system/gl_framebuffer.cpp + gl/system/gl_menu.cpp + gl/system/gl_wipe.cpp + gl/models/gl_models_md3.cpp + gl/models/gl_models_md2.cpp + gl/models/gl_models.cpp + gl/models/gl_voxels.cpp oplsynth/fmopl.cpp oplsynth/mlopl.cpp oplsynth/mlopl_io.cpp diff --git a/src/actor.h b/src/actor.h index ab04b176d..6571b3f44 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1013,6 +1013,14 @@ public: } bool HasSpecialDeathStates () const; + + // begin of GZDoom specific additions + TArray > dynamiclights; + void * lightassociations; + bool hasmodel; + // end of GZDoom specific additions + + size_t PropagateMark(); }; class FActorIterator diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 56b34ca0f..7012248f0 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -44,6 +44,7 @@ #include "r_data/colormaps.h" #ifdef _3DFLOORS +EXTERN_CVAR(Int, vid_renderer) //========================================================================== // @@ -200,7 +201,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag // kg3D - software renderer only hack // this is really required because of ceilingclip and floorclip - if(flags & FF_BOTHPLANES) + if((vid_renderer == 0) && (flags & FF_BOTHPLANES)) { P_Add3DFloor(sec, sec2, master, FF_EXISTS | FF_THISINSIDE | FF_RENDERPLANES | FF_NOSHADE | FF_SEETHROUGH | FF_SHOOTTHROUGH | (flags & (FF_INVERTSECTOR | FF_TRANSLUCENT | FF_ADDITIVETRANS)), alpha); diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index a045c5098..069c9bac6 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -389,6 +389,9 @@ void P_SerializeWorld (FArchive &arc) << desaturate; sec->ColorMap = GetSpecialLights (color, fade, desaturate); } + // begin of GZDoom additions + arc << sec->reflect[sector_t::ceiling] << sec->reflect[sector_t::floor]; + // end of GZDoom additions } // do lines diff --git a/src/r_defs.h b/src/r_defs.h index c2f3e5b34..c7cdd8a3c 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -35,6 +35,9 @@ // to handle sound origins in sectors. // SECTORS do store MObjs anyway. #include "actor.h" +struct FLightNode; +struct FGLSection; +struct seg_t; #include "dthinker.h" @@ -81,15 +84,43 @@ struct vertex_t { fixed_t x, y; + float fx, fy; // Floating point coordinates of this vertex (excluding polyoblect translation!) + angle_t viewangle; // precalculated angle for clipping + int angletime; // recalculation time for view angle + bool dirty; // something has changed and needs to be recalculated + int numheights; + int numsectors; + sector_t ** sectors; + float * heightlist; + + vertex_t() + { + x = y = 0; + fx = fy = 0; + angletime = 0; + viewangle = 0; + dirty = true; + numheights = numsectors = 0; + sectors = NULL; + heightlist = NULL; + } + bool operator== (const vertex_t &other) { return x == other.x && y == other.y; } + bool operator!= (const vertex_t &other) + { + return x != other.x || y != other.y; + } + void clear() { x = y = 0; } + + angle_t GetClipAngle(); }; // Forward of LineDefs, for Sectors. @@ -319,6 +350,12 @@ FArchive &operator<< (FArchive &arc, secplane_t &plane); #include "p_3dfloors.h" +struct subsector_t; +struct sector_t; +struct side_t; +extern bool gl_plane_reflection_i; +struct FPortal; + // Ceiling/floor flags enum { @@ -723,6 +760,41 @@ struct sector_t int sectornum; // for comparing sector copies extsector_t * e; // This stores data that requires construction/destruction. Such data must not be copied by R_FakeFlat. + + // GL only stuff starts here + float reflect[2]; + + int dirtyframe[3]; // last frame this sector was marked dirty + bool dirty; // marked for recalculation + bool transdoor; // For transparent door hacks + fixed_t transdoorheight; // for transparent door hacks + int subsectorcount; // list of subsectors + subsector_t ** subsectors; + FPortal * portals[2]; // floor and ceiling portals + + enum + { + vbo_fakefloor = floor+2, + vbo_fakeceiling = ceiling+2, + }; + + int vboindex[4]; // VBO indices of the 4 planes this sector uses during rendering + fixed_t vboheight[2]; // Last calculated height for the 2 planes of this actual sector + int vbocount[2]; // Total count of vertices belonging to this sector's planes +#ifdef IBO_TEST + int iboindex[4]; // VBO indices of the 4 planes this sector uses during rendering + int ibocount; +#endif + + float GetReflect(int pos) { return gl_plane_reflection_i? reflect[pos] : 0; } + bool VBOHeightcheck(int pos) const { return vboheight[pos] == GetPlaneTexZ(pos); } + + enum + { + INVALIDATE_PLANES = 1, + INVALIDATE_OTHER = 2 + }; + }; FArchive &operator<< (FArchive &arc, sector_t::splane &p); @@ -877,6 +949,13 @@ struct side_t vertex_t *V1() const; vertex_t *V2() const; + + //For GL + FLightNode * lighthead[2]; // all blended lights that may affect this wall + + seg_t **segs; // all segs belonging to this sidedef in ascending order. Used for precise rendering + int numsegs; + }; FArchive &operator<< (FArchive &arc, side_t::part &p); @@ -957,6 +1036,11 @@ struct seg_t // Sector references. Could be retrieved from linedef, too. sector_t* frontsector; sector_t* backsector; // NULL for one-sided lines + + seg_t* PartnerSeg; + subsector_t* Subsector; + + float sidefrac; // relative position of seg's ending vertex on owning sidedef }; struct glsegextra_t @@ -965,6 +1049,9 @@ struct glsegextra_t subsector_t *Subsector; }; +extern seg_t *segs; + + // // A SubSector. // References a Sector. @@ -979,6 +1066,12 @@ enum SSECF_POLYORG = 4, }; +struct FPortalCoverage +{ + DWORD * subsectors; + int sscount; +}; + struct subsector_t { sector_t *sector; @@ -990,6 +1083,13 @@ struct subsector_t int flags; void BuildPolyBSP(); + // subsector related GL data + FLightNode * lighthead[2]; // Light nodes (blended and additive) + int validcount; + short mapsection; + char hacked; // 1: is part of a render hack + // 2: has one-sided walls + FPortalCoverage portalcoverage[2]; }; diff --git a/src/version.h b/src/version.h index fa8a1d937..8f3c8e8a0 100644 --- a/src/version.h +++ b/src/version.h @@ -41,12 +41,12 @@ const char *GetVersionString(); /** Lots of different version numbers **/ -#define VERSIONSTR "2.8pre" +#define VERSIONSTR "1.9pre" // The version as seen in the Windows resource -#define RC_FILEVERSION 2,7,9999,0 -#define RC_PRODUCTVERSION 2,7,9999,0 -#define RC_PRODUCTVERSION2 "2.8pre" +#define RC_FILEVERSION 1,8,9999,0 +#define RC_PRODUCTVERSION 1,8,9999,0 +#define RC_PRODUCTVERSION2 "1.9pre" // Version identifier for network games. // Bump it every time you do a release unless you're certain you @@ -82,21 +82,23 @@ const char *GetVersionString(); #define SAVEVERSTRINGIFY(x) #x #define SAVESIG "ZDOOMSAVE" SAVEVERSTRINGIFY(SAVEVER) +#define DYNLIGHT + // This is so that derivates can use the same savegame versions without worrying about engine compatibility -#define GAMESIG "ZDOOM" -#define BASEWAD "zdoom.pk3" +#define GAMESIG "GZDOOM" +#define BASEWAD "gzdoom.pk3" // More stuff that needs to be different for derivatives. -#define GAMENAME "ZDoom" -#define FORUM_URL "http://forum.zdoom.org" -#define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3" +#define GAMENAME "GZDoom" +#define FORUM_URL "http://forum.drdteam.org" +#define BUGS_FORUM_URL "http://forum.drdteam.org/viewforum.php?f=24" #ifdef unix -#define GAME_DIR ".config/zdoom" +#define GAME_DIR ".config/gzdoom" #elif defined(__APPLE__) #define GAME_DIR GAMENAME #else -#define CDROM_DIR "C:\\ZDOOMDAT" +#define CDROM_DIR "C:\\GZDOOMDAT" #endif