mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-03-13 21:52:04 +00:00
Merge ../qzdoom
This commit is contained in:
commit
df8d59cbc5
41 changed files with 1287 additions and 1268 deletions
|
@ -265,6 +265,11 @@ else( X64 )
|
|||
set( CMAKE_CXX_FLAGS ${SAFE_CMAKE_CXX_FLAGS} )
|
||||
endif( X64 )
|
||||
|
||||
# Set up flags for MSVC
|
||||
if (MSVC)
|
||||
set( CMAKE_CXX_FLAGS "/MP ${CMAKE_CXX_FLAGS}" )
|
||||
endif (MSVC)
|
||||
|
||||
# Set up flags for GCC
|
||||
|
||||
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||
|
@ -323,6 +328,11 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
|||
set( CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -ffp-contract=off ${CMAKE_C_FLAGS}" )
|
||||
set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -ffp-contract=off ${CMAKE_CXX_FLAGS}" )
|
||||
|
||||
# ARM processors (Raspberry Pi, et al) - enable ARM NEON support.
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
|
||||
set( CMAKE_CXX_FLAGS "-mfpu=neon ${CMAKE_CXX_FLAGS}" )
|
||||
endif ()
|
||||
|
||||
# Use the highest C++ standard available since VS2015 compiles with C++14
|
||||
# but we only require C++11. The recommended way to do this in CMake is to
|
||||
# probably to use target_compile_features, but I don't feel like maintaining
|
||||
|
|
|
@ -3084,6 +3084,7 @@ DObject *PClass::CreateNew()
|
|||
|
||||
if (ConstructNative == nullptr)
|
||||
{
|
||||
M_Free(mem);
|
||||
I_Error("Attempt to instantiate abstract class %s.", TypeName.GetChars());
|
||||
}
|
||||
ConstructNative (mem);
|
||||
|
|
|
@ -709,7 +709,7 @@ DThinker *FThinkerIterator::Next (bool exact)
|
|||
|
||||
class DThinkerIterator : public DObject, public FThinkerIterator
|
||||
{
|
||||
DECLARE_CLASS(DThinkerIterator, DObject)
|
||||
DECLARE_ABSTRACT_CLASS(DThinkerIterator, DObject)
|
||||
|
||||
DThinkerIterator()
|
||||
{
|
||||
|
@ -722,7 +722,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DThinkerIterator, false, false);
|
||||
IMPLEMENT_CLASS(DThinkerIterator, true, false);
|
||||
DEFINE_ACTION_FUNCTION(DThinkerIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
|
|
104
src/events.cpp
104
src/events.cpp
|
@ -471,6 +471,7 @@ DEFINE_EVENT_LOOPER(RenderFrame)
|
|||
DEFINE_EVENT_LOOPER(RenderOverlay)
|
||||
DEFINE_EVENT_LOOPER(WorldLightning)
|
||||
DEFINE_EVENT_LOOPER(WorldTick)
|
||||
DEFINE_EVENT_LOOPER(UiTick)
|
||||
|
||||
// declarations
|
||||
IMPLEMENT_CLASS(DStaticEventHandler, false, true);
|
||||
|
@ -551,38 +552,6 @@ DEFINE_ACTION_FUNCTION(DEventHandler, SendNetworkEvent)
|
|||
ACTION_RETURN_BOOL(E_SendNetworkEvent(name, arg1, arg2, arg3, false));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_CLASS(t, DStaticEventHandler);
|
||||
// check if type inherits dynamic handlers
|
||||
if (E_IsStaticType(t))
|
||||
{
|
||||
// disallow static types creation with Create()
|
||||
ACTION_RETURN_OBJECT(nullptr);
|
||||
}
|
||||
// generate a new object of this type.
|
||||
ACTION_RETURN_OBJECT(t->CreateNew());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, CreateOnce)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_CLASS(t, DStaticEventHandler);
|
||||
// check if type inherits dynamic handlers
|
||||
if (E_IsStaticType(t))
|
||||
{
|
||||
// disallow static types creation with Create()
|
||||
ACTION_RETURN_OBJECT(nullptr);
|
||||
}
|
||||
// check if there are already registered handlers of this type.
|
||||
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
||||
if (handler->GetClass() == t) // check precise class
|
||||
ACTION_RETURN_OBJECT(handler);
|
||||
// generate a new object of this type.
|
||||
ACTION_RETURN_OBJECT(t->CreateNew());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, Find)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
|
@ -593,45 +562,6 @@ DEFINE_ACTION_FUNCTION(DEventHandler, Find)
|
|||
ACTION_RETURN_OBJECT(nullptr);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, Register)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT(handler, DStaticEventHandler);
|
||||
if (handler->IsStatic()) ACTION_RETURN_BOOL(false);
|
||||
ACTION_RETURN_BOOL(E_RegisterHandler(handler));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, Unregister)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT(handler, DStaticEventHandler);
|
||||
if (handler->IsStatic()) ACTION_RETURN_BOOL(false);
|
||||
ACTION_RETURN_BOOL(E_UnregisterHandler(handler));
|
||||
}
|
||||
|
||||
// for static
|
||||
DEFINE_ACTION_FUNCTION(DStaticEventHandler, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_CLASS(t, DStaticEventHandler);
|
||||
// static handlers can create any type of object.
|
||||
// generate a new object of this type.
|
||||
ACTION_RETURN_OBJECT(t->CreateNew());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DStaticEventHandler, CreateOnce)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_CLASS(t, DStaticEventHandler);
|
||||
// static handlers can create any type of object.
|
||||
// check if there are already registered handlers of this type.
|
||||
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
||||
if (handler->GetClass() == t) // check precise class
|
||||
ACTION_RETURN_OBJECT(handler);
|
||||
// generate a new object of this type.
|
||||
ACTION_RETURN_OBJECT(t->CreateNew());
|
||||
}
|
||||
|
||||
// we might later want to change this
|
||||
DEFINE_ACTION_FUNCTION(DStaticEventHandler, Find)
|
||||
{
|
||||
|
@ -643,20 +573,6 @@ DEFINE_ACTION_FUNCTION(DStaticEventHandler, Find)
|
|||
ACTION_RETURN_OBJECT(nullptr);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DStaticEventHandler, Register)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT(handler, DStaticEventHandler);
|
||||
ACTION_RETURN_BOOL(E_RegisterHandler(handler));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DStaticEventHandler, Unregister)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT(handler, DStaticEventHandler);
|
||||
ACTION_RETURN_BOOL(E_UnregisterHandler(handler));
|
||||
}
|
||||
|
||||
#define DEFINE_EMPTY_HANDLER(cls, funcname) DEFINE_ACTION_FUNCTION(cls, funcname) \
|
||||
{ \
|
||||
PARAM_SELF_PROLOGUE(cls); \
|
||||
|
@ -686,6 +602,7 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerDisconnected)
|
|||
|
||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiProcess);
|
||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, InputProcess);
|
||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiTick);
|
||||
|
||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, ConsoleProcess);
|
||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, NetworkProcess);
|
||||
|
@ -851,9 +768,8 @@ void DStaticEventHandler::WorldTick()
|
|||
// don't create excessive DObjects if not going to be processed anyway
|
||||
if (func == DStaticEventHandler_WorldTick_VMPtr)
|
||||
return;
|
||||
FWorldEvent e = E_SetupWorldEvent();
|
||||
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
||||
GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr);
|
||||
VMValue params[1] = { (DStaticEventHandler*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1054,6 +970,18 @@ bool DStaticEventHandler::InputProcess(const event_t* ev)
|
|||
return false;
|
||||
}
|
||||
|
||||
void DStaticEventHandler::UiTick()
|
||||
{
|
||||
IFVIRTUAL(DStaticEventHandler, UiTick)
|
||||
{
|
||||
// don't create excessive DObjects if not going to be processed anyway
|
||||
if (func == DStaticEventHandler_UiTick_VMPtr)
|
||||
return;
|
||||
VMValue params[1] = { (DStaticEventHandler*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual)
|
||||
{
|
||||
if (player < 0)
|
||||
|
|
|
@ -41,8 +41,10 @@ void E_WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int d
|
|||
void E_WorldThingDestroyed(AActor* actor);
|
||||
// same as ACS SCRIPT_Lightning
|
||||
void E_WorldLightning();
|
||||
// this executes on every tick, before everything
|
||||
// this executes on every tick, before everything, only when in valid level and not paused
|
||||
void E_WorldTick();
|
||||
// this executes on every tick on UI side, always
|
||||
void E_UiTick();
|
||||
// called on each render frame once.
|
||||
void E_RenderFrame();
|
||||
// called after everything's been rendered, but before console/menus
|
||||
|
@ -150,6 +152,7 @@ public:
|
|||
// return true if handled.
|
||||
bool InputProcess(const event_t* ev);
|
||||
bool UiProcess(const event_t* ev);
|
||||
void UiTick();
|
||||
|
||||
//
|
||||
void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual);
|
||||
|
|
|
@ -1224,6 +1224,9 @@ void G_Ticker ()
|
|||
}
|
||||
}
|
||||
|
||||
// [ZZ] also tick the UI part of the events
|
||||
E_UiTick();
|
||||
|
||||
// do main actions
|
||||
switch (gamestate)
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ struct dmd_chunk_t
|
|||
#pragma pack(1)
|
||||
struct dmd_packedVertex_t
|
||||
{
|
||||
byte vertex[3];
|
||||
uint8_t vertex[3];
|
||||
unsigned short normal; // Yaw and pitch.
|
||||
};
|
||||
|
||||
|
@ -202,7 +202,7 @@ void FDMDModel::LoadGeometry()
|
|||
for(c = 0; c < 3; c++)
|
||||
{
|
||||
framev->vertices[k].xyz[axis[c]] =
|
||||
(pVtx->vertex[c] * FLOAT(pfr->scale[c]) + FLOAT(pfr->translate[c]));
|
||||
(pVtx->vertex[c] * float(pfr->scale[c]) + float(pfr->translate[c]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -415,8 +415,8 @@ struct md2_header_t
|
|||
|
||||
struct md2_triangleVertex_t
|
||||
{
|
||||
byte vertex[3];
|
||||
byte lightNormalIndex;
|
||||
uint8_t vertex[3];
|
||||
uint8_t lightNormalIndex;
|
||||
};
|
||||
|
||||
struct md2_packedFrame_t
|
||||
|
@ -437,7 +437,7 @@ bool FMD2Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
{
|
||||
md2_header_t * md2header = (md2_header_t *)buffer;
|
||||
ModelFrame *frame;
|
||||
byte *md2_frames;
|
||||
uint8_t *md2_frames;
|
||||
int i;
|
||||
|
||||
// Convert it to DMD.
|
||||
|
@ -481,7 +481,7 @@ bool FMD2Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
}
|
||||
|
||||
// The frames need to be unpacked.
|
||||
md2_frames = (byte*)buffer + info.offsetFrames;
|
||||
md2_frames = (uint8_t*)buffer + info.offsetFrames;
|
||||
frames = new ModelFrame[info.numFrames];
|
||||
|
||||
for (i = 0, frame = frames; i < info.numFrames; i++, frame++)
|
||||
|
@ -504,14 +504,14 @@ bool FMD2Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
void FMD2Model::LoadGeometry()
|
||||
{
|
||||
static int axis[3] = { VX, VY, VZ };
|
||||
byte *md2_frames;
|
||||
uint8_t *md2_frames;
|
||||
FMemLump lumpdata = Wads.ReadLump(mLumpNum);
|
||||
const char *buffer = (const char *)lumpdata.GetMem();
|
||||
|
||||
texCoords = new FTexCoord[info.numTexCoords];
|
||||
memcpy(texCoords, (byte*)buffer + info.offsetTexCoords, info.numTexCoords * sizeof(FTexCoord));
|
||||
memcpy(texCoords, (uint8_t*)buffer + info.offsetTexCoords, info.numTexCoords * sizeof(FTexCoord));
|
||||
|
||||
md2_frames = (byte*)buffer + info.offsetFrames;
|
||||
md2_frames = (uint8_t*)buffer + info.offsetFrames;
|
||||
framevtx = new ModelFrameVertexData[info.numFrames];
|
||||
ModelFrameVertexData *framev;
|
||||
int i, k, c;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4305)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -601,7 +601,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
|
|||
extsector_t::xfloor &x = sector->e->XFloor;
|
||||
dynlightindex = -1;
|
||||
|
||||
byte &srf = gl_drawinfo->sectorrenderflags[sector->sectornum];
|
||||
uint8_t &srf = gl_drawinfo->sectorrenderflags[sector->sectornum];
|
||||
|
||||
//
|
||||
//
|
||||
|
|
|
@ -992,7 +992,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, i
|
|||
CopyToBackbuffer(&bounds, false);
|
||||
glFlush();
|
||||
|
||||
byte * scr = (byte *)M_Malloc(width * height * 3);
|
||||
uint8_t * scr = (uint8_t *)M_Malloc(width * height * 3);
|
||||
glReadPixels(0,0,width, height,GL_RGB,GL_UNSIGNED_BYTE,scr);
|
||||
M_CreatePNG (file, scr + ((height-1) * width * 3), NULL, SS_RGB, width, height, -width*3);
|
||||
M_Free(scr);
|
||||
|
|
|
@ -894,7 +894,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
rendersector->GetCeilingLight() : rendersector->GetFloorLight());
|
||||
foglevel = (BYTE)clamp<short>(rendersector->lightlevel, 0, 255);
|
||||
|
||||
lightlevel = (byte)gl_CheckSpriteGlow(rendersector, lightlevel, thingpos);
|
||||
lightlevel = gl_CheckSpriteGlow(rendersector, lightlevel, thingpos);
|
||||
|
||||
ThingColor = (thing->RenderStyle.Flags & STYLEF_ColorIsFixed) ? thing->fillcolor : 0xffffff;
|
||||
ThingColor.a = 255;
|
||||
|
|
|
@ -271,15 +271,7 @@ void FGLDebug::DebugCallback(GLenum source, GLenum type, GLuint id, GLenum sever
|
|||
return;
|
||||
|
||||
PrintMessage(source, type, id, severity, length, message);
|
||||
|
||||
if (severity != GL_DEBUG_SEVERITY_NOTIFICATION)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
DebugBreak();
|
||||
#else
|
||||
raise(SIGTRAP);
|
||||
#endif
|
||||
}
|
||||
assert(severity == GL_DEBUG_SEVERITY_NOTIFICATION);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -42,6 +42,8 @@ static void* PosixGetProcAddress (const GLubyte* name)
|
|||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// disable inlining here because it creates an incredible amount of bloat in this file.
|
||||
#pragma inline_depth(0)
|
||||
|
|
|
@ -26,23 +26,11 @@
|
|||
#define __gltypes_h_
|
||||
#define __gl_ATI_h_
|
||||
|
||||
/* BEGINNING OF MANUAL CHANGES, DO NOT REMOVE! */
|
||||
#ifndef APIENTRY
|
||||
#if defined(__MINGW32__)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#if defined(_WIN32)
|
||||
//#include <windows.h>
|
||||
#define APIENTRY __stdcall
|
||||
#else
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
@ -51,7 +39,7 @@
|
|||
#ifndef CODEGEN_FUNCPTR
|
||||
#define CODEGEN_REMOVE_FUNCPTR
|
||||
#if defined(_WIN32)
|
||||
#define CODEGEN_FUNCPTR APIENTRY
|
||||
#define CODEGEN_FUNCPTR __stdcall
|
||||
#else
|
||||
#define CODEGEN_FUNCPTR
|
||||
#endif
|
||||
|
@ -60,6 +48,7 @@
|
|||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
/* END OF MANUAL CHANGES, DO NOT REMOVE! */
|
||||
|
||||
|
||||
#ifndef GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
|
@ -70,43 +59,8 @@
|
|||
|
||||
|
||||
#include <stddef.h>
|
||||
#ifndef GLEXT_64_TYPES_DEFINED
|
||||
/* This code block is duplicated in glxext.h, so must be protected */
|
||||
#define GLEXT_64_TYPES_DEFINED
|
||||
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
|
||||
/* (as used in the GL_EXT_timer_query extension). */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int int64_t;
|
||||
typedef unsigned long int uint64_t;
|
||||
#else
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#endif /* __STDC__ */
|
||||
#elif defined( __VMS ) || defined(__sgi)
|
||||
#include <inttypes.h>
|
||||
#elif defined(__SCO__) || defined(__USLC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(__UNIXOS2__) || defined(__SOL64__)
|
||||
typedef long int int32_t;
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#elif defined(_WIN32) && defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(_WIN32)
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
/* Fallback if nothing above works */
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
|
|
|
@ -1,40 +1,6 @@
|
|||
#ifndef __GL_PCH_H
|
||||
#define __GL_PCH_H
|
||||
#ifdef _WIN32
|
||||
//#define __RPCNDR_H__ // this header causes problems!
|
||||
//#define __wtypes_h__
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define _WIN32_WINDOWS 0x410
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501 // Support the mouse wheel and session notification.
|
||||
#define _WIN32_IE 0x0500
|
||||
#endif
|
||||
#define DIRECTINPUT_VERSION 0x800
|
||||
#define DIRECTDRAW_VERSION 0x0300
|
||||
|
||||
#define DWORD WINDOWS_DWORD // I don't want to depend on this throughout the GL code!
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4995) // MIPS
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <winsock.h>
|
||||
#ifndef __WINE__
|
||||
#include <dshow.h>
|
||||
#endif
|
||||
#include <d3d9.h>
|
||||
//#include <dsound.h>
|
||||
//#include <dinput.h>
|
||||
//#include <lmcons.h>
|
||||
//#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#undef DWORD
|
||||
#ifndef CALLBACK
|
||||
#define CALLBACK
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
|
@ -73,33 +39,6 @@
|
|||
#include <OpenGL/OpenGL.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DWORD WINDOWS_DWORD // I don't want to depend on this throughout the GL code!
|
||||
//#include "gl/api/wglext.h"
|
||||
#ifndef __WINE__
|
||||
#undef DWORD
|
||||
#endif
|
||||
#else
|
||||
typedef unsigned char byte;
|
||||
typedef float FLOAT;
|
||||
template <typename T>
|
||||
inline T max( T a, T b) { return (((a)>(b)) ? (a) : (b)); }
|
||||
#define _access(a,b) access(a,b)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LoadMenu
|
||||
#undef LoadMenu
|
||||
#endif
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
#ifdef GetCharWidth
|
||||
#undef GetCharWidth
|
||||
#endif
|
||||
|
||||
#undef S_NORMAL
|
||||
#undef OPAQUE
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -111,7 +50,4 @@ inline T max( T a, T b) { return (((a)>(b)) ? (a) : (b)); }
|
|||
#pragma warning(disable : 4305) // truncate from double to float
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#undef WIN32
|
||||
#endif
|
||||
#endif //__GL_PCH_H
|
||||
|
|
|
@ -47,18 +47,6 @@
|
|||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/renderer/gl_2ddrawer.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
struct POINT {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
};
|
||||
struct RECT {
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
int32_t right;
|
||||
int32_t bottom;
|
||||
};
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -414,10 +402,19 @@ int OpenGLFrameBuffer::Wiper_Melt::MakeVBO(int ticks, OpenGLFrameBuffer *fb, boo
|
|||
}
|
||||
if (ticks == 0)
|
||||
{
|
||||
struct {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
} dpt;
|
||||
struct {
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
int32_t right;
|
||||
int32_t bottom;
|
||||
} rect;
|
||||
|
||||
// Only draw for the final tick.
|
||||
// No need for optimization. Wipes won't ever be drawn with anything else.
|
||||
RECT rect;
|
||||
POINT dpt;
|
||||
|
||||
dpt.x = i * fb->Width / WIDTH;
|
||||
dpt.y = MAX(0, y[i] * fb->Height / HEIGHT);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <intrin.h>
|
||||
|
@ -76,7 +76,7 @@ double gl_MillisecPerCycle = 1e-5; // 100 MHz
|
|||
|
||||
void gl_CalculateCPUSpeed ()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER freq;
|
||||
|
||||
QueryPerformanceFrequency (&freq);
|
||||
|
|
460
src/p_acs.cpp
460
src/p_acs.cpp
|
@ -86,6 +86,466 @@
|
|||
#include "g_levellocals.h"
|
||||
#include "stats.h"
|
||||
|
||||
// P-codes for ACS scripts
|
||||
enum
|
||||
{
|
||||
/* 0*/ PCD_NOP,
|
||||
PCD_TERMINATE,
|
||||
PCD_SUSPEND,
|
||||
PCD_PUSHNUMBER,
|
||||
PCD_LSPEC1,
|
||||
PCD_LSPEC2,
|
||||
PCD_LSPEC3,
|
||||
PCD_LSPEC4,
|
||||
PCD_LSPEC5,
|
||||
PCD_LSPEC1DIRECT,
|
||||
/* 10*/ PCD_LSPEC2DIRECT,
|
||||
PCD_LSPEC3DIRECT,
|
||||
PCD_LSPEC4DIRECT,
|
||||
PCD_LSPEC5DIRECT,
|
||||
PCD_ADD,
|
||||
PCD_SUBTRACT,
|
||||
PCD_MULTIPLY,
|
||||
PCD_DIVIDE,
|
||||
PCD_MODULUS,
|
||||
PCD_EQ,
|
||||
/* 20*/ PCD_NE,
|
||||
PCD_LT,
|
||||
PCD_GT,
|
||||
PCD_LE,
|
||||
PCD_GE,
|
||||
PCD_ASSIGNSCRIPTVAR,
|
||||
PCD_ASSIGNMAPVAR,
|
||||
PCD_ASSIGNWORLDVAR,
|
||||
PCD_PUSHSCRIPTVAR,
|
||||
PCD_PUSHMAPVAR,
|
||||
/* 30*/ PCD_PUSHWORLDVAR,
|
||||
PCD_ADDSCRIPTVAR,
|
||||
PCD_ADDMAPVAR,
|
||||
PCD_ADDWORLDVAR,
|
||||
PCD_SUBSCRIPTVAR,
|
||||
PCD_SUBMAPVAR,
|
||||
PCD_SUBWORLDVAR,
|
||||
PCD_MULSCRIPTVAR,
|
||||
PCD_MULMAPVAR,
|
||||
PCD_MULWORLDVAR,
|
||||
/* 40*/ PCD_DIVSCRIPTVAR,
|
||||
PCD_DIVMAPVAR,
|
||||
PCD_DIVWORLDVAR,
|
||||
PCD_MODSCRIPTVAR,
|
||||
PCD_MODMAPVAR,
|
||||
PCD_MODWORLDVAR,
|
||||
PCD_INCSCRIPTVAR,
|
||||
PCD_INCMAPVAR,
|
||||
PCD_INCWORLDVAR,
|
||||
PCD_DECSCRIPTVAR,
|
||||
/* 50*/ PCD_DECMAPVAR,
|
||||
PCD_DECWORLDVAR,
|
||||
PCD_GOTO,
|
||||
PCD_IFGOTO,
|
||||
PCD_DROP,
|
||||
PCD_DELAY,
|
||||
PCD_DELAYDIRECT,
|
||||
PCD_RANDOM,
|
||||
PCD_RANDOMDIRECT,
|
||||
PCD_THINGCOUNT,
|
||||
/* 60*/ PCD_THINGCOUNTDIRECT,
|
||||
PCD_TAGWAIT,
|
||||
PCD_TAGWAITDIRECT,
|
||||
PCD_POLYWAIT,
|
||||
PCD_POLYWAITDIRECT,
|
||||
PCD_CHANGEFLOOR,
|
||||
PCD_CHANGEFLOORDIRECT,
|
||||
PCD_CHANGECEILING,
|
||||
PCD_CHANGECEILINGDIRECT,
|
||||
PCD_RESTART,
|
||||
/* 70*/ PCD_ANDLOGICAL,
|
||||
PCD_ORLOGICAL,
|
||||
PCD_ANDBITWISE,
|
||||
PCD_ORBITWISE,
|
||||
PCD_EORBITWISE,
|
||||
PCD_NEGATELOGICAL,
|
||||
PCD_LSHIFT,
|
||||
PCD_RSHIFT,
|
||||
PCD_UNARYMINUS,
|
||||
PCD_IFNOTGOTO,
|
||||
/* 80*/ PCD_LINESIDE,
|
||||
PCD_SCRIPTWAIT,
|
||||
PCD_SCRIPTWAITDIRECT,
|
||||
PCD_CLEARLINESPECIAL,
|
||||
PCD_CASEGOTO,
|
||||
PCD_BEGINPRINT,
|
||||
PCD_ENDPRINT,
|
||||
PCD_PRINTSTRING,
|
||||
PCD_PRINTNUMBER,
|
||||
PCD_PRINTCHARACTER,
|
||||
/* 90*/ PCD_PLAYERCOUNT,
|
||||
PCD_GAMETYPE,
|
||||
PCD_GAMESKILL,
|
||||
PCD_TIMER,
|
||||
PCD_SECTORSOUND,
|
||||
PCD_AMBIENTSOUND,
|
||||
PCD_SOUNDSEQUENCE,
|
||||
PCD_SETLINETEXTURE,
|
||||
PCD_SETLINEBLOCKING,
|
||||
PCD_SETLINESPECIAL,
|
||||
/*100*/ PCD_THINGSOUND,
|
||||
PCD_ENDPRINTBOLD, // [RH] End of Hexen p-codes
|
||||
PCD_ACTIVATORSOUND,
|
||||
PCD_LOCALAMBIENTSOUND,
|
||||
PCD_SETLINEMONSTERBLOCKING,
|
||||
PCD_PLAYERBLUESKULL, // [BC] Start of new [Skull Tag] pcodes
|
||||
PCD_PLAYERREDSKULL,
|
||||
PCD_PLAYERYELLOWSKULL,
|
||||
PCD_PLAYERMASTERSKULL,
|
||||
PCD_PLAYERBLUECARD,
|
||||
/*110*/ PCD_PLAYERREDCARD,
|
||||
PCD_PLAYERYELLOWCARD,
|
||||
PCD_PLAYERMASTERCARD,
|
||||
PCD_PLAYERBLACKSKULL,
|
||||
PCD_PLAYERSILVERSKULL,
|
||||
PCD_PLAYERGOLDSKULL,
|
||||
PCD_PLAYERBLACKCARD,
|
||||
PCD_PLAYERSILVERCARD,
|
||||
PCD_ISNETWORKGAME,
|
||||
PCD_PLAYERTEAM,
|
||||
/*120*/ PCD_PLAYERHEALTH,
|
||||
PCD_PLAYERARMORPOINTS,
|
||||
PCD_PLAYERFRAGS,
|
||||
PCD_PLAYEREXPERT,
|
||||
PCD_BLUETEAMCOUNT,
|
||||
PCD_REDTEAMCOUNT,
|
||||
PCD_BLUETEAMSCORE,
|
||||
PCD_REDTEAMSCORE,
|
||||
PCD_ISONEFLAGCTF,
|
||||
PCD_LSPEC6, // These are never used. They should probably
|
||||
/*130*/ PCD_LSPEC6DIRECT, // be given names like PCD_DUMMY.
|
||||
PCD_PRINTNAME,
|
||||
PCD_MUSICCHANGE,
|
||||
PCD_CONSOLECOMMANDDIRECT,
|
||||
PCD_CONSOLECOMMAND,
|
||||
PCD_SINGLEPLAYER, // [RH] End of Skull Tag p-codes
|
||||
PCD_FIXEDMUL,
|
||||
PCD_FIXEDDIV,
|
||||
PCD_SETGRAVITY,
|
||||
PCD_SETGRAVITYDIRECT,
|
||||
/*140*/ PCD_SETAIRCONTROL,
|
||||
PCD_SETAIRCONTROLDIRECT,
|
||||
PCD_CLEARINVENTORY,
|
||||
PCD_GIVEINVENTORY,
|
||||
PCD_GIVEINVENTORYDIRECT,
|
||||
PCD_TAKEINVENTORY,
|
||||
PCD_TAKEINVENTORYDIRECT,
|
||||
PCD_CHECKINVENTORY,
|
||||
PCD_CHECKINVENTORYDIRECT,
|
||||
PCD_SPAWN,
|
||||
/*150*/ PCD_SPAWNDIRECT,
|
||||
PCD_SPAWNSPOT,
|
||||
PCD_SPAWNSPOTDIRECT,
|
||||
PCD_SETMUSIC,
|
||||
PCD_SETMUSICDIRECT,
|
||||
PCD_LOCALSETMUSIC,
|
||||
PCD_LOCALSETMUSICDIRECT,
|
||||
PCD_PRINTFIXED,
|
||||
PCD_PRINTLOCALIZED,
|
||||
PCD_MOREHUDMESSAGE,
|
||||
/*160*/ PCD_OPTHUDMESSAGE,
|
||||
PCD_ENDHUDMESSAGE,
|
||||
PCD_ENDHUDMESSAGEBOLD,
|
||||
PCD_SETSTYLE,
|
||||
PCD_SETSTYLEDIRECT,
|
||||
PCD_SETFONT,
|
||||
PCD_SETFONTDIRECT,
|
||||
PCD_PUSHBYTE,
|
||||
PCD_LSPEC1DIRECTB,
|
||||
PCD_LSPEC2DIRECTB,
|
||||
/*170*/ PCD_LSPEC3DIRECTB,
|
||||
PCD_LSPEC4DIRECTB,
|
||||
PCD_LSPEC5DIRECTB,
|
||||
PCD_DELAYDIRECTB,
|
||||
PCD_RANDOMDIRECTB,
|
||||
PCD_PUSHBYTES,
|
||||
PCD_PUSH2BYTES,
|
||||
PCD_PUSH3BYTES,
|
||||
PCD_PUSH4BYTES,
|
||||
PCD_PUSH5BYTES,
|
||||
/*180*/ PCD_SETTHINGSPECIAL,
|
||||
PCD_ASSIGNGLOBALVAR,
|
||||
PCD_PUSHGLOBALVAR,
|
||||
PCD_ADDGLOBALVAR,
|
||||
PCD_SUBGLOBALVAR,
|
||||
PCD_MULGLOBALVAR,
|
||||
PCD_DIVGLOBALVAR,
|
||||
PCD_MODGLOBALVAR,
|
||||
PCD_INCGLOBALVAR,
|
||||
PCD_DECGLOBALVAR,
|
||||
/*190*/ PCD_FADETO,
|
||||
PCD_FADERANGE,
|
||||
PCD_CANCELFADE,
|
||||
PCD_PLAYMOVIE,
|
||||
PCD_SETFLOORTRIGGER,
|
||||
PCD_SETCEILINGTRIGGER,
|
||||
PCD_GETACTORX,
|
||||
PCD_GETACTORY,
|
||||
PCD_GETACTORZ,
|
||||
PCD_STARTTRANSLATION,
|
||||
/*200*/ PCD_TRANSLATIONRANGE1,
|
||||
PCD_TRANSLATIONRANGE2,
|
||||
PCD_ENDTRANSLATION,
|
||||
PCD_CALL,
|
||||
PCD_CALLDISCARD,
|
||||
PCD_RETURNVOID,
|
||||
PCD_RETURNVAL,
|
||||
PCD_PUSHMAPARRAY,
|
||||
PCD_ASSIGNMAPARRAY,
|
||||
PCD_ADDMAPARRAY,
|
||||
/*210*/ PCD_SUBMAPARRAY,
|
||||
PCD_MULMAPARRAY,
|
||||
PCD_DIVMAPARRAY,
|
||||
PCD_MODMAPARRAY,
|
||||
PCD_INCMAPARRAY,
|
||||
PCD_DECMAPARRAY,
|
||||
PCD_DUP,
|
||||
PCD_SWAP,
|
||||
PCD_WRITETOINI,
|
||||
PCD_GETFROMINI,
|
||||
/*220*/ PCD_SIN,
|
||||
PCD_COS,
|
||||
PCD_VECTORANGLE,
|
||||
PCD_CHECKWEAPON,
|
||||
PCD_SETWEAPON,
|
||||
PCD_TAGSTRING,
|
||||
PCD_PUSHWORLDARRAY,
|
||||
PCD_ASSIGNWORLDARRAY,
|
||||
PCD_ADDWORLDARRAY,
|
||||
PCD_SUBWORLDARRAY,
|
||||
/*230*/ PCD_MULWORLDARRAY,
|
||||
PCD_DIVWORLDARRAY,
|
||||
PCD_MODWORLDARRAY,
|
||||
PCD_INCWORLDARRAY,
|
||||
PCD_DECWORLDARRAY,
|
||||
PCD_PUSHGLOBALARRAY,
|
||||
PCD_ASSIGNGLOBALARRAY,
|
||||
PCD_ADDGLOBALARRAY,
|
||||
PCD_SUBGLOBALARRAY,
|
||||
PCD_MULGLOBALARRAY,
|
||||
/*240*/ PCD_DIVGLOBALARRAY,
|
||||
PCD_MODGLOBALARRAY,
|
||||
PCD_INCGLOBALARRAY,
|
||||
PCD_DECGLOBALARRAY,
|
||||
PCD_SETMARINEWEAPON,
|
||||
PCD_SETACTORPROPERTY,
|
||||
PCD_GETACTORPROPERTY,
|
||||
PCD_PLAYERNUMBER,
|
||||
PCD_ACTIVATORTID,
|
||||
PCD_SETMARINESPRITE,
|
||||
/*250*/ PCD_GETSCREENWIDTH,
|
||||
PCD_GETSCREENHEIGHT,
|
||||
PCD_THING_PROJECTILE2,
|
||||
PCD_STRLEN,
|
||||
PCD_SETHUDSIZE,
|
||||
PCD_GETCVAR,
|
||||
PCD_CASEGOTOSORTED,
|
||||
PCD_SETRESULTVALUE,
|
||||
PCD_GETLINEROWOFFSET,
|
||||
PCD_GETACTORFLOORZ,
|
||||
/*260*/ PCD_GETACTORANGLE,
|
||||
PCD_GETSECTORFLOORZ,
|
||||
PCD_GETSECTORCEILINGZ,
|
||||
PCD_LSPEC5RESULT,
|
||||
PCD_GETSIGILPIECES,
|
||||
PCD_GETLEVELINFO,
|
||||
PCD_CHANGESKY,
|
||||
PCD_PLAYERINGAME,
|
||||
PCD_PLAYERISBOT,
|
||||
PCD_SETCAMERATOTEXTURE,
|
||||
/*270*/ PCD_ENDLOG,
|
||||
PCD_GETAMMOCAPACITY,
|
||||
PCD_SETAMMOCAPACITY,
|
||||
PCD_PRINTMAPCHARARRAY, // [JB] start of new p-codes
|
||||
PCD_PRINTWORLDCHARARRAY,
|
||||
PCD_PRINTGLOBALCHARARRAY, // [JB] end of new p-codes
|
||||
PCD_SETACTORANGLE, // [GRB]
|
||||
PCD_GRABINPUT, // Unused but acc defines them
|
||||
PCD_SETMOUSEPOINTER, // "
|
||||
PCD_MOVEMOUSEPOINTER, // "
|
||||
/*280*/ PCD_SPAWNPROJECTILE,
|
||||
PCD_GETSECTORLIGHTLEVEL,
|
||||
PCD_GETACTORCEILINGZ,
|
||||
PCD_SETACTORPOSITION,
|
||||
PCD_CLEARACTORINVENTORY,
|
||||
PCD_GIVEACTORINVENTORY,
|
||||
PCD_TAKEACTORINVENTORY,
|
||||
PCD_CHECKACTORINVENTORY,
|
||||
PCD_THINGCOUNTNAME,
|
||||
PCD_SPAWNSPOTFACING,
|
||||
/*290*/ PCD_PLAYERCLASS, // [GRB]
|
||||
//[MW] start my p-codes
|
||||
PCD_ANDSCRIPTVAR,
|
||||
PCD_ANDMAPVAR,
|
||||
PCD_ANDWORLDVAR,
|
||||
PCD_ANDGLOBALVAR,
|
||||
PCD_ANDMAPARRAY,
|
||||
PCD_ANDWORLDARRAY,
|
||||
PCD_ANDGLOBALARRAY,
|
||||
PCD_EORSCRIPTVAR,
|
||||
PCD_EORMAPVAR,
|
||||
/*300*/ PCD_EORWORLDVAR,
|
||||
PCD_EORGLOBALVAR,
|
||||
PCD_EORMAPARRAY,
|
||||
PCD_EORWORLDARRAY,
|
||||
PCD_EORGLOBALARRAY,
|
||||
PCD_ORSCRIPTVAR,
|
||||
PCD_ORMAPVAR,
|
||||
PCD_ORWORLDVAR,
|
||||
PCD_ORGLOBALVAR,
|
||||
PCD_ORMAPARRAY,
|
||||
/*310*/ PCD_ORWORLDARRAY,
|
||||
PCD_ORGLOBALARRAY,
|
||||
PCD_LSSCRIPTVAR,
|
||||
PCD_LSMAPVAR,
|
||||
PCD_LSWORLDVAR,
|
||||
PCD_LSGLOBALVAR,
|
||||
PCD_LSMAPARRAY,
|
||||
PCD_LSWORLDARRAY,
|
||||
PCD_LSGLOBALARRAY,
|
||||
PCD_RSSCRIPTVAR,
|
||||
/*320*/ PCD_RSMAPVAR,
|
||||
PCD_RSWORLDVAR,
|
||||
PCD_RSGLOBALVAR,
|
||||
PCD_RSMAPARRAY,
|
||||
PCD_RSWORLDARRAY,
|
||||
PCD_RSGLOBALARRAY,
|
||||
//[MW] end my p-codes
|
||||
PCD_GETPLAYERINFO, // [GRB]
|
||||
PCD_CHANGELEVEL,
|
||||
PCD_SECTORDAMAGE,
|
||||
PCD_REPLACETEXTURES,
|
||||
/*330*/ PCD_NEGATEBINARY,
|
||||
PCD_GETACTORPITCH,
|
||||
PCD_SETACTORPITCH,
|
||||
PCD_PRINTBIND,
|
||||
PCD_SETACTORSTATE,
|
||||
PCD_THINGDAMAGE2,
|
||||
PCD_USEINVENTORY,
|
||||
PCD_USEACTORINVENTORY,
|
||||
PCD_CHECKACTORCEILINGTEXTURE,
|
||||
PCD_CHECKACTORFLOORTEXTURE,
|
||||
/*340*/ PCD_GETACTORLIGHTLEVEL,
|
||||
PCD_SETMUGSHOTSTATE,
|
||||
PCD_THINGCOUNTSECTOR,
|
||||
PCD_THINGCOUNTNAMESECTOR,
|
||||
PCD_CHECKPLAYERCAMERA, // [TN]
|
||||
PCD_MORPHACTOR, // [MH]
|
||||
PCD_UNMORPHACTOR, // [MH]
|
||||
PCD_GETPLAYERINPUT,
|
||||
PCD_CLASSIFYACTOR,
|
||||
PCD_PRINTBINARY,
|
||||
/*350*/ PCD_PRINTHEX,
|
||||
PCD_CALLFUNC,
|
||||
PCD_SAVESTRING, // [FDARI] create string (temporary)
|
||||
PCD_PRINTMAPCHRANGE, // [FDARI] output range (print part of array)
|
||||
PCD_PRINTWORLDCHRANGE,
|
||||
PCD_PRINTGLOBALCHRANGE,
|
||||
PCD_STRCPYTOMAPCHRANGE, // [FDARI] input range (copy string to all/part of array)
|
||||
PCD_STRCPYTOWORLDCHRANGE,
|
||||
PCD_STRCPYTOGLOBALCHRANGE,
|
||||
PCD_PUSHFUNCTION, // from Eternity
|
||||
/*360*/ PCD_CALLSTACK, // from Eternity
|
||||
PCD_SCRIPTWAITNAMED,
|
||||
PCD_TRANSLATIONRANGE3,
|
||||
PCD_GOTOSTACK,
|
||||
PCD_ASSIGNSCRIPTARRAY,
|
||||
PCD_PUSHSCRIPTARRAY,
|
||||
PCD_ADDSCRIPTARRAY,
|
||||
PCD_SUBSCRIPTARRAY,
|
||||
PCD_MULSCRIPTARRAY,
|
||||
PCD_DIVSCRIPTARRAY,
|
||||
/*370*/ PCD_MODSCRIPTARRAY,
|
||||
PCD_INCSCRIPTARRAY,
|
||||
PCD_DECSCRIPTARRAY,
|
||||
PCD_ANDSCRIPTARRAY,
|
||||
PCD_EORSCRIPTARRAY,
|
||||
PCD_ORSCRIPTARRAY,
|
||||
PCD_LSSCRIPTARRAY,
|
||||
PCD_RSSCRIPTARRAY,
|
||||
PCD_PRINTSCRIPTCHARARRAY,
|
||||
PCD_PRINTSCRIPTCHRANGE,
|
||||
/*380*/ PCD_STRCPYTOSCRIPTCHRANGE,
|
||||
PCD_LSPEC5EX,
|
||||
PCD_LSPEC5EXRESULT,
|
||||
PCD_TRANSLATIONRANGE4,
|
||||
PCD_TRANSLATIONRANGE5,
|
||||
|
||||
/*381*/ PCODE_COMMAND_COUNT
|
||||
};
|
||||
|
||||
// Some constants used by ACS scripts
|
||||
enum {
|
||||
LINE_FRONT = 0,
|
||||
LINE_BACK = 1
|
||||
};
|
||||
enum {
|
||||
SIDE_FRONT = 0,
|
||||
SIDE_BACK = 1
|
||||
};
|
||||
enum {
|
||||
TEXTURE_TOP = 0,
|
||||
TEXTURE_MIDDLE = 1,
|
||||
TEXTURE_BOTTOM = 2
|
||||
};
|
||||
enum {
|
||||
GAME_SINGLE_PLAYER = 0,
|
||||
GAME_NET_COOPERATIVE = 1,
|
||||
GAME_NET_DEATHMATCH = 2,
|
||||
GAME_TITLE_MAP = 3
|
||||
};
|
||||
enum {
|
||||
CLASS_FIGHTER = 0,
|
||||
CLASS_CLERIC = 1,
|
||||
CLASS_MAGE = 2
|
||||
};
|
||||
enum {
|
||||
SKILL_VERY_EASY = 0,
|
||||
SKILL_EASY = 1,
|
||||
SKILL_NORMAL = 2,
|
||||
SKILL_HARD = 3,
|
||||
SKILL_VERY_HARD = 4
|
||||
};
|
||||
enum {
|
||||
BLOCK_NOTHING = 0,
|
||||
BLOCK_CREATURES = 1,
|
||||
BLOCK_EVERYTHING = 2,
|
||||
BLOCK_RAILING = 3,
|
||||
BLOCK_PLAYERS = 4
|
||||
};
|
||||
enum {
|
||||
LEVELINFO_PAR_TIME,
|
||||
LEVELINFO_CLUSTERNUM,
|
||||
LEVELINFO_LEVELNUM,
|
||||
LEVELINFO_TOTAL_SECRETS,
|
||||
LEVELINFO_FOUND_SECRETS,
|
||||
LEVELINFO_TOTAL_ITEMS,
|
||||
LEVELINFO_FOUND_ITEMS,
|
||||
LEVELINFO_TOTAL_MONSTERS,
|
||||
LEVELINFO_KILLED_MONSTERS,
|
||||
LEVELINFO_SUCK_TIME
|
||||
};
|
||||
enum {
|
||||
PLAYERINFO_TEAM,
|
||||
PLAYERINFO_AIMDIST,
|
||||
PLAYERINFO_COLOR,
|
||||
PLAYERINFO_GENDER,
|
||||
PLAYERINFO_NEVERSWITCH,
|
||||
PLAYERINFO_MOVEBOB,
|
||||
PLAYERINFO_STILLBOB,
|
||||
PLAYERINFO_PLAYERCLASS,
|
||||
PLAYERINFO_FOV,
|
||||
PLAYERINFO_DESIREDFOV,
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern FILE *Logfile;
|
||||
|
||||
FRandom pr_acs ("ACS");
|
||||
|
|
457
src/p_acs.h
457
src/p_acs.h
|
@ -391,463 +391,6 @@ class DLevelScript : public DObject
|
|||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
|
||||
// P-codes for ACS scripts
|
||||
enum
|
||||
{
|
||||
/* 0*/ PCD_NOP,
|
||||
PCD_TERMINATE,
|
||||
PCD_SUSPEND,
|
||||
PCD_PUSHNUMBER,
|
||||
PCD_LSPEC1,
|
||||
PCD_LSPEC2,
|
||||
PCD_LSPEC3,
|
||||
PCD_LSPEC4,
|
||||
PCD_LSPEC5,
|
||||
PCD_LSPEC1DIRECT,
|
||||
/* 10*/ PCD_LSPEC2DIRECT,
|
||||
PCD_LSPEC3DIRECT,
|
||||
PCD_LSPEC4DIRECT,
|
||||
PCD_LSPEC5DIRECT,
|
||||
PCD_ADD,
|
||||
PCD_SUBTRACT,
|
||||
PCD_MULTIPLY,
|
||||
PCD_DIVIDE,
|
||||
PCD_MODULUS,
|
||||
PCD_EQ,
|
||||
/* 20*/ PCD_NE,
|
||||
PCD_LT,
|
||||
PCD_GT,
|
||||
PCD_LE,
|
||||
PCD_GE,
|
||||
PCD_ASSIGNSCRIPTVAR,
|
||||
PCD_ASSIGNMAPVAR,
|
||||
PCD_ASSIGNWORLDVAR,
|
||||
PCD_PUSHSCRIPTVAR,
|
||||
PCD_PUSHMAPVAR,
|
||||
/* 30*/ PCD_PUSHWORLDVAR,
|
||||
PCD_ADDSCRIPTVAR,
|
||||
PCD_ADDMAPVAR,
|
||||
PCD_ADDWORLDVAR,
|
||||
PCD_SUBSCRIPTVAR,
|
||||
PCD_SUBMAPVAR,
|
||||
PCD_SUBWORLDVAR,
|
||||
PCD_MULSCRIPTVAR,
|
||||
PCD_MULMAPVAR,
|
||||
PCD_MULWORLDVAR,
|
||||
/* 40*/ PCD_DIVSCRIPTVAR,
|
||||
PCD_DIVMAPVAR,
|
||||
PCD_DIVWORLDVAR,
|
||||
PCD_MODSCRIPTVAR,
|
||||
PCD_MODMAPVAR,
|
||||
PCD_MODWORLDVAR,
|
||||
PCD_INCSCRIPTVAR,
|
||||
PCD_INCMAPVAR,
|
||||
PCD_INCWORLDVAR,
|
||||
PCD_DECSCRIPTVAR,
|
||||
/* 50*/ PCD_DECMAPVAR,
|
||||
PCD_DECWORLDVAR,
|
||||
PCD_GOTO,
|
||||
PCD_IFGOTO,
|
||||
PCD_DROP,
|
||||
PCD_DELAY,
|
||||
PCD_DELAYDIRECT,
|
||||
PCD_RANDOM,
|
||||
PCD_RANDOMDIRECT,
|
||||
PCD_THINGCOUNT,
|
||||
/* 60*/ PCD_THINGCOUNTDIRECT,
|
||||
PCD_TAGWAIT,
|
||||
PCD_TAGWAITDIRECT,
|
||||
PCD_POLYWAIT,
|
||||
PCD_POLYWAITDIRECT,
|
||||
PCD_CHANGEFLOOR,
|
||||
PCD_CHANGEFLOORDIRECT,
|
||||
PCD_CHANGECEILING,
|
||||
PCD_CHANGECEILINGDIRECT,
|
||||
PCD_RESTART,
|
||||
/* 70*/ PCD_ANDLOGICAL,
|
||||
PCD_ORLOGICAL,
|
||||
PCD_ANDBITWISE,
|
||||
PCD_ORBITWISE,
|
||||
PCD_EORBITWISE,
|
||||
PCD_NEGATELOGICAL,
|
||||
PCD_LSHIFT,
|
||||
PCD_RSHIFT,
|
||||
PCD_UNARYMINUS,
|
||||
PCD_IFNOTGOTO,
|
||||
/* 80*/ PCD_LINESIDE,
|
||||
PCD_SCRIPTWAIT,
|
||||
PCD_SCRIPTWAITDIRECT,
|
||||
PCD_CLEARLINESPECIAL,
|
||||
PCD_CASEGOTO,
|
||||
PCD_BEGINPRINT,
|
||||
PCD_ENDPRINT,
|
||||
PCD_PRINTSTRING,
|
||||
PCD_PRINTNUMBER,
|
||||
PCD_PRINTCHARACTER,
|
||||
/* 90*/ PCD_PLAYERCOUNT,
|
||||
PCD_GAMETYPE,
|
||||
PCD_GAMESKILL,
|
||||
PCD_TIMER,
|
||||
PCD_SECTORSOUND,
|
||||
PCD_AMBIENTSOUND,
|
||||
PCD_SOUNDSEQUENCE,
|
||||
PCD_SETLINETEXTURE,
|
||||
PCD_SETLINEBLOCKING,
|
||||
PCD_SETLINESPECIAL,
|
||||
/*100*/ PCD_THINGSOUND,
|
||||
PCD_ENDPRINTBOLD, // [RH] End of Hexen p-codes
|
||||
PCD_ACTIVATORSOUND,
|
||||
PCD_LOCALAMBIENTSOUND,
|
||||
PCD_SETLINEMONSTERBLOCKING,
|
||||
PCD_PLAYERBLUESKULL, // [BC] Start of new [Skull Tag] pcodes
|
||||
PCD_PLAYERREDSKULL,
|
||||
PCD_PLAYERYELLOWSKULL,
|
||||
PCD_PLAYERMASTERSKULL,
|
||||
PCD_PLAYERBLUECARD,
|
||||
/*110*/ PCD_PLAYERREDCARD,
|
||||
PCD_PLAYERYELLOWCARD,
|
||||
PCD_PLAYERMASTERCARD,
|
||||
PCD_PLAYERBLACKSKULL,
|
||||
PCD_PLAYERSILVERSKULL,
|
||||
PCD_PLAYERGOLDSKULL,
|
||||
PCD_PLAYERBLACKCARD,
|
||||
PCD_PLAYERSILVERCARD,
|
||||
PCD_ISNETWORKGAME,
|
||||
PCD_PLAYERTEAM,
|
||||
/*120*/ PCD_PLAYERHEALTH,
|
||||
PCD_PLAYERARMORPOINTS,
|
||||
PCD_PLAYERFRAGS,
|
||||
PCD_PLAYEREXPERT,
|
||||
PCD_BLUETEAMCOUNT,
|
||||
PCD_REDTEAMCOUNT,
|
||||
PCD_BLUETEAMSCORE,
|
||||
PCD_REDTEAMSCORE,
|
||||
PCD_ISONEFLAGCTF,
|
||||
PCD_LSPEC6, // These are never used. They should probably
|
||||
/*130*/ PCD_LSPEC6DIRECT, // be given names like PCD_DUMMY.
|
||||
PCD_PRINTNAME,
|
||||
PCD_MUSICCHANGE,
|
||||
PCD_CONSOLECOMMANDDIRECT,
|
||||
PCD_CONSOLECOMMAND,
|
||||
PCD_SINGLEPLAYER, // [RH] End of Skull Tag p-codes
|
||||
PCD_FIXEDMUL,
|
||||
PCD_FIXEDDIV,
|
||||
PCD_SETGRAVITY,
|
||||
PCD_SETGRAVITYDIRECT,
|
||||
/*140*/ PCD_SETAIRCONTROL,
|
||||
PCD_SETAIRCONTROLDIRECT,
|
||||
PCD_CLEARINVENTORY,
|
||||
PCD_GIVEINVENTORY,
|
||||
PCD_GIVEINVENTORYDIRECT,
|
||||
PCD_TAKEINVENTORY,
|
||||
PCD_TAKEINVENTORYDIRECT,
|
||||
PCD_CHECKINVENTORY,
|
||||
PCD_CHECKINVENTORYDIRECT,
|
||||
PCD_SPAWN,
|
||||
/*150*/ PCD_SPAWNDIRECT,
|
||||
PCD_SPAWNSPOT,
|
||||
PCD_SPAWNSPOTDIRECT,
|
||||
PCD_SETMUSIC,
|
||||
PCD_SETMUSICDIRECT,
|
||||
PCD_LOCALSETMUSIC,
|
||||
PCD_LOCALSETMUSICDIRECT,
|
||||
PCD_PRINTFIXED,
|
||||
PCD_PRINTLOCALIZED,
|
||||
PCD_MOREHUDMESSAGE,
|
||||
/*160*/ PCD_OPTHUDMESSAGE,
|
||||
PCD_ENDHUDMESSAGE,
|
||||
PCD_ENDHUDMESSAGEBOLD,
|
||||
PCD_SETSTYLE,
|
||||
PCD_SETSTYLEDIRECT,
|
||||
PCD_SETFONT,
|
||||
PCD_SETFONTDIRECT,
|
||||
PCD_PUSHBYTE,
|
||||
PCD_LSPEC1DIRECTB,
|
||||
PCD_LSPEC2DIRECTB,
|
||||
/*170*/ PCD_LSPEC3DIRECTB,
|
||||
PCD_LSPEC4DIRECTB,
|
||||
PCD_LSPEC5DIRECTB,
|
||||
PCD_DELAYDIRECTB,
|
||||
PCD_RANDOMDIRECTB,
|
||||
PCD_PUSHBYTES,
|
||||
PCD_PUSH2BYTES,
|
||||
PCD_PUSH3BYTES,
|
||||
PCD_PUSH4BYTES,
|
||||
PCD_PUSH5BYTES,
|
||||
/*180*/ PCD_SETTHINGSPECIAL,
|
||||
PCD_ASSIGNGLOBALVAR,
|
||||
PCD_PUSHGLOBALVAR,
|
||||
PCD_ADDGLOBALVAR,
|
||||
PCD_SUBGLOBALVAR,
|
||||
PCD_MULGLOBALVAR,
|
||||
PCD_DIVGLOBALVAR,
|
||||
PCD_MODGLOBALVAR,
|
||||
PCD_INCGLOBALVAR,
|
||||
PCD_DECGLOBALVAR,
|
||||
/*190*/ PCD_FADETO,
|
||||
PCD_FADERANGE,
|
||||
PCD_CANCELFADE,
|
||||
PCD_PLAYMOVIE,
|
||||
PCD_SETFLOORTRIGGER,
|
||||
PCD_SETCEILINGTRIGGER,
|
||||
PCD_GETACTORX,
|
||||
PCD_GETACTORY,
|
||||
PCD_GETACTORZ,
|
||||
PCD_STARTTRANSLATION,
|
||||
/*200*/ PCD_TRANSLATIONRANGE1,
|
||||
PCD_TRANSLATIONRANGE2,
|
||||
PCD_ENDTRANSLATION,
|
||||
PCD_CALL,
|
||||
PCD_CALLDISCARD,
|
||||
PCD_RETURNVOID,
|
||||
PCD_RETURNVAL,
|
||||
PCD_PUSHMAPARRAY,
|
||||
PCD_ASSIGNMAPARRAY,
|
||||
PCD_ADDMAPARRAY,
|
||||
/*210*/ PCD_SUBMAPARRAY,
|
||||
PCD_MULMAPARRAY,
|
||||
PCD_DIVMAPARRAY,
|
||||
PCD_MODMAPARRAY,
|
||||
PCD_INCMAPARRAY,
|
||||
PCD_DECMAPARRAY,
|
||||
PCD_DUP,
|
||||
PCD_SWAP,
|
||||
PCD_WRITETOINI,
|
||||
PCD_GETFROMINI,
|
||||
/*220*/ PCD_SIN,
|
||||
PCD_COS,
|
||||
PCD_VECTORANGLE,
|
||||
PCD_CHECKWEAPON,
|
||||
PCD_SETWEAPON,
|
||||
PCD_TAGSTRING,
|
||||
PCD_PUSHWORLDARRAY,
|
||||
PCD_ASSIGNWORLDARRAY,
|
||||
PCD_ADDWORLDARRAY,
|
||||
PCD_SUBWORLDARRAY,
|
||||
/*230*/ PCD_MULWORLDARRAY,
|
||||
PCD_DIVWORLDARRAY,
|
||||
PCD_MODWORLDARRAY,
|
||||
PCD_INCWORLDARRAY,
|
||||
PCD_DECWORLDARRAY,
|
||||
PCD_PUSHGLOBALARRAY,
|
||||
PCD_ASSIGNGLOBALARRAY,
|
||||
PCD_ADDGLOBALARRAY,
|
||||
PCD_SUBGLOBALARRAY,
|
||||
PCD_MULGLOBALARRAY,
|
||||
/*240*/ PCD_DIVGLOBALARRAY,
|
||||
PCD_MODGLOBALARRAY,
|
||||
PCD_INCGLOBALARRAY,
|
||||
PCD_DECGLOBALARRAY,
|
||||
PCD_SETMARINEWEAPON,
|
||||
PCD_SETACTORPROPERTY,
|
||||
PCD_GETACTORPROPERTY,
|
||||
PCD_PLAYERNUMBER,
|
||||
PCD_ACTIVATORTID,
|
||||
PCD_SETMARINESPRITE,
|
||||
/*250*/ PCD_GETSCREENWIDTH,
|
||||
PCD_GETSCREENHEIGHT,
|
||||
PCD_THING_PROJECTILE2,
|
||||
PCD_STRLEN,
|
||||
PCD_SETHUDSIZE,
|
||||
PCD_GETCVAR,
|
||||
PCD_CASEGOTOSORTED,
|
||||
PCD_SETRESULTVALUE,
|
||||
PCD_GETLINEROWOFFSET,
|
||||
PCD_GETACTORFLOORZ,
|
||||
/*260*/ PCD_GETACTORANGLE,
|
||||
PCD_GETSECTORFLOORZ,
|
||||
PCD_GETSECTORCEILINGZ,
|
||||
PCD_LSPEC5RESULT,
|
||||
PCD_GETSIGILPIECES,
|
||||
PCD_GETLEVELINFO,
|
||||
PCD_CHANGESKY,
|
||||
PCD_PLAYERINGAME,
|
||||
PCD_PLAYERISBOT,
|
||||
PCD_SETCAMERATOTEXTURE,
|
||||
/*270*/ PCD_ENDLOG,
|
||||
PCD_GETAMMOCAPACITY,
|
||||
PCD_SETAMMOCAPACITY,
|
||||
PCD_PRINTMAPCHARARRAY, // [JB] start of new p-codes
|
||||
PCD_PRINTWORLDCHARARRAY,
|
||||
PCD_PRINTGLOBALCHARARRAY, // [JB] end of new p-codes
|
||||
PCD_SETACTORANGLE, // [GRB]
|
||||
PCD_GRABINPUT, // Unused but acc defines them
|
||||
PCD_SETMOUSEPOINTER, // "
|
||||
PCD_MOVEMOUSEPOINTER, // "
|
||||
/*280*/ PCD_SPAWNPROJECTILE,
|
||||
PCD_GETSECTORLIGHTLEVEL,
|
||||
PCD_GETACTORCEILINGZ,
|
||||
PCD_SETACTORPOSITION,
|
||||
PCD_CLEARACTORINVENTORY,
|
||||
PCD_GIVEACTORINVENTORY,
|
||||
PCD_TAKEACTORINVENTORY,
|
||||
PCD_CHECKACTORINVENTORY,
|
||||
PCD_THINGCOUNTNAME,
|
||||
PCD_SPAWNSPOTFACING,
|
||||
/*290*/ PCD_PLAYERCLASS, // [GRB]
|
||||
//[MW] start my p-codes
|
||||
PCD_ANDSCRIPTVAR,
|
||||
PCD_ANDMAPVAR,
|
||||
PCD_ANDWORLDVAR,
|
||||
PCD_ANDGLOBALVAR,
|
||||
PCD_ANDMAPARRAY,
|
||||
PCD_ANDWORLDARRAY,
|
||||
PCD_ANDGLOBALARRAY,
|
||||
PCD_EORSCRIPTVAR,
|
||||
PCD_EORMAPVAR,
|
||||
/*300*/ PCD_EORWORLDVAR,
|
||||
PCD_EORGLOBALVAR,
|
||||
PCD_EORMAPARRAY,
|
||||
PCD_EORWORLDARRAY,
|
||||
PCD_EORGLOBALARRAY,
|
||||
PCD_ORSCRIPTVAR,
|
||||
PCD_ORMAPVAR,
|
||||
PCD_ORWORLDVAR,
|
||||
PCD_ORGLOBALVAR,
|
||||
PCD_ORMAPARRAY,
|
||||
/*310*/ PCD_ORWORLDARRAY,
|
||||
PCD_ORGLOBALARRAY,
|
||||
PCD_LSSCRIPTVAR,
|
||||
PCD_LSMAPVAR,
|
||||
PCD_LSWORLDVAR,
|
||||
PCD_LSGLOBALVAR,
|
||||
PCD_LSMAPARRAY,
|
||||
PCD_LSWORLDARRAY,
|
||||
PCD_LSGLOBALARRAY,
|
||||
PCD_RSSCRIPTVAR,
|
||||
/*320*/ PCD_RSMAPVAR,
|
||||
PCD_RSWORLDVAR,
|
||||
PCD_RSGLOBALVAR,
|
||||
PCD_RSMAPARRAY,
|
||||
PCD_RSWORLDARRAY,
|
||||
PCD_RSGLOBALARRAY,
|
||||
//[MW] end my p-codes
|
||||
PCD_GETPLAYERINFO, // [GRB]
|
||||
PCD_CHANGELEVEL,
|
||||
PCD_SECTORDAMAGE,
|
||||
PCD_REPLACETEXTURES,
|
||||
/*330*/ PCD_NEGATEBINARY,
|
||||
PCD_GETACTORPITCH,
|
||||
PCD_SETACTORPITCH,
|
||||
PCD_PRINTBIND,
|
||||
PCD_SETACTORSTATE,
|
||||
PCD_THINGDAMAGE2,
|
||||
PCD_USEINVENTORY,
|
||||
PCD_USEACTORINVENTORY,
|
||||
PCD_CHECKACTORCEILINGTEXTURE,
|
||||
PCD_CHECKACTORFLOORTEXTURE,
|
||||
/*340*/ PCD_GETACTORLIGHTLEVEL,
|
||||
PCD_SETMUGSHOTSTATE,
|
||||
PCD_THINGCOUNTSECTOR,
|
||||
PCD_THINGCOUNTNAMESECTOR,
|
||||
PCD_CHECKPLAYERCAMERA, // [TN]
|
||||
PCD_MORPHACTOR, // [MH]
|
||||
PCD_UNMORPHACTOR, // [MH]
|
||||
PCD_GETPLAYERINPUT,
|
||||
PCD_CLASSIFYACTOR,
|
||||
PCD_PRINTBINARY,
|
||||
/*350*/ PCD_PRINTHEX,
|
||||
PCD_CALLFUNC,
|
||||
PCD_SAVESTRING, // [FDARI] create string (temporary)
|
||||
PCD_PRINTMAPCHRANGE, // [FDARI] output range (print part of array)
|
||||
PCD_PRINTWORLDCHRANGE,
|
||||
PCD_PRINTGLOBALCHRANGE,
|
||||
PCD_STRCPYTOMAPCHRANGE, // [FDARI] input range (copy string to all/part of array)
|
||||
PCD_STRCPYTOWORLDCHRANGE,
|
||||
PCD_STRCPYTOGLOBALCHRANGE,
|
||||
PCD_PUSHFUNCTION, // from Eternity
|
||||
/*360*/ PCD_CALLSTACK, // from Eternity
|
||||
PCD_SCRIPTWAITNAMED,
|
||||
PCD_TRANSLATIONRANGE3,
|
||||
PCD_GOTOSTACK,
|
||||
PCD_ASSIGNSCRIPTARRAY,
|
||||
PCD_PUSHSCRIPTARRAY,
|
||||
PCD_ADDSCRIPTARRAY,
|
||||
PCD_SUBSCRIPTARRAY,
|
||||
PCD_MULSCRIPTARRAY,
|
||||
PCD_DIVSCRIPTARRAY,
|
||||
/*370*/ PCD_MODSCRIPTARRAY,
|
||||
PCD_INCSCRIPTARRAY,
|
||||
PCD_DECSCRIPTARRAY,
|
||||
PCD_ANDSCRIPTARRAY,
|
||||
PCD_EORSCRIPTARRAY,
|
||||
PCD_ORSCRIPTARRAY,
|
||||
PCD_LSSCRIPTARRAY,
|
||||
PCD_RSSCRIPTARRAY,
|
||||
PCD_PRINTSCRIPTCHARARRAY,
|
||||
PCD_PRINTSCRIPTCHRANGE,
|
||||
/*380*/ PCD_STRCPYTOSCRIPTCHRANGE,
|
||||
PCD_LSPEC5EX,
|
||||
PCD_LSPEC5EXRESULT,
|
||||
PCD_TRANSLATIONRANGE4,
|
||||
PCD_TRANSLATIONRANGE5,
|
||||
|
||||
/*381*/ PCODE_COMMAND_COUNT
|
||||
};
|
||||
|
||||
// Some constants used by ACS scripts
|
||||
enum {
|
||||
LINE_FRONT = 0,
|
||||
LINE_BACK = 1
|
||||
};
|
||||
enum {
|
||||
SIDE_FRONT = 0,
|
||||
SIDE_BACK = 1
|
||||
};
|
||||
enum {
|
||||
TEXTURE_TOP = 0,
|
||||
TEXTURE_MIDDLE = 1,
|
||||
TEXTURE_BOTTOM = 2
|
||||
};
|
||||
enum {
|
||||
GAME_SINGLE_PLAYER = 0,
|
||||
GAME_NET_COOPERATIVE = 1,
|
||||
GAME_NET_DEATHMATCH = 2,
|
||||
GAME_TITLE_MAP = 3
|
||||
};
|
||||
enum {
|
||||
CLASS_FIGHTER = 0,
|
||||
CLASS_CLERIC = 1,
|
||||
CLASS_MAGE = 2
|
||||
};
|
||||
enum {
|
||||
SKILL_VERY_EASY = 0,
|
||||
SKILL_EASY = 1,
|
||||
SKILL_NORMAL = 2,
|
||||
SKILL_HARD = 3,
|
||||
SKILL_VERY_HARD = 4
|
||||
};
|
||||
enum {
|
||||
BLOCK_NOTHING = 0,
|
||||
BLOCK_CREATURES = 1,
|
||||
BLOCK_EVERYTHING = 2,
|
||||
BLOCK_RAILING = 3,
|
||||
BLOCK_PLAYERS = 4
|
||||
};
|
||||
enum {
|
||||
LEVELINFO_PAR_TIME,
|
||||
LEVELINFO_CLUSTERNUM,
|
||||
LEVELINFO_LEVELNUM,
|
||||
LEVELINFO_TOTAL_SECRETS,
|
||||
LEVELINFO_FOUND_SECRETS,
|
||||
LEVELINFO_TOTAL_ITEMS,
|
||||
LEVELINFO_FOUND_ITEMS,
|
||||
LEVELINFO_TOTAL_MONSTERS,
|
||||
LEVELINFO_KILLED_MONSTERS,
|
||||
LEVELINFO_SUCK_TIME
|
||||
};
|
||||
enum {
|
||||
PLAYERINFO_TEAM,
|
||||
PLAYERINFO_AIMDIST,
|
||||
PLAYERINFO_COLOR,
|
||||
PLAYERINFO_GENDER,
|
||||
PLAYERINFO_NEVERSWITCH,
|
||||
PLAYERINFO_MOVEBOB,
|
||||
PLAYERINFO_STILLBOB,
|
||||
PLAYERINFO_PLAYERCLASS,
|
||||
PLAYERINFO_FOV,
|
||||
PLAYERINFO_DESIREDFOV,
|
||||
};
|
||||
|
||||
enum EScriptState
|
||||
{
|
||||
|
|
|
@ -1708,7 +1708,7 @@ bool AActor::OkayToSwitchTarget (AActor *other)
|
|||
}
|
||||
}
|
||||
|
||||
if ((flags7 & MF7_NOINFIGHTSPECIES) && GetSpecies() == target->GetSpecies())
|
||||
if ((flags7 & MF7_NOINFIGHTSPECIES) && GetSpecies() == other->GetSpecies())
|
||||
return false; // Don't fight own species.
|
||||
|
||||
if ((other->flags3 & MF3_NOTARGET) &&
|
||||
|
|
|
@ -897,6 +897,74 @@ void FMultiBlockLinesIterator::Reset()
|
|||
startIteratorForGroup(basegroup);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// and the scriptable version
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class DBlockLinesIterator : public DObject, public FMultiBlockLinesIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DBlockLinesIterator, DObject);
|
||||
FPortalGroupArray check;
|
||||
|
||||
public:
|
||||
FMultiBlockLinesIterator::CheckResult cres;
|
||||
|
||||
bool Next()
|
||||
{
|
||||
return FMultiBlockLinesIterator::Next(&cres);
|
||||
}
|
||||
|
||||
DBlockLinesIterator(AActor *actor, double checkradius)
|
||||
: FMultiBlockLinesIterator(check, actor, checkradius)
|
||||
{
|
||||
cres.line = nullptr;
|
||||
cres.Position.Zero();
|
||||
cres.portalflags = 0;
|
||||
}
|
||||
|
||||
DBlockLinesIterator(double x, double y, double z, double height, double radius, sector_t *sec)
|
||||
:FMultiBlockLinesIterator(check, x, y, z, height, radius, sec)
|
||||
{
|
||||
cres.line = nullptr;
|
||||
cres.Position.Zero();
|
||||
cres.portalflags = 0;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DBlockLinesIterator, true, false);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockLinesIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT_NOT_NULL(origin, AActor);
|
||||
PARAM_FLOAT_DEF(radius);
|
||||
ACTION_RETURN_OBJECT(new DBlockLinesIterator(origin, radius));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockLinesIterator, CreateFromPos)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_FLOAT(radius);
|
||||
PARAM_POINTER_DEF(sec, sector_t);
|
||||
ACTION_RETURN_OBJECT(new DBlockLinesIterator(x, y, z, h, radius, sec));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBlockLinesIterator);
|
||||
ACTION_RETURN_BOOL(self->Next());
|
||||
}
|
||||
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.line, curline);
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.Position, position);
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.portalflags, portalflags);
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FBlockThingsIterator :: FBlockThingsIterator
|
||||
|
@ -1176,17 +1244,11 @@ void FMultiBlockThingsIterator::Reset()
|
|||
|
||||
class DBlockThingsIterator : public DObject, public FMultiBlockThingsIterator
|
||||
{
|
||||
DECLARE_CLASS(DBlockThingsIterator, DObject);
|
||||
DECLARE_ABSTRACT_CLASS(DBlockThingsIterator, DObject);
|
||||
FPortalGroupArray check;
|
||||
protected:
|
||||
DBlockThingsIterator()
|
||||
:FMultiBlockThingsIterator(check)
|
||||
{
|
||||
}
|
||||
public:
|
||||
FMultiBlockThingsIterator::CheckResult cres;
|
||||
|
||||
public:
|
||||
bool Next()
|
||||
{
|
||||
return FMultiBlockThingsIterator::Next(&cres);
|
||||
|
@ -1209,7 +1271,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DBlockThingsIterator, false, false);
|
||||
IMPLEMENT_CLASS(DBlockThingsIterator, true, false);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Create)
|
||||
{
|
||||
|
@ -1232,9 +1294,9 @@ DEFINE_ACTION_FUNCTION(DBlockThingsIterator, CreateFromPos)
|
|||
ACTION_RETURN_OBJECT(new DBlockThingsIterator(x, y, z, h, radius, ignore, nullptr));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Next)
|
||||
DEFINE_ACTION_FUNCTION(DBlockLinesIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBlockThingsIterator);
|
||||
PARAM_SELF_PROLOGUE(DBlockLinesIterator);
|
||||
ACTION_RETURN_BOOL(self->Next());
|
||||
}
|
||||
|
||||
|
|
|
@ -7867,7 +7867,7 @@ DEFINE_ACTION_FUNCTION(AActor, GetBobOffset)
|
|||
|
||||
class DActorIterator : public DObject, public NActorIterator
|
||||
{
|
||||
DECLARE_CLASS(DActorIterator, DObject)
|
||||
DECLARE_ABSTRACT_CLASS(DActorIterator, DObject)
|
||||
|
||||
public:
|
||||
DActorIterator(PClassActor *cls= nullptr, int tid = 0)
|
||||
|
@ -7876,7 +7876,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DActorIterator, false, false);
|
||||
IMPLEMENT_CLASS(DActorIterator, true, false);
|
||||
DEFINE_ACTION_FUNCTION(DActorIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
|
|
|
@ -362,3 +362,65 @@ int FLineIdIterator::Next()
|
|||
start = tagManager.allIDs[start].nexttag;
|
||||
return ret;
|
||||
}
|
||||
|
||||
class DSectorTagIterator : public DObject, public FSectorTagIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DSectorTagIterator, DObject);
|
||||
public:
|
||||
DSectorTagIterator(int tag, line_t *line)
|
||||
{
|
||||
if (line == nullptr) Init(tag);
|
||||
else Init(tag, line);
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DSectorTagIterator, true, false);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DSectorTagIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(tag);
|
||||
PARAM_POINTER_DEF(line, line_t);
|
||||
ACTION_RETURN_POINTER(new DSectorTagIterator(tag, line));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DSectorTagIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DSectorTagIterator);
|
||||
ACTION_RETURN_INT(self->Next());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DSectorTagIterator, NextCompat)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DSectorTagIterator);
|
||||
PARAM_BOOL(compat);
|
||||
PARAM_INT(secnum);
|
||||
ACTION_RETURN_INT(self->NextCompat(compat, secnum));
|
||||
}
|
||||
|
||||
|
||||
class DLineIdIterator : public DObject, public FLineIdIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DLineIdIterator, DObject);
|
||||
public:
|
||||
DLineIdIterator(int tag)
|
||||
: FLineIdIterator(tag)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DLineIdIterator, true, false);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DLineIdIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(tag);
|
||||
ACTION_RETURN_POINTER(new DLineIdIterator(tag));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DLineIdIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DLineIdIterator);
|
||||
ACTION_RETURN_INT(self->Next());
|
||||
}
|
||||
|
||||
|
|
25
src/p_tags.h
25
src/p_tags.h
|
@ -77,20 +77,23 @@ protected:
|
|||
int searchtag;
|
||||
int start;
|
||||
|
||||
public:
|
||||
FSectorTagIterator(int tag)
|
||||
FSectorTagIterator()
|
||||
{
|
||||
// For DSectorTagIterator
|
||||
}
|
||||
|
||||
void Init(int tag)
|
||||
{
|
||||
searchtag = tag;
|
||||
start = tag == 0 ? 0 : tagManager.TagHashFirst[((unsigned int)tag) % FTagManager::TAG_HASH_SIZE];
|
||||
}
|
||||
|
||||
// Special constructor for actions that treat tag 0 as 'back of activation line'
|
||||
FSectorTagIterator(int tag, line_t *line)
|
||||
void Init(int tag, line_t *line)
|
||||
{
|
||||
if (tag == 0)
|
||||
{
|
||||
searchtag = INT_MIN;
|
||||
start = (line == NULL || line->backsector == NULL)? -1 : line->backsector->Index();
|
||||
start = (line == NULL || line->backsector == NULL) ? -1 : line->backsector->Index();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -99,6 +102,18 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
public:
|
||||
FSectorTagIterator(int tag)
|
||||
{
|
||||
Init(tag);
|
||||
}
|
||||
|
||||
// Special constructor for actions that treat tag 0 as 'back of activation line'
|
||||
FSectorTagIterator(int tag, line_t *line)
|
||||
{
|
||||
Init(tag, line);
|
||||
}
|
||||
|
||||
int Next();
|
||||
int NextCompat(bool compat, int secnum);
|
||||
};
|
||||
|
|
|
@ -83,13 +83,6 @@ struct vertexdata_t
|
|||
uint32_t flags;
|
||||
};
|
||||
|
||||
#ifdef USE_FLOAT
|
||||
typedef float vtype;
|
||||
#elif !defined USE_FIXED
|
||||
typedef double vtype;
|
||||
#endif
|
||||
|
||||
|
||||
struct vertex_t
|
||||
{
|
||||
DVector2 p;
|
||||
|
|
|
@ -5281,6 +5281,12 @@ FxExpression *FxMinMax::Resolve(FCompileContext &ctx)
|
|||
break;
|
||||
}
|
||||
}
|
||||
// If the first choice is constant, swap it with the second one.
|
||||
// Note that all constants have already been folded together so there can only be one constant in the list of choices.
|
||||
if (choices[0]->isConstant())
|
||||
{
|
||||
std::swap(choices[0], choices[1]);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -5307,6 +5313,7 @@ ExpEmit FxMinMax::Emit(VMFunctionBuilder *build)
|
|||
int opcode;
|
||||
|
||||
assert(choices.Size() > 0);
|
||||
assert(!choices[0]->isConstant());
|
||||
assert(OP_MAXF_RK == OP_MAXF_RR+1);
|
||||
assert(OP_MAX_RK == OP_MAX_RR+1);
|
||||
assert(OP_MIN_RK == OP_MIN_RR+1);
|
||||
|
@ -5321,28 +5328,30 @@ ExpEmit FxMinMax::Emit(VMFunctionBuilder *build)
|
|||
opcode = ValueType->GetRegType() == REGT_FLOAT ? OP_MAXF_RR : OP_MAX_RR;
|
||||
}
|
||||
|
||||
ExpEmit bestreg;
|
||||
ExpEmit firstreg = choices[0]->Emit(build);
|
||||
ExpEmit destreg;
|
||||
|
||||
// Get first value into a register. This will also be the result register.
|
||||
if (choices[0]->isConstant())
|
||||
if (firstreg.Fixed)
|
||||
{
|
||||
bestreg = ExpEmit(build, ValueType->GetRegType());
|
||||
EmitLoad(build, bestreg, static_cast<FxConstant *>(choices[0])->GetValue());
|
||||
destreg = ExpEmit(build, firstreg.RegType);
|
||||
firstreg.Free(build);
|
||||
}
|
||||
else
|
||||
{
|
||||
bestreg = choices[0]->Emit(build);
|
||||
destreg = firstreg;
|
||||
}
|
||||
|
||||
|
||||
// Compare every choice. Better matches get copied to the bestreg.
|
||||
for (i = 1; i < choices.Size(); ++i)
|
||||
{
|
||||
ExpEmit checkreg = choices[i]->Emit(build);
|
||||
assert(checkreg.RegType == bestreg.RegType);
|
||||
build->Emit(opcode + checkreg.Konst, bestreg.RegNum, bestreg.RegNum, checkreg.RegNum);
|
||||
assert(checkreg.RegType == firstreg.RegType);
|
||||
build->Emit(opcode + checkreg.Konst, destreg.RegNum, firstreg.RegNum, checkreg.RegNum);
|
||||
firstreg = destreg;
|
||||
checkreg.Free(build);
|
||||
}
|
||||
return bestreg;
|
||||
return destreg;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -811,7 +811,19 @@ begin:
|
|||
{
|
||||
b = B;
|
||||
PClass *cls = (PClass*)(pc->op == OP_NEW ? reg.a[b] : konsta[b].v);
|
||||
if (cls->ObjectFlags & OF_Abstract) ThrowAbortException(X_OTHER, "Cannot instantiate abstract class %s", cls->TypeName.GetChars());
|
||||
if (cls->ConstructNative == nullptr)
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "Class %s requires native construction", cls->TypeName.GetChars());
|
||||
}
|
||||
if (cls->ObjectFlags & OF_Abstract)
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "Cannot instantiate abstract class %s", cls->TypeName.GetChars());
|
||||
}
|
||||
// Creating actors here must be outright prohibited,
|
||||
if (cls->IsDescendantOf(RUNTIME_CLASS(AActor)))
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "Cannot create actors with 'new'");
|
||||
}
|
||||
// [ZZ] validate readonly and between scope construction
|
||||
c = C;
|
||||
if (c) FScopeBarrier::ValidateNew(cls, c - 1);
|
||||
|
|
|
@ -276,7 +276,7 @@ void ZCCCompiler::ProcessStruct(ZCC_Struct *cnode, PSymbolTreeNode *treenode, ZC
|
|||
//==========================================================================
|
||||
|
||||
ZCCCompiler::ZCCCompiler(ZCC_AST &ast, DObject *_outer, PSymbolTable &_symbols, PNamespace *_outnamespc, int lumpnum, const VersionInfo &ver)
|
||||
: Outer(_outer), GlobalTreeNodes(&_symbols), OutNamespace(_outnamespc), AST(ast), Lump(lumpnum), mVersion(ver)
|
||||
: Outer(_outer), GlobalTreeNodes(&_symbols), OutNamespace(_outnamespc), AST(ast), mVersion(ver), Lump(lumpnum)
|
||||
{
|
||||
FScriptPosition::ResetErrorCounter();
|
||||
// Group top-level nodes by type
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "f_wipe.h"
|
||||
#include "sbar.h"
|
||||
#include "win32iface.h"
|
||||
#include "win32swiface.h"
|
||||
#include "doomstat.h"
|
||||
#include "v_palette.h"
|
||||
#include "w_wad.h"
|
||||
|
@ -1210,10 +1211,7 @@ void D3DFB::Flip()
|
|||
}
|
||||
}
|
||||
// Limiting the frame rate is as simple as waiting for the timer to signal this event.
|
||||
if (FPSLimitEvent != NULL)
|
||||
{
|
||||
WaitForSingleObject(FPSLimitEvent, 1000);
|
||||
}
|
||||
I_FPSLimit();
|
||||
D3DDevice->Present(NULL, NULL, NULL, NULL);
|
||||
InScene = false;
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "doomtype.h"
|
||||
#include "f_wipe.h"
|
||||
#include "win32iface.h"
|
||||
#include "win32swiface.h"
|
||||
#include "templates.h"
|
||||
#include "m_random.h"
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "doomerrors.h"
|
||||
|
||||
#include "win32iface.h"
|
||||
#include "win32swiface.h"
|
||||
#include "v_palette.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
@ -1196,10 +1197,7 @@ void DDrawFB::Update ()
|
|||
LockCount = 0;
|
||||
UpdatePending = false;
|
||||
|
||||
if (FPSLimitEvent != NULL)
|
||||
{
|
||||
WaitForSingleObject(FPSLimitEvent, 1000);
|
||||
}
|
||||
I_FPSLimit();
|
||||
if (!Windowed && AppActive && !SessionState /*&& !UseBlitter && !MustBuffer*/)
|
||||
{
|
||||
HRESULT hr = PrimarySurf->Flip (NULL, FlipFlags);
|
||||
|
|
|
@ -63,6 +63,7 @@ void I_SaveWindowedPos ();
|
|||
void I_RestoreWindowedPos ();
|
||||
|
||||
void I_SetFPSLimit(int limit);
|
||||
void I_FPSLimit();
|
||||
|
||||
|
||||
extern IVideo *Video;
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "m_argv.h"
|
||||
#include "rawinput.h"
|
||||
|
||||
#define SAFE_RELEASE(x) { if (x != NULL) { x->Release(); x = NULL; } }
|
||||
|
||||
// WBEMIDL BITS -- because w32api doesn't have this, either -----------------
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/system/gl_swframebuffer.h"
|
||||
|
||||
extern HWND Window;
|
||||
extern BOOL AppActive;
|
||||
|
||||
extern "C" {
|
||||
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
|
@ -51,6 +54,77 @@ CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
|
|||
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
|
||||
EXTERN_CVAR(Int, vid_refreshrate)
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
class Win32GLVideo : public IVideo
|
||||
{
|
||||
public:
|
||||
Win32GLVideo(int parm);
|
||||
virtual ~Win32GLVideo();
|
||||
|
||||
EDisplayType GetDisplayType() { return DISPLAY_Both; }
|
||||
void SetWindowedScale(float scale);
|
||||
void StartModeIterator(int bits, bool fs);
|
||||
bool NextMode(int *width, int *height, bool *letterbox);
|
||||
bool GoFullscreen(bool yes);
|
||||
DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old);
|
||||
virtual bool SetResolution(int width, int height, int bits);
|
||||
void DumpAdapters();
|
||||
bool InitHardware(HWND Window, int multisample);
|
||||
void Shutdown();
|
||||
bool SetFullscreen(const char *devicename, int w, int h, int bits, int hz);
|
||||
|
||||
HDC m_hDC;
|
||||
|
||||
protected:
|
||||
struct ModeInfo
|
||||
{
|
||||
ModeInfo(int inX, int inY, int inBits, int inRealY, int inRefresh)
|
||||
: next(NULL),
|
||||
width(inX),
|
||||
height(inY),
|
||||
bits(inBits),
|
||||
refreshHz(inRefresh),
|
||||
realheight(inRealY)
|
||||
{}
|
||||
ModeInfo *next;
|
||||
int width, height, bits, refreshHz, realheight;
|
||||
} *m_Modes;
|
||||
|
||||
ModeInfo *m_IteratorMode;
|
||||
int m_IteratorBits;
|
||||
bool m_IteratorFS;
|
||||
bool m_IsFullscreen;
|
||||
int m_trueHeight;
|
||||
int m_DisplayWidth, m_DisplayHeight, m_DisplayBits, m_DisplayHz;
|
||||
HMODULE hmRender;
|
||||
|
||||
char m_DisplayDeviceBuffer[CCHDEVICENAME];
|
||||
char *m_DisplayDeviceName;
|
||||
HMONITOR m_hMonitor;
|
||||
|
||||
HWND m_Window;
|
||||
HGLRC m_hRC;
|
||||
|
||||
HWND InitDummy();
|
||||
void ShutdownDummy(HWND dummy);
|
||||
bool SetPixelFormat();
|
||||
bool SetupPixelFormat(int multisample);
|
||||
|
||||
void GetDisplayDeviceName();
|
||||
void MakeModesList();
|
||||
void AddMode(int x, int y, int bits, int baseHeight, int refreshHz);
|
||||
void FreeModes();
|
||||
public:
|
||||
int GetTrueHeight() { return m_trueHeight; }
|
||||
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -1133,10 +1207,7 @@ void Win32GLFrameBuffer::SetVSync (bool vsync)
|
|||
void Win32GLFrameBuffer::SwapBuffers()
|
||||
{
|
||||
// Limiting the frame rate is as simple as waiting for the timer to signal this event.
|
||||
if (FPSLimitEvent != NULL)
|
||||
{
|
||||
WaitForSingleObject(FPSLimitEvent, 1000);
|
||||
}
|
||||
I_FPSLimit();
|
||||
::SwapBuffers(static_cast<Win32GLVideo *>(Video)->m_hDC);
|
||||
}
|
||||
|
||||
|
@ -1171,6 +1242,11 @@ int Win32GLFrameBuffer::GetClientHeight()
|
|||
return rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
int Win32GLFrameBuffer::GetTrueHeight()
|
||||
{
|
||||
return static_cast<Win32GLVideo *>(Video)->GetTrueHeight();
|
||||
}
|
||||
|
||||
IVideo *gl_CreateVideo()
|
||||
{
|
||||
return new Win32GLVideo(0);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
extern IVideo *Video;
|
||||
|
||||
|
||||
extern BOOL AppActive;
|
||||
|
||||
EXTERN_CVAR (Float, dimamount)
|
||||
EXTERN_CVAR (Color, dimcolor)
|
||||
|
@ -19,79 +18,12 @@ EXTERN_CVAR(Int, vid_defheight);
|
|||
EXTERN_CVAR(Int, vid_renderer);
|
||||
EXTERN_CVAR(Int, vid_adapter);
|
||||
|
||||
extern HINSTANCE g_hInst;
|
||||
extern HWND Window;
|
||||
extern IVideo *Video;
|
||||
|
||||
struct FRenderer;
|
||||
FRenderer *gl_CreateInterface();
|
||||
|
||||
|
||||
class Win32GLVideo : public IVideo
|
||||
{
|
||||
public:
|
||||
Win32GLVideo(int parm);
|
||||
virtual ~Win32GLVideo();
|
||||
|
||||
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
||||
void SetWindowedScale (float scale);
|
||||
void StartModeIterator (int bits, bool fs);
|
||||
bool NextMode (int *width, int *height, bool *letterbox);
|
||||
bool GoFullscreen(bool yes);
|
||||
DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old);
|
||||
virtual bool SetResolution (int width, int height, int bits);
|
||||
void DumpAdapters();
|
||||
bool InitHardware (HWND Window, int multisample);
|
||||
void Shutdown();
|
||||
bool SetFullscreen(const char *devicename, int w, int h, int bits, int hz);
|
||||
|
||||
HDC m_hDC;
|
||||
|
||||
protected:
|
||||
struct ModeInfo
|
||||
{
|
||||
ModeInfo (int inX, int inY, int inBits, int inRealY, int inRefresh)
|
||||
: next (NULL),
|
||||
width (inX),
|
||||
height (inY),
|
||||
bits (inBits),
|
||||
refreshHz (inRefresh),
|
||||
realheight (inRealY)
|
||||
{}
|
||||
ModeInfo *next;
|
||||
int width, height, bits, refreshHz, realheight;
|
||||
} *m_Modes;
|
||||
|
||||
ModeInfo *m_IteratorMode;
|
||||
int m_IteratorBits;
|
||||
bool m_IteratorFS;
|
||||
bool m_IsFullscreen;
|
||||
int m_trueHeight;
|
||||
int m_DisplayWidth, m_DisplayHeight, m_DisplayBits, m_DisplayHz;
|
||||
HMODULE hmRender;
|
||||
|
||||
char m_DisplayDeviceBuffer[CCHDEVICENAME];
|
||||
char *m_DisplayDeviceName;
|
||||
HMONITOR m_hMonitor;
|
||||
|
||||
HWND m_Window;
|
||||
HGLRC m_hRC;
|
||||
|
||||
HWND InitDummy();
|
||||
void ShutdownDummy(HWND dummy);
|
||||
bool SetPixelFormat();
|
||||
bool SetupPixelFormat(int multisample);
|
||||
|
||||
void GetDisplayDeviceName();
|
||||
void MakeModesList();
|
||||
void AddMode(int x, int y, int bits, int baseHeight, int refreshHz);
|
||||
void FreeModes();
|
||||
public:
|
||||
int GetTrueHeight() { return m_trueHeight; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Win32GLFrameBuffer : public BaseWinFB
|
||||
{
|
||||
|
@ -108,7 +40,7 @@ public:
|
|||
// unused but must be defined
|
||||
virtual void Blank ();
|
||||
virtual bool PaintToWindow ();
|
||||
virtual HRESULT GetHR();
|
||||
virtual long/*HRESULT*/ GetHR(); // windows.h pollution prevention.
|
||||
|
||||
virtual bool CreateResources ();
|
||||
virtual void ReleaseResources ();
|
||||
|
@ -120,7 +52,7 @@ public:
|
|||
int GetClientWidth();
|
||||
int GetClientHeight();
|
||||
|
||||
int GetTrueHeight() { return static_cast<Win32GLVideo *>(Video)->GetTrueHeight(); }
|
||||
int GetTrueHeight();
|
||||
|
||||
bool Lock(bool buffered);
|
||||
bool Lock ();
|
||||
|
@ -141,12 +73,12 @@ protected:
|
|||
void SetGammaTable(uint16_t * tbl);
|
||||
|
||||
float m_Gamma, m_Brightness, m_Contrast;
|
||||
WORD m_origGamma[768];
|
||||
BOOL m_supportsGamma;
|
||||
uint16_t m_origGamma[768];
|
||||
bool m_supportsGamma;
|
||||
bool m_Fullscreen, m_Bgra;
|
||||
int m_Width, m_Height, m_Bits, m_RefreshHz;
|
||||
int m_Lock;
|
||||
char m_displayDeviceNameBuffer[CCHDEVICENAME];
|
||||
char m_displayDeviceNameBuffer[32/*CCHDEVICENAME*/]; // do not use windows.h constants here!
|
||||
char *m_displayDeviceName;
|
||||
int SwapInterval;
|
||||
|
||||
|
|
|
@ -34,26 +34,11 @@
|
|||
#ifndef __WIN32IFACE_H
|
||||
#define __WIN32IFACE_H
|
||||
|
||||
#ifndef DIRECTDRAW_VERSION
|
||||
#define DIRECTDRAW_VERSION 0x0300
|
||||
#endif
|
||||
#ifndef DIRECT3D_VERSION
|
||||
#define DIRECT3D_VERSION 0x0900
|
||||
#endif
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ddraw.h>
|
||||
#include <d3d9.h>
|
||||
|
||||
#include "hardware.h"
|
||||
|
||||
#define SAFE_RELEASE(x) { if (x != NULL) { x->Release(); x = NULL; } }
|
||||
|
||||
EXTERN_CVAR (Bool, vid_vsync)
|
||||
|
||||
extern HANDLE FPSLimitEvent;
|
||||
|
||||
class D3DTex;
|
||||
class D3DPal;
|
||||
struct FSoftwareRenderer;
|
||||
|
@ -79,6 +64,7 @@ class Win32Video : public IVideo
|
|||
void BlankForGDI ();
|
||||
|
||||
void DumpAdapters ();
|
||||
void AddMode(int x, int y, int bits, int baseHeight, int doubling);
|
||||
|
||||
private:
|
||||
struct ModeInfo
|
||||
|
@ -102,13 +88,11 @@ class Win32Video : public IVideo
|
|||
int m_IteratorBits;
|
||||
bool m_IteratorFS;
|
||||
bool m_IsFullscreen;
|
||||
UINT m_Adapter;
|
||||
unsigned int m_Adapter;
|
||||
|
||||
void AddMode (int x, int y, int bits, int baseHeight, int doubling);
|
||||
void FreeModes ();
|
||||
|
||||
static HRESULT WINAPI EnumDDModesCB (LPDDSURFACEDESC desc, void *modes);
|
||||
void AddD3DModes (UINT adapter, D3DFORMAT format);
|
||||
void AddD3DModes (unsigned adapter);
|
||||
void AddLowResModes ();
|
||||
void AddLetterboxModes ();
|
||||
void ScaleModes (int doubling);
|
||||
|
@ -126,7 +110,7 @@ public:
|
|||
bool IsFullscreen () { return !Windowed; }
|
||||
virtual void Blank () = 0;
|
||||
virtual bool PaintToWindow () = 0;
|
||||
virtual HRESULT GetHR () = 0;
|
||||
virtual long/*HRESULT*/ GetHR () = 0; // HRESULT is a long in Windows but this header should not be polluted with windows.h just for this single definition
|
||||
virtual void ScaleCoordsFromWindow(int16_t &x, int16_t &y);
|
||||
|
||||
protected:
|
||||
|
@ -141,399 +125,5 @@ protected:
|
|||
BaseWinFB() {}
|
||||
};
|
||||
|
||||
class DDrawFB : public BaseWinFB
|
||||
{
|
||||
DECLARE_CLASS(DDrawFB, BaseWinFB)
|
||||
public:
|
||||
DDrawFB (int width, int height, bool fullscreen);
|
||||
~DDrawFB ();
|
||||
|
||||
bool IsValid ();
|
||||
bool Lock (bool buffer);
|
||||
void Unlock ();
|
||||
void ForceBuffering (bool force);
|
||||
void Update ();
|
||||
PalEntry *GetPalette ();
|
||||
void GetFlashedPalette (PalEntry pal[256]);
|
||||
void UpdatePalette ();
|
||||
bool SetGamma (float gamma);
|
||||
bool SetFlash (PalEntry rgb, int amount);
|
||||
void GetFlash (PalEntry &rgb, int &amount);
|
||||
int GetPageCount ();
|
||||
int QueryNewPalette ();
|
||||
void PaletteChanged ();
|
||||
void SetVSync (bool vsync);
|
||||
void NewRefreshRate();
|
||||
HRESULT GetHR ();
|
||||
bool Is8BitMode();
|
||||
virtual int GetTrueHeight() { return TrueHeight; }
|
||||
|
||||
void Blank ();
|
||||
bool PaintToWindow ();
|
||||
|
||||
private:
|
||||
enum LockSurfRes { NoGood, Good, GoodWasLost };
|
||||
|
||||
bool CreateResources ();
|
||||
void ReleaseResources ();
|
||||
bool CreateSurfacesAttached ();
|
||||
bool CreateSurfacesComplex ();
|
||||
bool CreateBlitterSource ();
|
||||
LockSurfRes LockSurf (LPRECT lockrect, LPDIRECTDRAWSURFACE surf);
|
||||
void RebuildColorTable ();
|
||||
void MaybeCreatePalette ();
|
||||
bool AddBackBuf (LPDIRECTDRAWSURFACE *surface, int num);
|
||||
HRESULT AttemptRestore ();
|
||||
|
||||
HRESULT LastHR;
|
||||
BYTE GammaTable[3][256];
|
||||
PalEntry SourcePalette[256];
|
||||
PALETTEENTRY PalEntries[256];
|
||||
DWORD FlipFlags;
|
||||
|
||||
LPDIRECTDRAWPALETTE Palette;
|
||||
LPDIRECTDRAWSURFACE PrimarySurf;
|
||||
LPDIRECTDRAWSURFACE BackSurf;
|
||||
LPDIRECTDRAWSURFACE BackSurf2;
|
||||
LPDIRECTDRAWSURFACE BlitSurf;
|
||||
LPDIRECTDRAWSURFACE LockingSurf;
|
||||
LPDIRECTDRAWCLIPPER Clipper;
|
||||
HPALETTE GDIPalette;
|
||||
DWORD ClipSize;
|
||||
PalEntry Flash;
|
||||
int FlashAmount;
|
||||
int BufferCount;
|
||||
int BufferPitch;
|
||||
int TrueHeight;
|
||||
int PixelDoubling;
|
||||
float Gamma;
|
||||
|
||||
bool NeedGammaUpdate;
|
||||
bool NeedPalUpdate;
|
||||
bool NeedResRecreate;
|
||||
bool PaletteChangeExpected;
|
||||
bool MustBuffer; // The screen is not 8-bit, or there is no backbuffer
|
||||
bool BufferingNow; // Most recent Lock was buffered
|
||||
bool WasBuffering; // Second most recent Lock was buffered
|
||||
bool Write8bit;
|
||||
bool UpdatePending; // On final unlock, call Update()
|
||||
bool UseBlitter; // Use blitter to copy from sys mem to video mem
|
||||
bool UsePfx;
|
||||
|
||||
DDrawFB() {}
|
||||
};
|
||||
|
||||
class D3DFB : public BaseWinFB
|
||||
{
|
||||
DECLARE_CLASS(D3DFB, BaseWinFB)
|
||||
public:
|
||||
D3DFB (UINT adapter, int width, int height, bool bgra, bool fullscreen);
|
||||
~D3DFB ();
|
||||
|
||||
bool IsValid ();
|
||||
bool Lock (bool buffered);
|
||||
void Unlock ();
|
||||
void Update ();
|
||||
void Flip ();
|
||||
PalEntry *GetPalette ();
|
||||
void GetFlashedPalette (PalEntry palette[256]);
|
||||
void UpdatePalette ();
|
||||
bool SetGamma (float gamma);
|
||||
bool SetFlash (PalEntry rgb, int amount);
|
||||
void GetFlash (PalEntry &rgb, int &amount);
|
||||
int GetPageCount ();
|
||||
bool IsFullscreen ();
|
||||
void PaletteChanged ();
|
||||
int QueryNewPalette ();
|
||||
void Blank ();
|
||||
bool PaintToWindow ();
|
||||
void SetVSync (bool vsync);
|
||||
void NewRefreshRate();
|
||||
void GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type);
|
||||
void ReleaseScreenshotBuffer();
|
||||
void SetBlendingRect (int x1, int y1, int x2, int y2);
|
||||
bool Begin2D (bool copy3d);
|
||||
void DrawBlendingRect ();
|
||||
FNativeTexture *CreateTexture (FTexture *gametex, bool wrapping);
|
||||
FNativePalette *CreatePalette (FRemapTable *remap);
|
||||
void DrawTextureParms (FTexture *img, DrawParms &parms);
|
||||
void Clear (int left, int top, int right, int bottom, int palcolor, uint32 color);
|
||||
void Dim (PalEntry color, float amount, int x1, int y1, int w, int h);
|
||||
void FlatFill (int left, int top, int right, int bottom, FTexture *src, bool local_origin);
|
||||
void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 realcolor);
|
||||
void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor);
|
||||
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip) override;
|
||||
bool WipeStartScreen(int type);
|
||||
void WipeEndScreen();
|
||||
bool WipeDo(int ticks);
|
||||
void WipeCleanup();
|
||||
HRESULT GetHR ();
|
||||
bool Is8BitMode() { return false; }
|
||||
virtual int GetTrueHeight() { return TrueHeight; }
|
||||
|
||||
private:
|
||||
friend class D3DTex;
|
||||
friend class D3DPal;
|
||||
|
||||
struct PackedTexture;
|
||||
struct Atlas;
|
||||
|
||||
struct FBVERTEX
|
||||
{
|
||||
FLOAT x, y, z, rhw;
|
||||
D3DCOLOR color0, color1;
|
||||
FLOAT tu, tv;
|
||||
};
|
||||
#define D3DFVF_FBVERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1)
|
||||
|
||||
struct BufferedTris
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
BYTE Flags;
|
||||
BYTE ShaderNum:4;
|
||||
BYTE BlendOp:4;
|
||||
BYTE SrcBlend, DestBlend;
|
||||
};
|
||||
DWORD Group1;
|
||||
};
|
||||
BYTE Desat;
|
||||
D3DPal *Palette;
|
||||
IDirect3DTexture9 *Texture;
|
||||
int NumVerts; // Number of _unique_ vertices used by this set.
|
||||
int NumTris; // Number of triangles used by this set.
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PSCONST_Desaturation = 1,
|
||||
PSCONST_PaletteMod = 2,
|
||||
PSCONST_Weights = 6,
|
||||
PSCONST_Gamma = 7,
|
||||
};
|
||||
enum
|
||||
{
|
||||
SHADER_NormalColor,
|
||||
SHADER_NormalColorPal,
|
||||
SHADER_NormalColorInv,
|
||||
SHADER_NormalColorPalInv,
|
||||
|
||||
SHADER_RedToAlpha,
|
||||
SHADER_RedToAlphaInv,
|
||||
|
||||
SHADER_VertexColor,
|
||||
|
||||
SHADER_SpecialColormap,
|
||||
SHADER_SpecialColormapPal,
|
||||
|
||||
SHADER_InGameColormap,
|
||||
SHADER_InGameColormapDesat,
|
||||
SHADER_InGameColormapInv,
|
||||
SHADER_InGameColormapInvDesat,
|
||||
SHADER_InGameColormapPal,
|
||||
SHADER_InGameColormapPalDesat,
|
||||
SHADER_InGameColormapPalInv,
|
||||
SHADER_InGameColormapPalInvDesat,
|
||||
|
||||
SHADER_BurnWipe,
|
||||
SHADER_GammaCorrection,
|
||||
|
||||
NUM_SHADERS
|
||||
};
|
||||
static const char *const ShaderNames[NUM_SHADERS];
|
||||
|
||||
void SetInitialState();
|
||||
bool CreateResources();
|
||||
void ReleaseResources();
|
||||
bool LoadShaders();
|
||||
void CreateBlockSurfaces();
|
||||
bool CreateFBTexture();
|
||||
bool CreatePaletteTexture();
|
||||
bool CreateGammaTexture();
|
||||
bool CreateVertexes();
|
||||
void DoOffByOneCheck();
|
||||
void UploadPalette();
|
||||
void UpdateGammaTexture(float igamma);
|
||||
void FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, bool vsync);
|
||||
void CalcFullscreenCoords (FBVERTEX verts[4], bool viewarea_only, bool can_double, D3DCOLOR color0, D3DCOLOR color1) const;
|
||||
bool Reset();
|
||||
IDirect3DTexture9 *GetCurrentScreen(D3DPOOL pool=D3DPOOL_SYSTEMMEM);
|
||||
void ReleaseDefaultPoolItems();
|
||||
void KillNativePals();
|
||||
void KillNativeTexs();
|
||||
PackedTexture *AllocPackedTexture(int width, int height, bool wrapping, D3DFORMAT format);
|
||||
void DrawPackedTextures(int packnum);
|
||||
void DrawLetterbox();
|
||||
void Draw3DPart(bool copy3d);
|
||||
bool SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &color1, BufferedTris &quad);
|
||||
static D3DBLEND GetStyleAlpha(int type);
|
||||
static void SetColorOverlay(DWORD color, float alpha, D3DCOLOR &color0, D3DCOLOR &color1);
|
||||
void DoWindowedGamma();
|
||||
void AddColorOnlyQuad(int left, int top, int width, int height, D3DCOLOR color);
|
||||
void AddColorOnlyRect(int left, int top, int width, int height, D3DCOLOR color);
|
||||
void CheckQuadBatch(int numtris=2, int numverts=4);
|
||||
void BeginQuadBatch();
|
||||
void EndQuadBatch();
|
||||
void BeginLineBatch();
|
||||
void EndLineBatch();
|
||||
void EndBatch();
|
||||
void CopyNextFrontBuffer();
|
||||
|
||||
D3DCAPS9 DeviceCaps;
|
||||
|
||||
// State
|
||||
void EnableAlphaTest(BOOL enabled);
|
||||
void SetAlphaBlend(D3DBLENDOP op, D3DBLEND srcblend=D3DBLEND(0), D3DBLEND destblend=D3DBLEND(0));
|
||||
void SetConstant(int cnum, float r, float g, float b, float a);
|
||||
void SetPixelShader(IDirect3DPixelShader9 *shader);
|
||||
void SetTexture(int tnum, IDirect3DTexture9 *texture);
|
||||
void SetPaletteTexture(IDirect3DTexture9 *texture, int count, D3DCOLOR border_color);
|
||||
void SetPalTexBilinearConstants(Atlas *texture);
|
||||
|
||||
BOOL AlphaTestEnabled;
|
||||
BOOL AlphaBlendEnabled;
|
||||
D3DBLENDOP AlphaBlendOp;
|
||||
D3DBLEND AlphaSrcBlend;
|
||||
D3DBLEND AlphaDestBlend;
|
||||
float Constant[3][4];
|
||||
D3DCOLOR CurBorderColor;
|
||||
IDirect3DPixelShader9 *CurPixelShader;
|
||||
IDirect3DTexture9 *Texture[5];
|
||||
|
||||
PalEntry SourcePalette[256];
|
||||
D3DCOLOR BorderColor;
|
||||
D3DCOLOR FlashColor0, FlashColor1;
|
||||
PalEntry FlashColor;
|
||||
int FlashAmount;
|
||||
int TrueHeight;
|
||||
int PixelDoubling;
|
||||
int SkipAt;
|
||||
int LBOffsetI;
|
||||
int RenderTextureToggle;
|
||||
int CurrRenderTexture;
|
||||
float LBOffset;
|
||||
float Gamma;
|
||||
bool UpdatePending;
|
||||
bool NeedPalUpdate;
|
||||
bool NeedGammaUpdate;
|
||||
int FBWidth, FBHeight;
|
||||
D3DFORMAT FBFormat;
|
||||
bool VSync;
|
||||
RECT BlendingRect;
|
||||
int In2D;
|
||||
bool InScene;
|
||||
bool SM14;
|
||||
bool GatheringWipeScreen;
|
||||
bool AALines;
|
||||
BYTE BlockNum;
|
||||
D3DPal *Palettes;
|
||||
D3DTex *Textures;
|
||||
Atlas *Atlases;
|
||||
HRESULT LastHR;
|
||||
|
||||
UINT Adapter;
|
||||
IDirect3DDevice9 *D3DDevice;
|
||||
IDirect3DTexture9 *FBTexture;
|
||||
IDirect3DTexture9 *TempRenderTexture, *RenderTexture[2];
|
||||
IDirect3DTexture9 *PaletteTexture;
|
||||
IDirect3DTexture9 *GammaTexture;
|
||||
IDirect3DTexture9 *ScreenshotTexture;
|
||||
IDirect3DSurface9 *ScreenshotSurface;
|
||||
IDirect3DSurface9 *FrontCopySurface;
|
||||
|
||||
IDirect3DVertexBuffer9 *VertexBuffer;
|
||||
FBVERTEX *VertexData;
|
||||
IDirect3DIndexBuffer9 *IndexBuffer;
|
||||
uint16_t *IndexData;
|
||||
BufferedTris *QuadExtra;
|
||||
int VertexPos;
|
||||
int IndexPos;
|
||||
int QuadBatchPos;
|
||||
enum { BATCH_None, BATCH_Quads, BATCH_Lines } BatchType;
|
||||
|
||||
IDirect3DPixelShader9 *Shaders[NUM_SHADERS];
|
||||
IDirect3DPixelShader9 *GammaShader;
|
||||
|
||||
IDirect3DSurface9 *BlockSurface[2];
|
||||
IDirect3DSurface9 *OldRenderTarget;
|
||||
IDirect3DTexture9 *InitialWipeScreen, *FinalWipeScreen;
|
||||
|
||||
D3DFB() {}
|
||||
|
||||
class Wiper
|
||||
{
|
||||
public:
|
||||
virtual ~Wiper();
|
||||
virtual bool Run(int ticks, D3DFB *fb) = 0;
|
||||
|
||||
void DrawScreen(D3DFB *fb, IDirect3DTexture9 *tex,
|
||||
D3DBLENDOP blendop=D3DBLENDOP(0), D3DCOLOR color0=0, D3DCOLOR color1=0xFFFFFFF);
|
||||
};
|
||||
|
||||
class Wiper_Melt; friend class Wiper_Melt;
|
||||
class Wiper_Burn; friend class Wiper_Burn;
|
||||
class Wiper_Crossfade; friend class Wiper_Crossfade;
|
||||
|
||||
Wiper *ScreenWipe;
|
||||
};
|
||||
|
||||
// Flags for a buffered quad
|
||||
enum
|
||||
{
|
||||
BQF_GamePalette = 1,
|
||||
BQF_CustomPalette = 7,
|
||||
BQF_Paletted = 7,
|
||||
BQF_Bilinear = 8,
|
||||
BQF_WrapUV = 16,
|
||||
BQF_InvertSource = 32,
|
||||
BQF_DisableAlphaTest= 64,
|
||||
BQF_Desaturated = 128,
|
||||
};
|
||||
|
||||
// Shaders for a buffered quad
|
||||
enum
|
||||
{
|
||||
BQS_PalTex,
|
||||
BQS_Plain,
|
||||
BQS_RedToAlpha,
|
||||
BQS_ColorOnly,
|
||||
BQS_SpecialColormap,
|
||||
BQS_InGameColormap,
|
||||
};
|
||||
|
||||
#if 0
|
||||
#define STARTLOG do { if (!dbg) dbg = fopen ("e:/vid.log", "w"); } while(0)
|
||||
#define STOPLOG do { if (dbg) { fclose (dbg); dbg=NULL; } } while(0)
|
||||
#define LOG(x) do { if (dbg) { fprintf (dbg, x); fflush (dbg); } } while(0)
|
||||
#define LOG1(x,y) do { if (dbg) { fprintf (dbg, x, y); fflush (dbg); } } while(0)
|
||||
#define LOG2(x,y,z) do { if (dbg) { fprintf (dbg, x, y, z); fflush (dbg); } } while(0)
|
||||
#define LOG3(x,y,z,zz) do { if (dbg) { fprintf (dbg, x, y, z, zz); fflush (dbg); } } while(0)
|
||||
#define LOG4(x,y,z,a,b) do { if (dbg) { fprintf (dbg, x, y, z, a, b); fflush (dbg); } } while(0)
|
||||
#define LOG5(x,y,z,a,b,c) do { if (dbg) { fprintf (dbg, x, y, z, a, b, c); fflush (dbg); } } while(0)
|
||||
extern FILE *dbg;
|
||||
#define VID_FILE_DEBUG 1
|
||||
#elif _DEBUG && 0
|
||||
#define STARTLOG
|
||||
#define STOPLOG
|
||||
#define LOG(x) { OutputDebugString(x); }
|
||||
#define LOG1(x,y) { char poo[1024]; mysnprintf(poo, countof(poo), x, y); OutputDebugString(poo); }
|
||||
#define LOG2(x,y,z) { char poo[1024]; mysnprintf(poo, countof(poo), x, y, z); OutputDebugString(poo); }
|
||||
#define LOG3(x,y,z,zz) { char poo[1024]; mysnprintf(poo, countof(poo), x, y, z, zz); OutputDebugString(poo); }
|
||||
#define LOG4(x,y,z,a,b) { char poo[1024]; mysnprintf(poo, countof(poo), x, y, z, a, b); OutputDebugString(poo); }
|
||||
#define LOG5(x,y,z,a,b,c) { char poo[1024]; mysnprintf(poo, countof(poo), x, y, z, a, b, c); OutputDebugString(poo); }
|
||||
#else
|
||||
#define STARTLOG
|
||||
#define STOPLOG
|
||||
#define LOG(x)
|
||||
#define LOG1(x,y)
|
||||
#define LOG2(x,y,z)
|
||||
#define LOG3(x,y,z,zz)
|
||||
#define LOG4(x,y,z,a,b)
|
||||
#define LOG5(x,y,z,a,b,c)
|
||||
#endif
|
||||
|
||||
#endif // __WIN32IFACE_H
|
||||
|
|
412
src/win32/win32swiface.h
Normal file
412
src/win32/win32swiface.h
Normal file
|
@ -0,0 +1,412 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef DIRECTDRAW_VERSION
|
||||
#define DIRECTDRAW_VERSION 0x0300
|
||||
#endif
|
||||
#ifndef DIRECT3D_VERSION
|
||||
#define DIRECT3D_VERSION 0x0900
|
||||
#endif
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ddraw.h>
|
||||
#include <d3d9.h>
|
||||
|
||||
#define SAFE_RELEASE(x) { if (x != NULL) { x->Release(); x = NULL; } }
|
||||
|
||||
extern HANDLE FPSLimitEvent;
|
||||
|
||||
class DDrawFB : public BaseWinFB
|
||||
{
|
||||
DECLARE_CLASS(DDrawFB, BaseWinFB)
|
||||
public:
|
||||
DDrawFB (int width, int height, bool fullscreen);
|
||||
~DDrawFB ();
|
||||
|
||||
bool IsValid ();
|
||||
bool Lock (bool buffer);
|
||||
void Unlock ();
|
||||
void ForceBuffering (bool force);
|
||||
void Update ();
|
||||
PalEntry *GetPalette ();
|
||||
void GetFlashedPalette (PalEntry pal[256]);
|
||||
void UpdatePalette ();
|
||||
bool SetGamma (float gamma);
|
||||
bool SetFlash (PalEntry rgb, int amount);
|
||||
void GetFlash (PalEntry &rgb, int &amount);
|
||||
int GetPageCount ();
|
||||
int QueryNewPalette ();
|
||||
void PaletteChanged ();
|
||||
void SetVSync (bool vsync);
|
||||
void NewRefreshRate();
|
||||
HRESULT GetHR ();
|
||||
bool Is8BitMode();
|
||||
virtual int GetTrueHeight() { return TrueHeight; }
|
||||
|
||||
void Blank ();
|
||||
bool PaintToWindow ();
|
||||
|
||||
private:
|
||||
enum LockSurfRes { NoGood, Good, GoodWasLost };
|
||||
|
||||
bool CreateResources ();
|
||||
void ReleaseResources ();
|
||||
bool CreateSurfacesAttached ();
|
||||
bool CreateSurfacesComplex ();
|
||||
bool CreateBlitterSource ();
|
||||
LockSurfRes LockSurf (LPRECT lockrect, LPDIRECTDRAWSURFACE surf);
|
||||
void RebuildColorTable ();
|
||||
void MaybeCreatePalette ();
|
||||
bool AddBackBuf (LPDIRECTDRAWSURFACE *surface, int num);
|
||||
HRESULT AttemptRestore ();
|
||||
|
||||
HRESULT LastHR;
|
||||
BYTE GammaTable[3][256];
|
||||
PalEntry SourcePalette[256];
|
||||
PALETTEENTRY PalEntries[256];
|
||||
DWORD FlipFlags;
|
||||
|
||||
LPDIRECTDRAWPALETTE Palette;
|
||||
LPDIRECTDRAWSURFACE PrimarySurf;
|
||||
LPDIRECTDRAWSURFACE BackSurf;
|
||||
LPDIRECTDRAWSURFACE BackSurf2;
|
||||
LPDIRECTDRAWSURFACE BlitSurf;
|
||||
LPDIRECTDRAWSURFACE LockingSurf;
|
||||
LPDIRECTDRAWCLIPPER Clipper;
|
||||
HPALETTE GDIPalette;
|
||||
DWORD ClipSize;
|
||||
PalEntry Flash;
|
||||
int FlashAmount;
|
||||
int BufferCount;
|
||||
int BufferPitch;
|
||||
int TrueHeight;
|
||||
int PixelDoubling;
|
||||
float Gamma;
|
||||
|
||||
bool NeedGammaUpdate;
|
||||
bool NeedPalUpdate;
|
||||
bool NeedResRecreate;
|
||||
bool PaletteChangeExpected;
|
||||
bool MustBuffer; // The screen is not 8-bit, or there is no backbuffer
|
||||
bool BufferingNow; // Most recent Lock was buffered
|
||||
bool WasBuffering; // Second most recent Lock was buffered
|
||||
bool Write8bit;
|
||||
bool UpdatePending; // On final unlock, call Update()
|
||||
bool UseBlitter; // Use blitter to copy from sys mem to video mem
|
||||
bool UsePfx;
|
||||
|
||||
DDrawFB() {}
|
||||
};
|
||||
|
||||
class D3DFB : public BaseWinFB
|
||||
{
|
||||
DECLARE_CLASS(D3DFB, BaseWinFB)
|
||||
public:
|
||||
D3DFB (UINT adapter, int width, int height, bool bgra, bool fullscreen);
|
||||
~D3DFB ();
|
||||
|
||||
bool IsValid ();
|
||||
bool Lock (bool buffered);
|
||||
void Unlock ();
|
||||
void Update ();
|
||||
void Flip ();
|
||||
PalEntry *GetPalette ();
|
||||
void GetFlashedPalette (PalEntry palette[256]);
|
||||
void UpdatePalette ();
|
||||
bool SetGamma (float gamma);
|
||||
bool SetFlash (PalEntry rgb, int amount);
|
||||
void GetFlash (PalEntry &rgb, int &amount);
|
||||
int GetPageCount ();
|
||||
bool IsFullscreen ();
|
||||
void PaletteChanged ();
|
||||
int QueryNewPalette ();
|
||||
void Blank ();
|
||||
bool PaintToWindow ();
|
||||
void SetVSync (bool vsync);
|
||||
void NewRefreshRate();
|
||||
void GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type);
|
||||
void ReleaseScreenshotBuffer();
|
||||
void SetBlendingRect (int x1, int y1, int x2, int y2);
|
||||
bool Begin2D (bool copy3d);
|
||||
void DrawBlendingRect ();
|
||||
FNativeTexture *CreateTexture (FTexture *gametex, bool wrapping);
|
||||
FNativePalette *CreatePalette (FRemapTable *remap);
|
||||
void DrawTextureParms (FTexture *img, DrawParms &parms);
|
||||
void Clear (int left, int top, int right, int bottom, int palcolor, uint32 color);
|
||||
void Dim (PalEntry color, float amount, int x1, int y1, int w, int h);
|
||||
void FlatFill (int left, int top, int right, int bottom, FTexture *src, bool local_origin);
|
||||
void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 realcolor);
|
||||
void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor);
|
||||
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip) override;
|
||||
bool WipeStartScreen(int type);
|
||||
void WipeEndScreen();
|
||||
bool WipeDo(int ticks);
|
||||
void WipeCleanup();
|
||||
HRESULT GetHR ();
|
||||
bool Is8BitMode() { return false; }
|
||||
virtual int GetTrueHeight() { return TrueHeight; }
|
||||
|
||||
private:
|
||||
friend class D3DTex;
|
||||
friend class D3DPal;
|
||||
|
||||
struct PackedTexture;
|
||||
struct Atlas;
|
||||
|
||||
struct FBVERTEX
|
||||
{
|
||||
FLOAT x, y, z, rhw;
|
||||
D3DCOLOR color0, color1;
|
||||
FLOAT tu, tv;
|
||||
};
|
||||
#define D3DFVF_FBVERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1)
|
||||
|
||||
struct BufferedTris
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
BYTE Flags;
|
||||
BYTE ShaderNum:4;
|
||||
BYTE BlendOp:4;
|
||||
BYTE SrcBlend, DestBlend;
|
||||
};
|
||||
DWORD Group1;
|
||||
};
|
||||
BYTE Desat;
|
||||
D3DPal *Palette;
|
||||
IDirect3DTexture9 *Texture;
|
||||
int NumVerts; // Number of _unique_ vertices used by this set.
|
||||
int NumTris; // Number of triangles used by this set.
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PSCONST_Desaturation = 1,
|
||||
PSCONST_PaletteMod = 2,
|
||||
PSCONST_Weights = 6,
|
||||
PSCONST_Gamma = 7,
|
||||
};
|
||||
enum
|
||||
{
|
||||
SHADER_NormalColor,
|
||||
SHADER_NormalColorPal,
|
||||
SHADER_NormalColorInv,
|
||||
SHADER_NormalColorPalInv,
|
||||
|
||||
SHADER_RedToAlpha,
|
||||
SHADER_RedToAlphaInv,
|
||||
|
||||
SHADER_VertexColor,
|
||||
|
||||
SHADER_SpecialColormap,
|
||||
SHADER_SpecialColormapPal,
|
||||
|
||||
SHADER_InGameColormap,
|
||||
SHADER_InGameColormapDesat,
|
||||
SHADER_InGameColormapInv,
|
||||
SHADER_InGameColormapInvDesat,
|
||||
SHADER_InGameColormapPal,
|
||||
SHADER_InGameColormapPalDesat,
|
||||
SHADER_InGameColormapPalInv,
|
||||
SHADER_InGameColormapPalInvDesat,
|
||||
|
||||
SHADER_BurnWipe,
|
||||
SHADER_GammaCorrection,
|
||||
|
||||
NUM_SHADERS
|
||||
};
|
||||
static const char *const ShaderNames[NUM_SHADERS];
|
||||
|
||||
void SetInitialState();
|
||||
bool CreateResources();
|
||||
void ReleaseResources();
|
||||
bool LoadShaders();
|
||||
void CreateBlockSurfaces();
|
||||
bool CreateFBTexture();
|
||||
bool CreatePaletteTexture();
|
||||
bool CreateGammaTexture();
|
||||
bool CreateVertexes();
|
||||
void DoOffByOneCheck();
|
||||
void UploadPalette();
|
||||
void UpdateGammaTexture(float igamma);
|
||||
void FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, bool vsync);
|
||||
void CalcFullscreenCoords (FBVERTEX verts[4], bool viewarea_only, bool can_double, D3DCOLOR color0, D3DCOLOR color1) const;
|
||||
bool Reset();
|
||||
IDirect3DTexture9 *GetCurrentScreen(D3DPOOL pool=D3DPOOL_SYSTEMMEM);
|
||||
void ReleaseDefaultPoolItems();
|
||||
void KillNativePals();
|
||||
void KillNativeTexs();
|
||||
PackedTexture *AllocPackedTexture(int width, int height, bool wrapping, D3DFORMAT format);
|
||||
void DrawPackedTextures(int packnum);
|
||||
void DrawLetterbox();
|
||||
void Draw3DPart(bool copy3d);
|
||||
bool SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &color1, BufferedTris &quad);
|
||||
static D3DBLEND GetStyleAlpha(int type);
|
||||
static void SetColorOverlay(DWORD color, float alpha, D3DCOLOR &color0, D3DCOLOR &color1);
|
||||
void DoWindowedGamma();
|
||||
void AddColorOnlyQuad(int left, int top, int width, int height, D3DCOLOR color);
|
||||
void AddColorOnlyRect(int left, int top, int width, int height, D3DCOLOR color);
|
||||
void CheckQuadBatch(int numtris=2, int numverts=4);
|
||||
void BeginQuadBatch();
|
||||
void EndQuadBatch();
|
||||
void BeginLineBatch();
|
||||
void EndLineBatch();
|
||||
void EndBatch();
|
||||
void CopyNextFrontBuffer();
|
||||
|
||||
D3DCAPS9 DeviceCaps;
|
||||
|
||||
// State
|
||||
void EnableAlphaTest(BOOL enabled);
|
||||
void SetAlphaBlend(D3DBLENDOP op, D3DBLEND srcblend=D3DBLEND(0), D3DBLEND destblend=D3DBLEND(0));
|
||||
void SetConstant(int cnum, float r, float g, float b, float a);
|
||||
void SetPixelShader(IDirect3DPixelShader9 *shader);
|
||||
void SetTexture(int tnum, IDirect3DTexture9 *texture);
|
||||
void SetPaletteTexture(IDirect3DTexture9 *texture, int count, D3DCOLOR border_color);
|
||||
void SetPalTexBilinearConstants(Atlas *texture);
|
||||
|
||||
BOOL AlphaTestEnabled;
|
||||
BOOL AlphaBlendEnabled;
|
||||
D3DBLENDOP AlphaBlendOp;
|
||||
D3DBLEND AlphaSrcBlend;
|
||||
D3DBLEND AlphaDestBlend;
|
||||
float Constant[3][4];
|
||||
D3DCOLOR CurBorderColor;
|
||||
IDirect3DPixelShader9 *CurPixelShader;
|
||||
IDirect3DTexture9 *Texture[5];
|
||||
|
||||
PalEntry SourcePalette[256];
|
||||
D3DCOLOR BorderColor;
|
||||
D3DCOLOR FlashColor0, FlashColor1;
|
||||
PalEntry FlashColor;
|
||||
int FlashAmount;
|
||||
int TrueHeight;
|
||||
int PixelDoubling;
|
||||
int SkipAt;
|
||||
int LBOffsetI;
|
||||
int RenderTextureToggle;
|
||||
int CurrRenderTexture;
|
||||
float LBOffset;
|
||||
float Gamma;
|
||||
bool UpdatePending;
|
||||
bool NeedPalUpdate;
|
||||
bool NeedGammaUpdate;
|
||||
int FBWidth, FBHeight;
|
||||
D3DFORMAT FBFormat;
|
||||
bool VSync;
|
||||
RECT BlendingRect;
|
||||
int In2D;
|
||||
bool InScene;
|
||||
bool SM14;
|
||||
bool GatheringWipeScreen;
|
||||
bool AALines;
|
||||
BYTE BlockNum;
|
||||
D3DPal *Palettes;
|
||||
D3DTex *Textures;
|
||||
Atlas *Atlases;
|
||||
HRESULT LastHR;
|
||||
|
||||
UINT Adapter;
|
||||
IDirect3DDevice9 *D3DDevice;
|
||||
IDirect3DTexture9 *FBTexture;
|
||||
IDirect3DTexture9 *TempRenderTexture, *RenderTexture[2];
|
||||
IDirect3DTexture9 *PaletteTexture;
|
||||
IDirect3DTexture9 *GammaTexture;
|
||||
IDirect3DTexture9 *ScreenshotTexture;
|
||||
IDirect3DSurface9 *ScreenshotSurface;
|
||||
IDirect3DSurface9 *FrontCopySurface;
|
||||
|
||||
IDirect3DVertexBuffer9 *VertexBuffer;
|
||||
FBVERTEX *VertexData;
|
||||
IDirect3DIndexBuffer9 *IndexBuffer;
|
||||
uint16_t *IndexData;
|
||||
BufferedTris *QuadExtra;
|
||||
int VertexPos;
|
||||
int IndexPos;
|
||||
int QuadBatchPos;
|
||||
enum { BATCH_None, BATCH_Quads, BATCH_Lines } BatchType;
|
||||
|
||||
IDirect3DPixelShader9 *Shaders[NUM_SHADERS];
|
||||
IDirect3DPixelShader9 *GammaShader;
|
||||
|
||||
IDirect3DSurface9 *BlockSurface[2];
|
||||
IDirect3DSurface9 *OldRenderTarget;
|
||||
IDirect3DTexture9 *InitialWipeScreen, *FinalWipeScreen;
|
||||
|
||||
D3DFB() {}
|
||||
|
||||
class Wiper
|
||||
{
|
||||
public:
|
||||
virtual ~Wiper();
|
||||
virtual bool Run(int ticks, D3DFB *fb) = 0;
|
||||
|
||||
void DrawScreen(D3DFB *fb, IDirect3DTexture9 *tex,
|
||||
D3DBLENDOP blendop=D3DBLENDOP(0), D3DCOLOR color0=0, D3DCOLOR color1=0xFFFFFFF);
|
||||
};
|
||||
|
||||
class Wiper_Melt; friend class Wiper_Melt;
|
||||
class Wiper_Burn; friend class Wiper_Burn;
|
||||
class Wiper_Crossfade; friend class Wiper_Crossfade;
|
||||
|
||||
Wiper *ScreenWipe;
|
||||
};
|
||||
|
||||
// Flags for a buffered quad
|
||||
enum
|
||||
{
|
||||
BQF_GamePalette = 1,
|
||||
BQF_CustomPalette = 7,
|
||||
BQF_Paletted = 7,
|
||||
BQF_Bilinear = 8,
|
||||
BQF_WrapUV = 16,
|
||||
BQF_InvertSource = 32,
|
||||
BQF_DisableAlphaTest= 64,
|
||||
BQF_Desaturated = 128,
|
||||
};
|
||||
|
||||
// Shaders for a buffered quad
|
||||
enum
|
||||
{
|
||||
BQS_PalTex,
|
||||
BQS_Plain,
|
||||
BQS_RedToAlpha,
|
||||
BQS_ColorOnly,
|
||||
BQS_SpecialColormap,
|
||||
BQS_InGameColormap,
|
||||
};
|
||||
|
||||
#if 0
|
||||
#define STARTLOG do { if (!dbg) dbg = fopen ("e:/vid.log", "w"); } while(0)
|
||||
#define STOPLOG do { if (dbg) { fclose (dbg); dbg=NULL; } } while(0)
|
||||
#define LOG(x) do { if (dbg) { fprintf (dbg, x); fflush (dbg); } } while(0)
|
||||
#define LOG1(x,y) do { if (dbg) { fprintf (dbg, x, y); fflush (dbg); } } while(0)
|
||||
#define LOG2(x,y,z) do { if (dbg) { fprintf (dbg, x, y, z); fflush (dbg); } } while(0)
|
||||
#define LOG3(x,y,z,zz) do { if (dbg) { fprintf (dbg, x, y, z, zz); fflush (dbg); } } while(0)
|
||||
#define LOG4(x,y,z,a,b) do { if (dbg) { fprintf (dbg, x, y, z, a, b); fflush (dbg); } } while(0)
|
||||
#define LOG5(x,y,z,a,b,c) do { if (dbg) { fprintf (dbg, x, y, z, a, b, c); fflush (dbg); } } while(0)
|
||||
extern FILE *dbg;
|
||||
#define VID_FILE_DEBUG 1
|
||||
#elif _DEBUG && 0
|
||||
#define STARTLOG
|
||||
#define STOPLOG
|
||||
#define LOG(x) { OutputDebugString(x); }
|
||||
#define LOG1(x,y) { char poo[1024]; mysnprintf(poo, countof(poo), x, y); OutputDebugString(poo); }
|
||||
#define LOG2(x,y,z) { char poo[1024]; mysnprintf(poo, countof(poo), x, y, z); OutputDebugString(poo); }
|
||||
#define LOG3(x,y,z,zz) { char poo[1024]; mysnprintf(poo, countof(poo), x, y, z, zz); OutputDebugString(poo); }
|
||||
#define LOG4(x,y,z,a,b) { char poo[1024]; mysnprintf(poo, countof(poo), x, y, z, a, b); OutputDebugString(poo); }
|
||||
#define LOG5(x,y,z,a,b,c) { char poo[1024]; mysnprintf(poo, countof(poo), x, y, z, a, b, c); OutputDebugString(poo); }
|
||||
#else
|
||||
#define STARTLOG
|
||||
#define STOPLOG
|
||||
#define LOG(x)
|
||||
#define LOG1(x,y)
|
||||
#define LOG2(x,y,z)
|
||||
#define LOG3(x,y,z,zz)
|
||||
#define LOG4(x,y,z,a,b)
|
||||
#define LOG5(x,y,z,a,b,c)
|
||||
#endif
|
|
@ -73,6 +73,7 @@
|
|||
#include "version.h"
|
||||
|
||||
#include "win32iface.h"
|
||||
#include "win32swiface.h"
|
||||
|
||||
#include "optwin32.h"
|
||||
|
||||
|
@ -223,8 +224,8 @@ bool Win32Video::InitD3D9 ()
|
|||
|
||||
// Enumerate available display modes.
|
||||
FreeModes ();
|
||||
AddD3DModes (m_Adapter, D3DFMT_X8R8G8B8);
|
||||
AddD3DModes (m_Adapter, D3DFMT_R5G6B5);
|
||||
AddD3DModes (m_Adapter);
|
||||
AddD3DModes (m_Adapter);
|
||||
if (Args->CheckParm ("-2"))
|
||||
{ // Force all modes to be pixel-doubled.
|
||||
ScaleModes (1);
|
||||
|
@ -253,6 +254,12 @@ closelib:
|
|||
return false;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI EnumDDModesCB(LPDDSURFACEDESC desc, void *data)
|
||||
{
|
||||
((Win32Video *)data)->AddMode(desc->dwWidth, desc->dwHeight, 8, desc->dwHeight, 0);
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
void Win32Video::InitDDraw ()
|
||||
{
|
||||
DIRECTDRAWCREATEFUNC directdraw_create;
|
||||
|
@ -436,23 +443,20 @@ void Win32Video::DumpAdapters()
|
|||
|
||||
// Mode enumeration --------------------------------------------------------
|
||||
|
||||
HRESULT WINAPI Win32Video::EnumDDModesCB (LPDDSURFACEDESC desc, void *data)
|
||||
void Win32Video::AddD3DModes (unsigned adapter)
|
||||
{
|
||||
((Win32Video *)data)->AddMode (desc->dwWidth, desc->dwHeight, 8, desc->dwHeight, 0);
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
void Win32Video::AddD3DModes (UINT adapter, D3DFORMAT format)
|
||||
{
|
||||
UINT modecount, i;
|
||||
D3DDISPLAYMODE mode;
|
||||
|
||||
modecount = D3D->GetAdapterModeCount (adapter, format);
|
||||
for (i = 0; i < modecount; ++i)
|
||||
for (D3DFORMAT format : { D3DFMT_X8R8G8B8, D3DFMT_R5G6B5})
|
||||
{
|
||||
if (D3D_OK == D3D->EnumAdapterModes (adapter, format, i, &mode))
|
||||
UINT modecount, i;
|
||||
D3DDISPLAYMODE mode;
|
||||
|
||||
modecount = D3D->GetAdapterModeCount(adapter, format);
|
||||
for (i = 0; i < modecount; ++i)
|
||||
{
|
||||
AddMode (mode.Width, mode.Height, 8, mode.Height, 0);
|
||||
if (D3D_OK == D3D->EnumAdapterModes(adapter, format, i, &mode))
|
||||
{
|
||||
AddMode(mode.Width, mode.Height, 8, mode.Height, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -843,3 +847,11 @@ static void StopFPSLimit()
|
|||
{
|
||||
I_SetFPSLimit(0);
|
||||
}
|
||||
|
||||
void I_FPSLimit()
|
||||
{
|
||||
if (FPSLimitEvent != NULL)
|
||||
{
|
||||
WaitForSingleObject(FPSLimitEvent, 1000);
|
||||
}
|
||||
}
|
|
@ -357,6 +357,18 @@ class BlockThingsIterator : Object native
|
|||
native bool Next();
|
||||
}
|
||||
|
||||
class BlockLinesIterator : Object native
|
||||
{
|
||||
native Line CurLine;
|
||||
native Vector3 position;
|
||||
native int portalflags;
|
||||
|
||||
native static BlockThingsIterator Create(Actor origin, double checkradius = -1);
|
||||
native static BlockThingsIterator CreateFromPos(Vector3 pos, double checkh, double checkradius, Sector sec = null);
|
||||
native bool Next();
|
||||
}
|
||||
|
||||
|
||||
struct DropItem native
|
||||
{
|
||||
native readonly DropItem Next;
|
||||
|
|
|
@ -285,13 +285,8 @@ class StaticEventHandler : Object native play version("2.4")
|
|||
{
|
||||
// static event handlers CAN register other static event handlers.
|
||||
// unlike EventHandler.Create that will not create them.
|
||||
clearscope static native StaticEventHandler Create(class<StaticEventHandler> type);
|
||||
clearscope static native StaticEventHandler CreateOnce(class<StaticEventHandler> type);
|
||||
clearscope static native StaticEventHandler Find(Class<StaticEventHandler> type); // just for convenience. who knows.
|
||||
|
||||
clearscope static native bool Register(StaticEventHandler handler);
|
||||
clearscope static native bool Unregister(StaticEventHandler handler);
|
||||
|
||||
// these are called when the handler gets registered or unregistered
|
||||
// you can set Order/IsUiProcessor here.
|
||||
virtual native void OnRegister();
|
||||
|
@ -306,11 +301,11 @@ class StaticEventHandler : Object native play version("2.4")
|
|||
virtual native void WorldThingDamaged(WorldEvent e);
|
||||
virtual native void WorldThingDestroyed(WorldEvent e);
|
||||
virtual native void WorldLightning(WorldEvent e); // for the sake of completeness.
|
||||
virtual native void WorldTick(WorldEvent e);
|
||||
virtual native void WorldTick();
|
||||
|
||||
//
|
||||
virtual native ui void RenderFrame(RenderEvent e);
|
||||
virtual native ui void RenderOverlay(RenderEvent e);
|
||||
//virtual native ui void RenderFrame(RenderEvent e);
|
||||
//virtual native ui void RenderOverlay(RenderEvent e);
|
||||
|
||||
//
|
||||
virtual native void PlayerEntered(PlayerEvent e);
|
||||
|
@ -321,6 +316,7 @@ class StaticEventHandler : Object native play version("2.4")
|
|||
//
|
||||
virtual native ui bool UiProcess(UiEvent e);
|
||||
virtual native ui bool InputProcess(InputEvent e);
|
||||
virtual native ui void UiTick();
|
||||
|
||||
//
|
||||
virtual native ui void ConsoleProcess(ConsoleEvent e);
|
||||
|
@ -339,12 +335,6 @@ class StaticEventHandler : Object native play version("2.4")
|
|||
|
||||
class EventHandler : StaticEventHandler native version("2.4")
|
||||
{
|
||||
clearscope static native StaticEventHandler Create(class<StaticEventHandler> type);
|
||||
clearscope static native StaticEventHandler CreateOnce(class<StaticEventHandler> type);
|
||||
clearscope static native StaticEventHandler Find(class<StaticEventHandler> type);
|
||||
|
||||
clearscope static native bool Register(StaticEventHandler handler);
|
||||
clearscope static native bool Unregister(StaticEventHandler handler);
|
||||
|
||||
clearscope static native void SendNetworkEvent(String name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
|
||||
}
|
||||
|
|
|
@ -440,3 +440,16 @@ struct Sector native play
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class SectorTagIterator : Object native
|
||||
{
|
||||
native static SectorTagIterator Create(int tag, line defline = null);
|
||||
native int Next();
|
||||
native int NextCompat(bool compat, int secnum);
|
||||
}
|
||||
|
||||
class LineIdIterator : Object native
|
||||
{
|
||||
native static LineIdIterator Create(int tag);
|
||||
native int Next();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue