- added project and namespace wrappers to all Exhumed files.

This commit is contained in:
Christoph Oelckers 2019-11-23 00:11:37 +01:00
parent 762ade3fd8
commit 0ad7f25a8a
117 changed files with 591 additions and 1306 deletions

View file

@ -866,7 +866,7 @@ if( UNIX )
endif()
endif()
target_link_libraries( demolition ${DEMOLITION_LIBS} gdtoa lzma duke3d blood rr sw zmusic )
target_link_libraries( demolition ${DEMOLITION_LIBS} gdtoa lzma duke3d blood rr sw exhumed zmusic )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}

View file

@ -14,6 +14,9 @@
#define BEGIN_SW_NS namespace ShadowWarrior {
#define END_SW_NS }
#define BEGIN_PS_NS namespace Powerslave {
#define END_PS_NS }
#else
#define BEGIN_DUKE_NS
@ -28,6 +31,9 @@
#define BEGIN_SW_NS
#define END_SW_NS
#define BEGIN_PS_NS
#define END_PS_NS
#endif
#ifndef APPNAME

View file

@ -0,0 +1,121 @@
cmake_minimum_required( VERSION 3.1.0 )
if (MSVC)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J" )
endif()
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../../build/include" )
if (WIN32)
include_directories( "${ZLIB_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include/vpx" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include/sdl2" )
else ()
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GDTOA_INCLUDE_DIR}")
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../build/include
${CMAKE_CURRENT_SOURCE_DIR}/../mact/include
${CMAKE_CURRENT_SOURCE_DIR}/../audiolib/include
${CMAKE_CURRENT_SOURCE_DIR}/../libsmackerdec/include
${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/include
${CMAKE_CURRENT_SOURCE_DIR}/../common
${CMAKE_CURRENT_SOURCE_DIR}/../common/utility
${CMAKE_CURRENT_SOURCE_DIR}/../common/console
${CMAKE_CURRENT_SOURCE_DIR}/../common/textures
${CMAKE_CURRENT_SOURCE_DIR}/../common/fonts
${CMAKE_CURRENT_SOURCE_DIR}/../common/2d
${CMAKE_CURRENT_SOURCE_DIR}/../common/music
${CMAKE_CURRENT_SOURCE_DIR}/../platform
)
#set( NOT_COMPILED_SOURCE_FILES
# src/gamestructures.cpp
#)
#set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE )
set( PCH_SOURCES
src/aistuff.cpp
src/anims.cpp
src/anubis.cpp
src/bubbles.cpp
src/bullet.cpp
src/cd.cpp
src/cdaudio.cpp
src/cdrom.cpp
src/config.cpp
src/enginesubs.cpp
src/exhumed.cpp
src/exscript.cpp
src/fish.cpp
src/grenade.cpp
src/grpscan.cpp
src/gun.cpp
src/init.cpp
src/input.cpp
src/items.cpp
src/lavadude.cpp
src/light.cpp
src/lighting.cpp
src/lion.cpp
src/main.cpp
src/map.cpp
src/menu.cpp
src/mono.cpp
src/move.cpp
src/movie.cpp
src/mummy.cpp
src/network.cpp
src/object.cpp
src/osdcmds.cpp
src/paul.cpp
src/player.cpp
src/queen.cpp
src/ra.cpp
src/random.cpp
src/rat.cpp
src/record.cpp
src/rex.cpp
src/roach.cpp
src/runlist.cpp
src/save.cpp
src/scorp.cpp
src/sequence.cpp
src/serial.cpp
src/set.cpp
src/snake.cpp
src/sound.cpp
src/spider.cpp
src/status.cpp
src/stream.cpp
src/switch.cpp
src/text2.cpp
src/timer.cpp
src/trigdat.cpp
src/version.cpp
src/view.cpp
src/wasp.cpp
)
if( MSVC )
enable_precompiled_headers( ../g_pch.h PCH_SOURCES )
# The original Build code was written with unsigned chars and unfortunately they still haven't been eliminated entirely.
# All other code should stay with signed chars. What a mess... :(
#set_source_files_properties( ${PCH_SOURCES} PROPERTIES COMPILE_FLAGS "/J" )
else()
# Temporary solution for compilers other than MSVC
set_source_files_properties( ${PCH_SOURCES} PROPERTIES COMPILE_FLAGS "-include g_pch.h" )
endif()
file( GLOB HEADER_FILES
src/*.h
)
add_library( exhumed STATIC
${HEADER_FILES}
${PCH_SOURCES}
#${NOT_COMPILED_SOURCE_FILES}
)

View file

@ -15,8 +15,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "aistuff.h"
BEGIN_PS_NS
extern int localclock;
int TimeSlot[KMaxTimeSlots];
@ -64,3 +67,4 @@ int GrabTimeSlot(int nVal)
}
#endif
}
END_PS_NS

View file

@ -39,9 +39,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "lavadude.h"
#include "bullet.h"
BEGIN_PS_NS
#define KMaxTimeSlots 16
void InitTimeSlot();
int GrabTimeSlot(int nVal);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "anims.h"
#include "sequence.h"
@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "init.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxAnims 400
short nMagicSeq = -1;
@ -329,3 +332,4 @@ int BuildSplash(int nSprite, int nSector)
return AnimList[nAnim].nSprite;
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
struct Anim
{
short nSeq;
@ -41,4 +43,6 @@ void FuncAnim(int, int, int);
void BuildExplosion(short nSprite);
int BuildSplash(int nSprite, int nSector);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "exhumed.h"
#include "anubis.h"
#include "engine.h"
@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "trigdat.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxAnubis 80
struct Anubis
@ -486,3 +488,4 @@ void FuncAnubis(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -21,9 +21,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
void InitAnubis();
int BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer);
void FuncAnubis(int a, int b, int c);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "bubbles.h"
#include "runlist.h"
#include "exhumed.h"
@ -29,6 +29,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "anims.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxBubbles 200
#define kMaxMachines 125
@ -238,3 +241,4 @@ void DoBubbles(int nPlayer)
sprite[nSprite].hitag = nPlayer;
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __bubbles_h__
#define __bubbles_h__
BEGIN_PS_NS
void InitBubbles();
void BuildBubbleMachine(int nSprite);
@ -27,4 +29,6 @@ void DoBubbleMachines();
void DoBubbles(int nPlayer);
void FuncBubble(int, int, int);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "bullet.h"
#include "runlist.h"
@ -40,6 +40,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdlib.h>
#endif
BEGIN_PS_NS
#define kMaxBullets 500
short BulletFree[kMaxBullets];
@ -848,3 +850,4 @@ void FuncBullet(int a, int b, int nRun)
}
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __bullet_h__
#define __bullet_h__
BEGIN_PS_NS
// 32 bytes
struct bulletInfo
{
@ -52,4 +54,6 @@ void IgniteSprite(int nSprite);
void FuncBullet(int, int, int);
void BackUpBullet(int *x, int *y, short nAngle);
END_PS_NS
#endif

View file

@ -15,13 +15,15 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "baselayer.h"
#include "cd.h"
#include <stdio.h>
#include <stdlib.h>
BEGIN_PS_NS
extern short word_9AC30;
int cd_check_device_present()
@ -71,4 +73,5 @@ int CDplaying()
void StopCD()
{
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __cd_h__
#define __cd_h__
BEGIN_PS_NS
int initcdaudio();
void setCDaudiovolume(int val);
int playCDtrack(int nTrack);
@ -27,4 +29,6 @@ int StepFadeCDaudio();
int CDplaying();
void StopCD();
END_PS_NS
#endif

View file

@ -15,9 +15,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "cdaudio.h"
BEGIN_PS_NS
int fadecdaudio()
{
/* TODO
@ -40,3 +42,4 @@ void CheckCD()
{
}
END_PS_NS

View file

@ -19,7 +19,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __cdaudio_h__
#define __cdaudio_h__
BEGIN_PS_NS
void CheckCD();
int fadecdaudio();
END_PS_NS
#endif

View file

@ -15,9 +15,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "cdrom.h"
BEGIN_PS_NS
int checkcdrom()
{
return 1;
@ -27,3 +29,4 @@ char GetCDDriveLetter()
{
return 'D';
}
END_PS_NS

View file

@ -19,7 +19,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __cdrom_h__
#define __cdrom_h__
BEGIN_PS_NS
int checkcdrom();
char GetCDDriveLetter();
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "renderlayer.h"
#include "_control.h"
@ -34,6 +34,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdio.h>
#include <time.h>
BEGIN_PS_NS
const char gamefunctions[kMaxGameFunctions][kMaxGameFuncLen] =
{
"Move_Forward",
@ -1016,3 +1018,4 @@ void CONFIG_WriteSetup(uint32_t flags)
CONFIG_WriteSettings();
Bfflush(NULL);
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
#define kMaxGameFunctions 40
#define kMaxGameFuncLen 64
@ -154,4 +156,6 @@ void CONFIG_SetDefaultKeys(const char(*keyptr)[kMaxGameFuncLen], bool lazy=false
void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2);
int32_t CONFIG_FunctionNameToNum(const char* func);
END_PS_NS
#endif

View file

@ -25,6 +25,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "typedefs.h"
#include "trigdat.h"
BEGIN_PS_NS
#define kMaxTiles 6144
#define kMaxSprites 4096
#define kMaxSectors 1024
@ -60,4 +62,6 @@ void resettiming();
void printext(int x, int y, const char* buffer, short tilenum, char invisiblecol);
void kensetpalette(unsigned char *vgapal);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
//#include <io.h>
@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// static int globhiz, globloz, globhihit, globlohit;
BEGIN_PS_NS
void overwritesprite(int thex, int they, short tilenum, signed char shade, char stat, char dapalnum)
{
@ -147,3 +149,4 @@ void precache()
}
}
}
END_PS_NS

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "baselayer.h"
#include "renderlayer.h"
@ -81,6 +81,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# include "winbits.h"
#endif /* _WIN32 */
BEGIN_PS_NS
#ifdef __cplusplus
extern "C" {
#endif
@ -4468,3 +4471,4 @@ int DoSpiritHead()
return 0;
}
#endif
END_PS_NS

View file

@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "vfs.h"
#include "grpscan.h"
BEGIN_PS_NS
#define kTimerTicks 120
#ifdef __WATCOMC__
@ -243,4 +245,6 @@ extern int loaddefinitions_game(const char* fn, int32_t preload);
void G_LoadGroupsInDir(const char* dirname);
void G_DoAutoload(const char* dirname);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
// Our replacement for the MACT scripting library as the one Exhumed/Powerslave uses is from an older version. This code is based on that older version
#include "typedefs.h"
@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <string.h>
#include <stdlib.h>
BEGIN_PS_NS
#if 0
// 16 bytes in size?
@ -439,3 +441,4 @@ void LoadScript(char *filename, int nVal)
}
#endif
END_PS_NS

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "fish.h"
#include "anims.h"
#include "engine.h"
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sound.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxFishes 128
#define kMaxChunks 128
@ -586,3 +588,4 @@ void FuncFish(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,10 +19,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __fish_h__
#define __fish_h__
BEGIN_PS_NS
void InitFishes();
int BuildFish(int nSprite, int x, int y, int z, int nSector, int nAngle);
void FuncFish(int, int, int);
void FuncFishLimb(int a, int b, int c);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "grenade.h"
#include "engine.h"
#include "player.h"
@ -32,6 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "random.h"
#include <assert.h>
BEGIN_PS_NS
int nGrenadeCount = 0;
int nGrenadesFree;
@ -434,3 +436,4 @@ void FuncGrenade(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __grenade_h__
#define __grenade_h__
BEGIN_PS_NS
#define kMaxGrenades 50
void InitGrenades();
@ -27,4 +29,6 @@ void DestroyGrenade(short nGrenade);
int ThrowGrenade(short nPlayer, int edx, int ebx, int ecx, int push1);
void FuncGrenade(int, int, int);
END_PS_NS
#endif

View file

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "baselayer.h"
#include "cache1d.h"
#include "exhumed.h"
@ -31,6 +31,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "vfs.h"
BEGIN_PS_NS
#ifndef EDUKE32_STANDALONE
static void process_vaca13(int32_t crcval);
static void process_vacapp15(int32_t crcval);
@ -470,3 +473,4 @@ void FreeGroups(void)
FreeGameList();
}
END_PS_NS

View file

@ -23,9 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef grpscan_h_
#define grpscan_h_
#ifdef __cplusplus
extern "C" {
#endif
BEGIN_PS_NS
#define MAXLISTNAMELEN 32
@ -77,8 +75,6 @@ extern grpfile_t * FindGroup(int32_t crcval);
int32_t ScanGroups(void);
void FreeGroups(void);
#ifdef __cplusplus
}
#endif
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "gun.h"
#include "engine.h"
#include "init.h"
@ -42,6 +42,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <string.h>
#include <assert.h>
BEGIN_PS_NS
/*
struct Weapon
{
@ -1120,3 +1122,4 @@ void DrawWeapons(int smooth)
}
}
}
END_PS_NS

View file

@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#include "sequence.h"
BEGIN_PS_NS
#define kMaxWeapons 7
enum
@ -64,4 +66,6 @@ void CheckClip(short nPlayer);
void MoveWeapons(short nPlayer);
void DrawWeapons(int smooth);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "keyboard.h"
#include "control.h"
@ -45,6 +45,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdio.h>
#include <string.h>
BEGIN_PS_NS
enum
{
kTagRamses = 61,
@ -1272,3 +1274,4 @@ int mysaveconfig()
fclose(fp);
return 1;
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
#define kMap20 20
enum {
@ -62,5 +64,6 @@ void LoadObjects();
int myloadconfig();
int mysaveconfig();
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "input.h"
#include "engine.h"
#include "exhumed.h"
@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "config.h"
#include <string.h>
BEGIN_PS_NS
int nNetMoves = 0;
short nInputStack = 0;
@ -228,4 +230,5 @@ int WaitAnyKey(int nSecs)
Name: _pStackPtr
Name: _sInputStack
*/
*/
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
enum {
kButtonJump = 0x1,
kButtonOpen = 0x4,
@ -63,4 +65,6 @@ void GetLocalInput();
extern PlayerInput sPlayerInput[];
extern int nNetMoves;
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "items.h"
#include "anims.h"
#include "player.h"
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "input.h"
#include "object.h"
BEGIN_PS_NS
struct AnimInfo
{
short a;
@ -495,3 +497,4 @@ void DoRegenerates()
}
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __items_h__
#define __items_h__
BEGIN_PS_NS
enum
{
kItemHeart = 0,
@ -49,4 +51,6 @@ void InitItems();
void StartRegenerate(short nSprite);
void DoRegenerates();
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "lavadude.h"
#include "random.h"
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sound.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxLavas 20
struct Lava
@ -514,3 +516,4 @@ void FuncLava(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,10 +19,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __lavadude_h__
#define __lavadude_h__
BEGIN_PS_NS
void InitLava();
int BuildLava(short nSprite, int x, int y, int z, short nSector, short nAngle, int lastArg);
int BuildLavaLimb(int nSprite, int edx, int ebx);
void FuncLavaLimb(int, int, int);
void FuncLava(int, int, int);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "light.h"
#include "engine.h"
#include "exhumed.h"
@ -26,6 +26,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdlib.h>
#include <string.h>
BEGIN_PS_NS
#define kMaxGrads 12
const char *GradList[kMaxGrads] = {
@ -745,3 +747,4 @@ void SetOverscan(int id)
DoOverscanSet(overscanindex);
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
void MyLoadPalette();
int LoadPaletteLookups();
void WaitVBL();
@ -41,4 +43,6 @@ extern char *origpalookup[];
extern short nPalDiff;
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "typedefs.h"
#include "lighting.h"
#include "player.h"
@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <string.h>
#include <assert.h>
BEGIN_PS_NS
#define kMaxFlashes 2000
#define kMaxFlickerMask 25
#define kMaxGlows 50
@ -776,3 +778,5 @@ void BuildFlash(short nPlayer, short nSector, int nVal)
flash = -nVal; // ???
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __lighting_h__
#define __lighting_h__
BEGIN_PS_NS
extern short nFlashDepth;
void InitLights();
@ -33,4 +35,6 @@ void AddFlicker(short nSector, int nVal);
extern short bTorch;
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "lion.h"
#include "engine.h"
#include "runlist.h"
@ -28,6 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "items.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxLions 40
short LionCount = -1;
@ -590,3 +592,4 @@ void FuncLion(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,8 +19,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __lion_h__
#define __lion_h__
BEGIN_PS_NS
void InitLion();
int BuildLion(short nSprite, int x, int y, int z, short nSector, short nAngle);
void FuncLion(int, int, int);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "typedefs.h"
#include <string.h>
#include "player.h"
@ -24,6 +24,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "exhumed.h"
#include "view.h"
BEGIN_PS_NS
short bShowTowers = kTrue; //kFalse; REVERT to kFalse
int ldMapZoom;
int lMapZoom;
@ -625,3 +628,4 @@ void DrawMap()
G_DrawOverheadMap(initx, inity, lMapZoom, inita);
}
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
extern short bShowTowers;
extern int ldMapZoom;
extern int lMapZoom;
@ -30,4 +32,6 @@ void GrabMap();
void UpdateMap();
void DrawMap();
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "build.h"
#include "exhumed.h"
@ -46,6 +46,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdlib.h>
#endif
BEGIN_PS_NS
#define kSaveFileName "savgamea.sav"
#define kMaxSaveSlots 5
#define kMaxSaveSlotChars 25
@ -2420,3 +2423,4 @@ LABEL_28:
MySetView(nViewLeft, nViewTop, nViewRight, nViewBottom);
MaskStatus();
}
END_PS_NS

View file

@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "typedefs.h"
#include <stdio.h>
BEGIN_PS_NS
#pragma pack(1)
// should be 75 bytes
struct GameStat
@ -74,4 +76,6 @@ void DoAfterCinemaScene(int nLevel);
void InitEnergyTile();
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
/*
Name: MonoClear_
address = 0001:0001CF5A
@ -66,5 +66,9 @@ kind: (data)
*/
#include "mono.h"
BEGIN_PS_NS
int rowCur = 0;
int colCur = 0;
END_PS_NS

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "exhumed.h"
#include "move.h"
@ -42,6 +42,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//#include <math.h>
#endif
BEGIN_PS_NS
short NearSector[kMaxSectors] = { 0 };
short nPushBlocks;
@ -1498,3 +1500,4 @@ short UpdateEnemy(short *nEnemy)
return *nEnemy;
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __move_h__
#define __move_h__
BEGIN_PS_NS
// 16 bytes
struct BlockInfo
{
@ -74,4 +76,6 @@ int AngleChase(int nSprite, int nSprite2, int ebx, int ecx, int push1);
void SetQuake(short nSprite, int nVal);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "exhumed.h"
#include "names.h"
@ -28,6 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "typedefs.h"
#include "keyboard.h"
BEGIN_PS_NS
enum {
kFramePalette = 0,
kFrameSound,
@ -235,3 +237,4 @@ void PlayMovie(const char *fileName)
fclose(fp);
}
END_PS_NS

View file

@ -19,6 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __movie_h__
#define __movie_h__
BEGIN_PS_NS
void PlayMovie(const char *fileName);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "mummy.h"
#include "sequence.h"
#include "move.h"
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <assert.h>
#include "engine.h"
BEGIN_PS_NS
short nMummies = -1;
struct Mummy
@ -526,3 +528,4 @@ void FuncMummy(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "runlist.h"
BEGIN_PS_NS
#define kMaxMummies 150
void InitMummy();
@ -28,4 +30,6 @@ int BuildMummy(int val, int x, int y, int z, int nSector, int angle);
void FuncMummy(int nSector, int edx, int nRun);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
// this is net.c in the original code
#include "typedefs.h"
@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "serial.h"
#include "input.h"
BEGIN_PS_NS
short nNetMoveFrames = 0;
@ -56,3 +58,4 @@ void UnInitNet()
{
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __network_h__
#define __network_h__
BEGIN_PS_NS
extern short nNetMoveFrames;
void SendGoodbye();
@ -28,4 +30,6 @@ int InitSerial();
void AbortNetworkPlay();
void UnInitNet();
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "object.h"
#include "exhumed.h"
@ -36,6 +36,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <string.h>
#include <assert.h>
BEGIN_PS_NS
#define kMaxBobs 200
#define kMaxDrips 50
#define kMaxMoveSects 50
@ -2672,3 +2674,4 @@ void PostProcess()
}
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __object_h__
#define __object_h__
BEGIN_PS_NS
#define kMaxPoints 1024
#define kMaxSlides 128
#define kMaxElevs 1024
@ -83,4 +85,6 @@ int BuildWallFace(short nChannel, short nWall, short nCount, ...);
int BuildSlide(int nChannel, int edx, int ebx, int ecx, int arg1, int arg2, int arg3);
END_PS_NS
#endif

View file

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "build.h"
#include "common.h"
@ -31,6 +31,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "vfs.h"
BEGIN_PS_NS
static inline int osdcmd_quit(osdcmdptr_t UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
@ -123,27 +126,6 @@ static int osdcmd_initgroupfile(osdcmdptr_t parm)
void onvideomodechange(int32_t newmode)
{
uint8_t palid = BASEPAL;
#if 0
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
{
int32_t i = 0;
while (i < MAXSPRITES)
{
if (actor[i].lightptr)
{
polymer_deletelight(actor[i].lightId);
actor[i].lightptr = NULL;
actor[i].lightId = -1;
}
i++;
}
}
#endif
#endif
videoSetPalette(0, palid, 0);
}
@ -160,207 +142,6 @@ static int osdcmd_button(osdcmdptr_t parm)
return OSDCMD_OK;
}
const char *const ConsoleButtons[] =
{
"mouse1", "mouse2", "mouse3", "mouse4", "mwheelup",
"mwheeldn", "mouse5", "mouse6", "mouse7", "mouse8"
};
static int osdcmd_bind(osdcmdptr_t parm)
{
char tempbuf[256];
if (parm->numparms==1 && !Bstrcasecmp(parm->parms[0],"showkeys"))
{
for (auto & s : sctokeylut)
OSD_Printf("%s\n", s.key);
for (auto ConsoleButton : ConsoleButtons)
OSD_Printf("%s\n",ConsoleButton);
return OSDCMD_OK;
}
if (parm->numparms==0)
{
int j=0;
OSD_Printf("Current key bindings:\n");
for (int i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
if (CONTROL_KeyIsBound(i))
{
j++;
OSD_Printf("%-9s %s\"%s\"\n", CONTROL_KeyBinds[i].key, CONTROL_KeyBinds[i].repeat?"":"norepeat ",
CONTROL_KeyBinds[i].cmdstr);
}
if (j == 0)
OSD_Printf("No binds found.\n");
return OSDCMD_OK;
}
int i, j, repeat;
for (i=0; i < ARRAY_SSIZE(sctokeylut); i++)
{
if (!Bstrcasecmp(parm->parms[0], sctokeylut[i].key))
break;
}
// didn't find the key
if (i == ARRAY_SSIZE(sctokeylut))
{
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (!Bstrcasecmp(parm->parms[0],ConsoleButtons[i]))
break;
if (i >= MAXMOUSEBUTTONS)
return OSDCMD_SHOWHELP;
if (parm->numparms < 2)
{
if (CONTROL_KeyBinds[MAXBOUNDKEYS + i].cmdstr && CONTROL_KeyBinds[MAXBOUNDKEYS + i ].key)
OSD_Printf("%-9s %s\"%s\"\n", ConsoleButtons[i], CONTROL_KeyBinds[MAXBOUNDKEYS + i].repeat?"":"norepeat ",
CONTROL_KeyBinds[MAXBOUNDKEYS + i].cmdstr);
else OSD_Printf("%s is unbound\n", ConsoleButtons[i]);
return OSDCMD_OK;
}
j = 1;
repeat = 1;
if (!Bstrcasecmp(parm->parms[j],"norepeat"))
{
repeat = 0;
j++;
}
Bstrcpy(tempbuf,parm->parms[j++]);
for (; j<parm->numparms; j++)
{
Bstrcat(tempbuf," ");
Bstrcat(tempbuf,parm->parms[j++]);
}
CONTROL_BindMouse(i, tempbuf, repeat, ConsoleButtons[i]);
if (!OSD_ParsingScript())
OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK;
}
if (parm->numparms < 2)
{
if (CONTROL_KeyIsBound(sctokeylut[i].sc))
OSD_Printf("%-9s %s\"%s\"\n", sctokeylut[i].key, CONTROL_KeyBinds[sctokeylut[i].sc].repeat?"":"norepeat ",
CONTROL_KeyBinds[sctokeylut[i].sc].cmdstr);
else OSD_Printf("%s is unbound\n", sctokeylut[i].key);
return OSDCMD_OK;
}
j = 1;
repeat = 1;
if (!Bstrcasecmp(parm->parms[j],"norepeat"))
{
repeat = 0;
j++;
}
Bstrcpy(tempbuf,parm->parms[j++]);
for (; j<parm->numparms; j++)
{
Bstrcat(tempbuf," ");
Bstrcat(tempbuf,parm->parms[j++]);
}
CONTROL_BindKey(sctokeylut[i].sc, tempbuf, repeat, sctokeylut[i].key);
char *cp = tempbuf;
// Populate the keyboard config menu based on the bind.
// Take care of processing one-to-many bindings properly, too.
static char const s_gamefunc_[] = "gamefunc_";
int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1;
while ((cp = Bstrstr(cp, s_gamefunc_)))
{
cp += strlen_gamefunc_;
char *semi = Bstrchr(cp, ';');
if (semi)
*semi = 0;
j = CONFIG_FunctionNameToNum(cp);
if (semi)
cp = semi+1;
if (j != -1)
{
KeyboardKeys[j][1] = KeyboardKeys[j][0];
KeyboardKeys[j][0] = sctokeylut[i].sc;
// CONTROL_MapKey(j, sctokeylut[i].sc, ud.config.KeyboardKeys[j][0]);
if (j == gamefunc_Show_Console)
OSD_CaptureKey(sctokeylut[i].sc);
}
}
if (!OSD_ParsingScript())
OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK;
}
static int osdcmd_unbindall(osdcmdptr_t UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
for (int i = 0; i < MAXBOUNDKEYS; ++i)
CONTROL_FreeKeyBind(i);
for (int i = 0; i < MAXMOUSEBUTTONS; ++i)
CONTROL_FreeMouseBind(i);
for (auto &KeyboardKey : KeyboardKeys)
KeyboardKey[0] = KeyboardKey[1] = 0xff;
if (!OSD_ParsingScript())
OSD_Printf("unbound all controls\n");
return OSDCMD_OK;
}
static int osdcmd_unbind(osdcmdptr_t parm)
{
if (parm->numparms != 1)
return OSDCMD_SHOWHELP;
for (auto & ConsoleKey : sctokeylut)
{
if (ConsoleKey.key && !Bstrcasecmp(parm->parms[0], ConsoleKey.key))
{
CONTROL_FreeKeyBind(ConsoleKey.sc);
OSD_Printf("unbound key %s\n", ConsoleKey.key);
return OSDCMD_OK;
}
}
for (int i = 0; i < MAXMOUSEBUTTONS; i++)
{
if (!Bstrcasecmp(parm->parms[0], ConsoleButtons[i]))
{
CONTROL_FreeMouseBind(i);
OSD_Printf("unbound %s\n", ConsoleButtons[i]);
return OSDCMD_OK;
}
}
return OSDCMD_SHOWHELP;
}
static int osdcmd_unbound(osdcmdptr_t parm)
{
if (parm->numparms != 1)
@ -392,31 +173,12 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm)
if (r != OSDCMD_OK) return r;
// TODO:
/*if (!Bstrcasecmp(parm->name, "r_upscalefactor"))
{
if (in3dmode())
{
videoSetGameMode(fullscreen, xres, yres, bpp, ud.detail);
}
}
else if (!Bstrcasecmp(parm->name, "r_size"))
{
ud.statusbarmode = (ud.screen_size < 8);
G_UpdateScreenArea();
}*/
else if (!Bstrcasecmp(parm->name, "r_maxfps") || !Bstrcasecmp(parm->name, "r_maxfpsoffset"))
if (!Bstrcasecmp(parm->name, "r_maxfps") || !Bstrcasecmp(parm->name, "r_maxfpsoffset"))
{
if (r_maxfps != 0) r_maxfps = clamp(r_maxfps, 30, 1000);
g_frameDelay = calcFrameDelay(r_maxfps + r_maxfpsoffset);
}/*
else if (!Bstrcasecmp(parm->name, "r_ambientlight"))
{
if (r_ambientlight == 0)
r_ambientlightrecip = 256.f;
else r_ambientlightrecip = 1.f/r_ambientlight;
}
else */if (!Bstrcasecmp(parm->name, "in_mouse"))
if (!Bstrcasecmp(parm->name, "in_mouse"))
{
CONTROL_MouseEnabled = (gSetup.usemouse && CONTROL_MousePresent);
}
@ -424,91 +186,6 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm)
{
CONTROL_JoystickEnabled = (gSetup.usejoystick && CONTROL_JoyPresent);
}
else if (!Bstrcasecmp(parm->name, "vid_gamma"))
{
// TODO
//ud.brightness = GAMMA_CALC;
//ud.brightness <<= 2;
//videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
}
else if (!Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast"))
{
// TODO
//videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
}
//else if (!Bstrcasecmp(parm->name, "hud_scale")
// || !Bstrcasecmp(parm->name, "hud_statusbarmode")
// || !Bstrcasecmp(parm->name, "r_rotatespritenowidescreen"))
//{
// G_UpdateScreenArea();
//}
//else if (!Bstrcasecmp(parm->name, "skill"))
//{
// if (numplayers > 1)
// return r;
//
// ud.player_skill = ud.m_player_skill;
//}
//else if (!Bstrcasecmp(parm->name, "color"))
//{
// ud.color = G_CheckPlayerColor(ud.color);
// g_player[0].ps->palookup = g_player[0].pcolor = ud.color;
//}
//else if (!Bstrcasecmp(parm->name, "osdscale"))
//{
// osdrscale = 1.f/osdscale;
//
// if (xdim && ydim)
// OSD_ResizeDisplay(xdim, ydim);
//}
//else if (!Bstrcasecmp(parm->name, "wchoice"))
//{
// if (parm->numparms == 1)
// {
// if (g_forceWeaponChoice) // rewrite ud.wchoice because osdcmd_cvar_set already changed it
// {
// int j = 0;
//
// while (j < 10)
// {
// ud.wchoice[j] = g_player[myconnectindex].wchoice[j] + '0';
// j++;
// }
//
// ud.wchoice[j] = 0;
// }
// else
// {
// char const *c = parm->parms[0];
//
// if (*c)
// {
// int j = 0;
//
// while (*c && j < 10)
// {
// g_player[myconnectindex].wchoice[j] = *c - '0';
// c++;
// j++;
// }
//
// while (j < 10)
// {
// if (j == 9)
// g_player[myconnectindex].wchoice[9] = 1;
// else
// g_player[myconnectindex].wchoice[j] = 2;
//
// j++;
// }
// }
// }
//
// g_forceWeaponChoice = 0;
// }
//
// /* Net_SendClientInfo();*/
//}
return r;
}
@ -699,22 +376,6 @@ int32_t registerosdcommands(void)
//OSD_RegisterFunction("activatecheat","activatecheat <id>: activates a cheat code", osdcmd_activatecheat);
OSD_RegisterFunction("initgroupfile","initgroupfile <path>: adds a grp file into the game filesystem", osdcmd_initgroupfile);
//#ifdef DEBUGGINGAIDS
// OSD_RegisterFunction("inittimer","debug", osdcmd_inittimer);
//#endif
//OSD_RegisterFunction("music","music E<ep>L<lev>: change music", osdcmd_music);
//OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
//OSD_RegisterFunction("printtimes", "printtimes: prints VM timing statistics", osdcmd_printtimes);
//OSD_RegisterFunction("purgesaves", "purgesaves: deletes obsolete and unreadable save files", osdcmd_purgesaves);
//OSD_RegisterFunction("quicksave","quicksave: performs a quick save", osdcmd_quicksave);
//OSD_RegisterFunction("quickload","quickload: performs a quick load", osdcmd_quickload);
OSD_RegisterFunction("quit","quit: exits the game immediately", osdcmd_quit);
OSD_RegisterFunction("exit","exit: exits the game immediately", osdcmd_quit);
//OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap);
//OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound);
@ -723,8 +384,6 @@ int32_t registerosdcommands(void)
//OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
OSD_RegisterFunction("unbind","unbind <key>: unbinds a key", osdcmd_unbind);
OSD_RegisterFunction("unbindall","unbindall: unbinds all keys", osdcmd_unbindall);
OSD_RegisterFunction("unbound", NULL, osdcmd_unbound);
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
@ -753,3 +412,4 @@ void GAME_clearbackground(int numcols, int numrows)
COMMON_clearbackground(numcols, numrows);
}
END_PS_NS

View file

@ -23,9 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef osdcmds_h_
#define osdcmds_h_
#ifdef __cplusplus
extern "C" {
#endif
BEGIN_PS_NS
int32_t registerosdcommands(void);
void onvideomodechange(int32_t newmode);
@ -38,9 +37,7 @@ extern const char *const ConsoleButtons[];
//extern uint32_t cl_cheatmask;
#ifdef __cplusplus
}
#endif
END_PS_NS
#endif // osdcmds_h_

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "player.h"
#include "runlist.h"
@ -53,6 +53,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdio.h>
#include <string.h>
BEGIN_PS_NS
struct PlayerSave
{
int x;
@ -3350,3 +3352,4 @@ do_default_b:
}
}
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
void PlayerInterruptKeys();
void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short *nAngle);
void SetSavePoint(int nPlayer, int x, int y, int z, short nSector, short nAngle);
@ -123,4 +125,6 @@ void SetPlayerMummified(int nPlayer, int bIsMummified);
int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount);
void ShootStaff(int nPlayer);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "exhumed.h"
#include "aistuff.h"
#include "engine.h"
@ -32,6 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "names.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxQueens 1
#define kMaxEggs 10
#define kMaxTails 7
@ -1482,3 +1484,4 @@ void FuncQueen(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __queen_h__
#define __queen_h__
BEGIN_PS_NS
void InitQueens();
int BuildQueen(int nSprite, int x, int y, int z, int nSector, int nAngle, int nVal);
@ -27,4 +29,6 @@ void FuncQueenEgg(int, int, int);
void FuncQueenHead(int, int, int);
void FuncQueen(int, int, int);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "ra.h"
#include "runlist.h"
#include "engine.h"
@ -28,6 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "bullet.h"
#include <string.h>
BEGIN_PS_NS
/* bjd - the content of the ra.* files originally resided in gun.c I think... */
//#define kMaxRA 8
@ -291,3 +293,4 @@ void FuncRa(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __ra_h__
#define __ra_h__
BEGIN_PS_NS
struct RA
{
short field_0;
@ -39,4 +41,6 @@ void InitRa();
void MoveRaToEnemy(short nPlayer);
void FuncRa(int, int, int);
END_PS_NS
#endif

View file

@ -15,9 +15,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "random.h"
BEGIN_PS_NS
int randA = 0;
int randB = 0x11111111;
int randC = 0x1010101;
@ -78,3 +80,4 @@ int RandomSize(int nSize)
return randSize;
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __random_h__
#define __random_h__
BEGIN_PS_NS
void InitRandom();
int RandomBit();
char RandomByte();
@ -26,4 +28,6 @@ short RandomWord();
int RandomLong();
int RandomSize(int nSize);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "rat.h"
#include "sequence.h"
@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "move.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxRats 50
short nMinChunk;
@ -398,3 +400,4 @@ void FuncRat(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,10 +19,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __rat_h__
#define __rat_h__
BEGIN_PS_NS
void InitRats();
void SetRatVel(short nSprite);
int BuildRat(short nSprite, int x, int y, int z, short nSector, int nAngle);
int FindFood(short nSprite);
void FuncRat(int a, int b, int nRun);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "record.h"
#include "typedefs.h"
@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdio.h>
#include <string.h>
BEGIN_PS_NS
short record_mode = 0;
int record_limit = -1;
int record_index = 16384;
@ -168,3 +170,4 @@ int CloseRecord()
fclose(record_file);
return 1;
}
END_PS_NS

View file

@ -19,6 +19,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __record_h__
#define __record_h__
BEGIN_PS_NS
extern short record_mode;
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "rex.h"
#include "exhumed.h"
#include "engine.h"
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "aistuff.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxRex 50
short RexCount = 0;
@ -475,3 +477,4 @@ void FuncRex(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,8 +19,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __rex_h__
#define __rex_h__
BEGIN_PS_NS
void InitRexs();
int BuildRex(short nSprite, int x, int y, int z, short nSector, short nAngle, int nVal);
void FuncRex(int, int, int);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "exhumed.h"
#include "engine.h"
#include "runlist.h"
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "items.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxRoach 100
int16_t RoachSprite = -1;
@ -409,3 +411,4 @@ void FuncRoach(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,8 +19,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __roach_h__
#define __roach_h__
BEGIN_PS_NS
void InitRoachs();
int BuildRoach(int nType, int nSprite, int x, int y, int z, short nSector, int angle);
void FuncRoach(int a, int nDamage, int nRun);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "exhumed.h"
#include "engine.h"
#include "runlist.h"
@ -49,6 +49,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "lighting.h"
#include <assert.h>
BEGIN_PS_NS
//#define kFuncMax 0x260000 // the number 38 stored in the high word of an int
#define kFuncMax 39
#define kMaxRunStack 200
@ -1844,3 +1846,4 @@ void runlist_DamageEnemy(int nSprite, int nSprite2, short nDamage)
nTauntTimer[nPlayer] = RandomSize(3) + 3;
}
}
END_PS_NS

View file

@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
#define kMaxRuns 25600
#define kMaxChannels 4096
@ -78,4 +81,6 @@ void runlist_SignalRun(int NxtPtr, int edx);
void runlist_CleanRunRecs();
void runlist_ExecObjects();
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "save.h"
#include <stdio.h>
//#include <fcntl.h>
@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//#include <io.h>
#include "engine.h"
BEGIN_PS_NS
int savegame(int nSlot)
{
char filename[92];
@ -119,3 +121,4 @@ int loadgame(int nSlot)
return 1; // CHECKME
}
END_PS_NS

View file

@ -19,7 +19,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __save_h__
#define __save_h__
BEGIN_PS_NS
int savegame(int nSlot);
int loadgame(int nSlot);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "scorp.h"
#include "runlist.h"
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "spider.h"
#include <assert.h>
BEGIN_PS_NS
/*
Selkis Boss AI code
*/
@ -503,3 +505,4 @@ FS_Red:
sprite[nSprite].yvel = 0;
}
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
/*
Selkis Boss AI code
*/
@ -44,4 +46,6 @@ void InitScorp();
int BuildScorp(short nSprite, int x, int y, int z, short nSector, short nAngle, int nChannel);
void FuncScorp(int, int, int);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "typedefs.h"
#include "sequence.h"
#include "engine.h"
@ -38,6 +38,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// TEMP
#include <assert.h>
BEGIN_PS_NS
#define kMaxSequences 4096
#define kMaxSEQFiles 78
#define kMaxSEQFrames 18000
@ -665,3 +667,4 @@ int seq_PlotSequence(short nSprite, short edx, short nFrame, short ecx)
return nPict;
}
END_PS_NS

View file

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
BEGIN_PS_NS
enum {
kSeqRothands = 0,
kSeqSword,
@ -140,4 +142,6 @@ int seq_PlotSequence(short nSprite, short edx, short nFrame, short ecx);
int seq_PlotArrowSequence(short nSprite, short nSeq, int nVal);
void seq_DrawPilotLightSeq(int xOffset, int yOffset);
END_PS_NS
#endif

View file

@ -15,10 +15,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "typedefs.h"
#include "serial.h"
BEGIN_PS_NS
short bSendBye = kFalse;
@ -41,3 +43,4 @@ void UnInitSerial()
{
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __serial_h__
#define __serial_h__
BEGIN_PS_NS
extern short bSendBye;
void UpdateSerialInputs();
@ -26,4 +28,6 @@ void ClearSerialInbuf();
void HangUp();
void UnInitSerial();
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "set.h"
#include "engine.h"
#include "exhumed.h"
@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "bullet.h"
#include <assert.h>
BEGIN_PS_NS
#define kMaxSets 10
short SetCount = 0;
@ -685,3 +687,4 @@ void FuncSet(int a, int nDamage, int nRun)
}
}
}
END_PS_NS

View file

@ -19,9 +19,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __set_h__
#define __set_h__
BEGIN_PS_NS
void InitSets();
int BuildSet(short nSprite, int x, int y, int z, short nSector, short nAngle, int nVal);
void FuncSoul(int, int, int);
void FuncSet(int, int, int);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "engine.h"
#include "exhumed.h"
#include "snake.h"
@ -34,6 +34,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <string.h>
#include <assert.h>
BEGIN_PS_NS
#define kMaxSnakes 50
int nSnakeCount = 0;
@ -422,3 +424,4 @@ SEARCH_ENEMY:
}
}
}
END_PS_NS

View file

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __snake_h__
#define __snake_h__
BEGIN_PS_NS
#define kSnakeSprites 8 // or rename to kSnakeParts?
// 32bytes
@ -53,4 +55,6 @@ short GrabSnake();
int BuildSnake(short nPlayer, short zVal);
void FuncSnake(int, int, int);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "baselayer.h"
#include "renderlayer.h" // for win_gethwnd()
@ -36,6 +36,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "trigdat.h"
#include "sequence.h"
BEGIN_PS_NS
#if 0
extern "C" {
#include "usrhooks.h"
@ -1259,3 +1261,4 @@ void Unlock(void)
}
#endif
END_PS_NS

View file

@ -19,6 +19,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __sound_h__
#define __sound_h__
BEGIN_PS_NS
#define kMaxSoundFiles 80
#define kMaxSounds 200
#define kMaxSoundNameLen 8
@ -143,4 +146,6 @@ void PlayGameOverSound(void);
void SoundBigEntrance(void);
END_PS_NS
#endif

View file

@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "exhumed.h"
#include "spider.h"
#include "engine.h"
@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "trigdat.h"
#include <assert.h>
BEGIN_PS_NS
short SpiderSprite = -1;
short SpiderCount = 0;
@ -432,3 +434,4 @@ case_3:
}
}
}
END_PS_NS

View file

@ -19,8 +19,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __spider_h__
#define __spider_h__
BEGIN_PS_NS
void InitSpider();
int BuildSpider(int nSprite, int x, int y, int z, short nSector, int angle);
void FuncSpider(int a, int b, int nRun);
END_PS_NS
#endif

View file

@ -1,887 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010 EDuke32 developers and contributors
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "build.h"
#include "common.h"
#include "compat.h"
#include "keyboard.h"
#include "control.h"
#include "config.h"
#include "exhumed.h"
#include "dynamicgtk.h"
#include "grpscan.h"
#include "gtkpixdata.h"
enum
{
NONE,
ALL,
POPULATE_VIDEO,
POPULATE_CONFIG,
POPULATE_GAME,
};
enum
{
TAB_CONFIG,
TAB_GAME,
TAB_MESSAGES,
};
enum
{
INPUT_KB,
INPUT_MOUSE,
INPUT_JOYSTICK,
INPUT_ALL,
};
static struct
{
GtkWidget *startwin;
GtkWidget *hlayout;
GtkWidget *banner;
GtkWidget *vlayout;
GtkWidget *tabs;
GtkWidget *configtlayout;
GtkWidget *displayvlayout;
GtkWidget *vmode3dlabel;
GtkWidget *vmode3dcombo;
GtkWidget *fullscreencheck;
#ifdef POLYMER
GtkWidget *polymercheck;
#endif
GtkWidget *inputdevlabel;
GtkWidget *inputdevcombo;
GtkWidget *custommodlabel;
GtkWidget *custommodcombo;
GtkWidget *emptyhlayout;
GtkWidget *autoloadcheck;
GtkWidget *alwaysshowcheck;
GtkWidget *configtab;
GtkWidget *gamevlayout;
GtkWidget *gamelabel;
GtkWidget *gamescroll;
GtkWidget *gamelist;
GtkWidget *gametab;
GtkWidget *messagesscroll;
GtkWidget *messagestext;
GtkWidget *messagestab;
GtkWidget *buttons;
GtkWidget *cancelbutton;
GtkWidget *cancelbuttonalign;
GtkWidget *cancelbuttonlayout;
GtkWidget *cancelbuttonicon;
GtkWidget *cancelbuttonlabel;
GtkWidget *startbutton;
GtkWidget *startbuttonalign;
GtkWidget *startbuttonlayout;
GtkWidget *startbuttonicon;
GtkWidget *startbuttonlabel;
} stwidgets;
static struct
{
grpfile_t const * grp;
char *gamedir;
ud_setup_t shared;
#ifdef POLYMER
int polymer;
#endif
} settings;
static int32_t retval = -1, mode = TAB_MESSAGES;
extern int32_t gtkenabled;
static void PopulateForm(unsigned char pgs);
// -- EVENT CALLBACKS AND CREATION STUFF --------------------------------------
static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data)
{
GtkTreeModel *data;
GtkTreeIter iter;
int32_t val;
UNREFERENCED_PARAMETER(user_data);
if (!gtk_combo_box_get_active_iter(combobox, &iter)) return;
if (!(data = gtk_combo_box_get_model(combobox))) return;
gtk_tree_model_get(data, &iter, 1, &val, -1);
settings.shared.xdim = validmode[val].xdim;
settings.shared.ydim = validmode[val].ydim;
settings.shared.bpp = validmode[val].bpp;
}
static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
UNREFERENCED_PARAMETER(user_data);
settings.shared.fullscreen = gtk_toggle_button_get_active(togglebutton);
PopulateForm(POPULATE_VIDEO);
}
#ifdef POLYMER
static void on_polymercheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
UNREFERENCED_PARAMETER(user_data);
if (gtk_toggle_button_get_active(togglebutton))
{
glrendmode = REND_POLYMER;
settings.polymer = TRUE;
if (settings.shared.bpp == 8)
{
settings.shared.bpp = 32;
PopulateForm(POPULATE_VIDEO);
}
}
else
{
glrendmode = REND_POLYMOST;
settings.polymer = FALSE;
}
}
#endif
static void on_inputdevcombo_changed(GtkComboBox *combobox, gpointer user_data)
{
UNREFERENCED_PARAMETER(user_data);
switch (gtk_combo_box_get_active(combobox))
{
case 0: settings.shared.usemouse = 0; settings.shared.usejoystick = 0; break;
case 1: settings.shared.usemouse = 1; settings.shared.usejoystick = 0; break;
case 2: settings.shared.usemouse = 0; settings.shared.usejoystick = 1; break;
case 3: settings.shared.usemouse = 1; settings.shared.usejoystick = 1; break;
}
}
static void on_custommodcombo_changed(GtkComboBox *combobox, gpointer user_data)
{
GtkTreeIter iter;
GtkTreeModel *model;
GtkTreePath *path;
char *value;
UNREFERENCED_PARAMETER(user_data);
if (gtk_combo_box_get_active_iter(combobox, &iter))
{
model = gtk_combo_box_get_model(combobox);
gtk_tree_model_get(model, &iter, 0,&value, -1);
path = gtk_tree_model_get_path(model, &iter);
if (*gtk_tree_path_get_indices(path) == NONE)
settings.gamedir = NULL;
else settings.gamedir = value;
}
}
static void on_autoloadcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
UNREFERENCED_PARAMETER(user_data);
settings.shared.noautoload = !gtk_toggle_button_get_active(togglebutton);
}
static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
UNREFERENCED_PARAMETER(user_data);
settings.shared.forcesetup = gtk_toggle_button_get_active(togglebutton);
}
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
{
UNREFERENCED_PARAMETER(button);
UNREFERENCED_PARAMETER(user_data);
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
else quitevent++;
}
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
{
UNREFERENCED_PARAMETER(button);
UNREFERENCED_PARAMETER(user_data);
retval = 1;
gtk_main_quit();
}
static void on_gamelist_selection_changed(GtkTreeSelection *selection, gpointer user_data)
{
GtkTreeIter iter;
GtkTreeModel *model;
UNREFERENCED_PARAMETER(user_data);
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
grpfile_t const *fg;
gtk_tree_model_get(model, &iter, 2, (gpointer)&fg, -1);
settings.grp = fg;
}
}
static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
UNREFERENCED_PARAMETER(widget);
UNREFERENCED_PARAMETER(event);
UNREFERENCED_PARAMETER(user_data);
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
else quitevent++;
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
}
// -- SUPPORT FUNCTIONS -------------------------------------------------------
static GdkPixbuf *load_banner(void)
{
return gdk_pixbuf_from_pixdata((GdkPixdata const *)&startbanner_pixdata, FALSE, NULL);
}
static void SetPage(int32_t n)
{
if (!gtkenabled || !stwidgets.startwin) return;
mode = n;
gtk_notebook_set_current_page(GTK_NOTEBOOK(stwidgets.tabs), n);
// each control in the config page vertical layout plus the start button should be made (in)sensitive
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
gtk_widget_set_sensitive(stwidgets.startbutton, n);
gtk_container_foreach(GTK_CONTAINER(stwidgets.configtlayout),
(GtkCallback)gtk_widget_set_sensitive,
(gpointer)&n);
}
static unsigned char GetModsDirNames(GtkListStore *list)
{
char *homedir;
char pdir[BMAX_PATH];
unsigned char iternumb = 0;
CACHE1D_FIND_REC *dirs = NULL;
GtkTreeIter iter;
pathsearchmode = 1;
if ((homedir = Bgethomedir()))
{
Bsnprintf(pdir, sizeof(pdir), "%s/" ".eduke32", homedir);
dirs = klistpath(pdir, "*", CACHE1D_FIND_DIR);
for (; dirs != NULL; dirs=dirs->next)
{
if ((Bstrcmp(dirs->name, "autoload") == 0) ||
(Bstrcmp(dirs->name, "..") == 0) ||
(Bstrcmp(dirs->name, ".") == 0))
continue;
else
{
gtk_list_store_append(list, &iter);
gtk_list_store_set(list, &iter, 0,dirs->name, -1);
iternumb++;
}
}
}
klistfree(dirs);
dirs = NULL;
return iternumb;
}
static void PopulateForm(unsigned char pgs)
{
if ((pgs == ALL) || (pgs == POPULATE_VIDEO))
{
int32_t mode3d, i;
GtkListStore *modes3d;
GtkTreeIter iter;
char buf[64];
mode3d = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, settings.shared.bpp, settings.shared.fullscreen, 1);
if (mode3d < 0)
{
int32_t i, cd[] = { 32, 24, 16, 15, 8, 0 };
for (i=0; cd[i];) { if (cd[i] >= settings.shared.bpp) i++; else break; }
for (; cd[i]; i++)
{
mode3d = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, cd[i], settings.shared.fullscreen, 1);
if (mode3d < 0) continue;
settings.shared.bpp = cd[i];
break;
}
}
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.vmode3dcombo)));
gtk_list_store_clear(modes3d);
for (i=0; i<validmodecnt; i++)
{
if (validmode[i].fs != settings.shared.fullscreen) continue;
// all modes get added to the 3D mode list
Bsprintf(buf, "%dx%d %s", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp == 8 ? "software" : "OpenGL");
gtk_list_store_append(modes3d, &iter);
gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
if (i == mode3d)
{
g_signal_handlers_block_by_func(stwidgets.vmode3dcombo, (gpointer)on_vmode3dcombo_changed, NULL);
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(stwidgets.vmode3dcombo), &iter);
g_signal_handlers_unblock_by_func(stwidgets.vmode3dcombo, (gpointer)on_vmode3dcombo_changed, NULL);
}
}
}
if ((pgs == ALL) || (pgs == POPULATE_CONFIG))
{
GtkListStore *devlist, *modsdir;
GtkTreeIter iter;
GtkTreePath *path;
char *value;
unsigned char i, r = 0;
const char *availabledev[] =
{
"Keyboard only",
"Keyboard and mouse",
"Keyboard and joystick",
"All supported devices"
};
// populate input devices combo
devlist = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.inputdevcombo)));
gtk_list_store_clear(devlist);
for (i=0; i<(int32_t)G_N_ELEMENTS(availabledev); i++)
{
gtk_list_store_append(devlist, &iter);
gtk_list_store_set(devlist, &iter, 0,availabledev[i], -1);
}
switch (settings.shared.usemouse)
{
case 0: if (settings.shared.usejoystick)
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_JOYSTICK);
else
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_KB);
break;
case 1: if (settings.shared.usejoystick)
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_ALL);
else
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_MOUSE);
break;
}
// populate custom mod combo
modsdir = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.custommodcombo)));
gtk_list_store_clear(modsdir);
gtk_list_store_append(modsdir, &iter);
gtk_list_store_set(modsdir, &iter, 0,"None", -1);
r = GetModsDirNames(modsdir);
for (i=0; i<=r; i++)
{
path = gtk_tree_path_new_from_indices(i, -1);
gtk_tree_model_get_iter(GTK_TREE_MODEL(modsdir), &iter, path);
gtk_tree_model_get(GTK_TREE_MODEL(modsdir), &iter, 0,&value, -1);
if (Bstrcmp(settings.gamedir, "/") == 0)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.custommodcombo), NONE);
settings.gamedir = NULL;
break;
}
if (Bstrcmp(settings.gamedir, value) == 0)
{
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(stwidgets.custommodcombo),
&iter);
break;
}
}
// populate check buttons
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.fullscreencheck), settings.shared.fullscreen);
#ifdef POLYMER
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.polymercheck), settings.polymer);
#endif
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.autoloadcheck), !settings.shared.noautoload);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.alwaysshowcheck), settings.shared.forcesetup);
}
if ((pgs == ALL) || (pgs == POPULATE_GAME))
{
GtkListStore *list;
GtkTreeIter iter;
GtkTreeView *gamelist;
gamelist = GTK_TREE_VIEW(stwidgets.gamelist);
list = GTK_LIST_STORE(gtk_tree_view_get_model(gamelist));
gtk_list_store_clear(list);
for (grpfile_t const * fg = foundgrps; fg; fg=fg->next)
{
gtk_list_store_append(list, &iter);
gtk_list_store_set(list, &iter, 0, fg->type->name, 1, fg->filename, 2, (void const *)fg, -1);
if (settings.grp == fg)
{
GtkTreeSelection *sel = gtk_tree_view_get_selection(gamelist);
g_signal_handlers_block_by_func(sel, (gpointer)on_gamelist_selection_changed, NULL);
gtk_tree_selection_select_iter(sel, &iter);
g_signal_handlers_unblock_by_func(sel, (gpointer)on_gamelist_selection_changed, NULL);
}
}
}
}
static gint name_sorter(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
{
gchar *as, *bs;
gint r;
UNREFERENCED_PARAMETER(user_data);
gtk_tree_model_get(model, a, 0, &as, -1);
gtk_tree_model_get(model, b, 0, &bs, -1);
r = g_utf8_collate(as,bs);
g_free(as);
g_free(bs);
return r;
}
static GtkWidget *create_window(void)
{
// Basic window
stwidgets.startwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(stwidgets.startwin), apptitle); // NOTE: use global app title
gtk_window_set_position(GTK_WINDOW(stwidgets.startwin), GTK_WIN_POS_CENTER);
gtk_window_set_resizable(GTK_WINDOW(stwidgets.startwin), FALSE);
gtk_window_set_type_hint(GTK_WINDOW(stwidgets.startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
// Horizontal layout of banner and controls
stwidgets.hlayout = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(stwidgets.startwin), stwidgets.hlayout);
// banner
{
GdkPixbuf *pixbuf = load_banner();
stwidgets.banner = gtk_image_new_from_pixbuf(pixbuf);
g_object_unref((gpointer)pixbuf);
}
gtk_box_pack_start(GTK_BOX(stwidgets.hlayout), stwidgets.banner, FALSE, FALSE, 0);
gtk_misc_set_alignment(GTK_MISC(stwidgets.banner), 0.5, 0);
// Vertical layout of tab control and start+cancel buttons
stwidgets.vlayout = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(stwidgets.hlayout), stwidgets.vlayout, TRUE, TRUE, 0);
// Tab control
stwidgets.tabs = gtk_notebook_new();
gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.tabs, TRUE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(stwidgets.tabs), 4);
// layout table of config page
stwidgets.configtlayout = gtk_table_new(6, 3, FALSE);
gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.configtlayout);
// 3D video mode LabelText
stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0);
#ifdef POLYMER
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 0);
#else
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 7);
#endif
// 3D video mode combo
{
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
GtkCellRenderer *cell;
stwidgets.vmode3dcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
g_object_unref(G_OBJECT(list));
cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL);
}
#ifdef POLYMER
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0);
#else
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 7);
#endif
// Fullscreen checkbox
stwidgets.displayvlayout = gtk_vbox_new(TRUE, 0);
#ifdef POLYMER
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 0);
#else
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 7);
#endif
stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
gtk_box_pack_start(GTK_BOX(stwidgets.displayvlayout), stwidgets.fullscreencheck, FALSE, FALSE, 0);
#ifdef POLYMER
// Polymer checkbox
stwidgets.polymercheck = gtk_check_button_new_with_mnemonic("_Polymer");
gtk_box_pack_start(GTK_BOX(stwidgets.displayvlayout), stwidgets.polymercheck, FALSE, FALSE, 0);
#endif
// Input devices LabelText
stwidgets.inputdevlabel = gtk_label_new_with_mnemonic("_Input devices:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.inputdevlabel), 0.3, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevlabel, 0,1, 1,2, GTK_FILL, (GtkAttachOptions)0, 4, 0);
// Input devices combo
{
GtkListStore *list = gtk_list_store_new(1, G_TYPE_STRING);
GtkCellRenderer *cell;
stwidgets.inputdevcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
g_object_unref(G_OBJECT(list));
cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, "text", 0, NULL);
}
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevcombo, 1,2, 1,2,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0);
// Custom mod LabelText
stwidgets.custommodlabel = gtk_label_new_with_mnemonic("Custom _game:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.custommodlabel), 0.3, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodlabel, 0,1, 2,3, GTK_FILL, (GtkAttachOptions)0, 4, 7);
// Custom mod combo
{
GtkListStore *list = gtk_list_store_new(1, G_TYPE_STRING);
GtkCellRenderer *cell;
stwidgets.custommodcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
g_object_unref(G_OBJECT(list));
cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, "text", 0, NULL);
}
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodcombo, 1,2, 2,3,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 7);
// Empty horizontal layout
stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,3, 3,4, (GtkAttachOptions)0,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 4, 0);
// Autoload checkbox
stwidgets.autoloadcheck = gtk_check_button_new_with_mnemonic("_Enable \"autoload\" folder");
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.autoloadcheck, 0,3, 4,5, GTK_FILL, (GtkAttachOptions)0, 2, 2);
// Always show config checkbox
stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show this window at startup");
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,3, 5,6, GTK_FILL, (GtkAttachOptions)0, 2, 2);
// Configuration tab
stwidgets.configtab = gtk_label_new("Configuration");
gtk_notebook_set_tab_label(GTK_NOTEBOOK(stwidgets.tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(stwidgets.tabs), 0), stwidgets.configtab);
// Game data layout
stwidgets.gamevlayout = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.gamevlayout);
gtk_container_set_border_width(GTK_CONTAINER(stwidgets.gamevlayout), 4);
// Game data field LabelText
stwidgets.gamelabel = gtk_label_new_with_mnemonic("_Game:");
gtk_box_pack_start(GTK_BOX(stwidgets.gamevlayout), stwidgets.gamelabel, FALSE, FALSE, 0);
gtk_misc_set_alignment(GTK_MISC(stwidgets.gamelabel), 0, 0.5);
// Game data scrollable area
stwidgets.gamescroll = gtk_scrolled_window_new(NULL, NULL);
gtk_box_pack_start(GTK_BOX(stwidgets.gamevlayout), stwidgets.gamescroll, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(stwidgets.gamescroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(stwidgets.gamescroll), GTK_SHADOW_IN);
// Game data list
{
GtkListStore *list = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
GtkCellRenderer *cell;
GtkTreeViewColumn *col;
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list), 0, name_sorter, NULL, NULL);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(list), 0, GTK_SORT_ASCENDING);
stwidgets.gamelist = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list));
g_object_unref(G_OBJECT(list));
cell = gtk_cell_renderer_text_new();
col = gtk_tree_view_column_new_with_attributes("Game", cell, "text", 0, NULL);
gtk_tree_view_column_set_expand(col, TRUE);
gtk_tree_view_append_column(GTK_TREE_VIEW(stwidgets.gamelist), col);
col = gtk_tree_view_column_new_with_attributes("GRP file", cell, "text", 1, NULL);
gtk_tree_view_column_set_min_width(col, 64);
gtk_tree_view_append_column(GTK_TREE_VIEW(stwidgets.gamelist), col);
}
gtk_container_add(GTK_CONTAINER(stwidgets.gamescroll), stwidgets.gamelist);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(stwidgets.gamelist), FALSE);
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(stwidgets.gamelist), FALSE);
// Game tab
stwidgets.gametab = gtk_label_new("Game");
gtk_notebook_set_tab_label(GTK_NOTEBOOK(stwidgets.tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(stwidgets.tabs), 1), stwidgets.gametab);
// Messages scrollable area
stwidgets.messagesscroll = gtk_scrolled_window_new(NULL, NULL);
gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.messagesscroll);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(stwidgets.messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
// Messages text area
stwidgets.messagestext = gtk_text_view_new();
gtk_container_add(GTK_CONTAINER(stwidgets.messagesscroll), stwidgets.messagestext);
gtk_text_view_set_editable(GTK_TEXT_VIEW(stwidgets.messagestext), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(stwidgets.messagestext), GTK_WRAP_WORD);
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(stwidgets.messagestext), FALSE);
gtk_text_view_set_left_margin(GTK_TEXT_VIEW(stwidgets.messagestext), 2);
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(stwidgets.messagestext), 2);
// Messages tab
stwidgets.messagestab = gtk_label_new("Messages");
gtk_notebook_set_tab_label(GTK_NOTEBOOK(stwidgets.tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(stwidgets.tabs), 2), stwidgets.messagestab);
// Dialogue box buttons layout
stwidgets.buttons = gtk_hbutton_box_new();
gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.buttons, FALSE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(stwidgets.buttons), 3);
gtk_button_box_set_layout(GTK_BUTTON_BOX(stwidgets.buttons), GTK_BUTTONBOX_END);
// Cancel button
stwidgets.cancelbutton = gtk_button_new();
gtk_container_add(GTK_CONTAINER(stwidgets.buttons), stwidgets.cancelbutton);
GTK_WIDGET_SET_FLAGS(stwidgets.cancelbutton, GTK_CAN_DEFAULT);
stwidgets.cancelbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_container_add(GTK_CONTAINER(stwidgets.cancelbutton), stwidgets.cancelbuttonalign);
stwidgets.cancelbuttonlayout = gtk_hbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(stwidgets.cancelbuttonalign), stwidgets.cancelbuttonlayout);
stwidgets.cancelbuttonicon = gtk_image_new_from_stock("gtk-cancel", GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start(GTK_BOX(stwidgets.cancelbuttonlayout), stwidgets.cancelbuttonicon, FALSE, FALSE, 0);
stwidgets.cancelbuttonlabel = gtk_label_new_with_mnemonic("_Cancel");
gtk_box_pack_start(GTK_BOX(stwidgets.cancelbuttonlayout), stwidgets.cancelbuttonlabel, FALSE, FALSE, 0);
// Start button
stwidgets.startbutton = gtk_button_new();
gtk_container_add(GTK_CONTAINER(stwidgets.buttons), stwidgets.startbutton);
GTK_WIDGET_SET_FLAGS(stwidgets.startbutton, GTK_CAN_DEFAULT);
gtk_window_set_default(GTK_WINDOW(stwidgets.startwin), stwidgets.startbutton);
stwidgets.startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_container_add(GTK_CONTAINER(stwidgets.startbutton), stwidgets.startbuttonalign);
stwidgets.startbuttonlayout = gtk_hbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(stwidgets.startbuttonalign), stwidgets.startbuttonlayout);
stwidgets.startbuttonicon = gtk_image_new_from_stock("gtk-execute", GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonicon, FALSE, FALSE, 0);
stwidgets.startbuttonlabel = gtk_label_new_with_mnemonic("_Start");
gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonlabel, FALSE, FALSE, 0);
// Wire up the signals
g_signal_connect((gpointer) stwidgets.startwin, "delete_event",
G_CALLBACK(on_startwin_delete_event),
NULL);
g_signal_connect((gpointer) stwidgets.vmode3dcombo, "changed",
G_CALLBACK(on_vmode3dcombo_changed),
NULL);
g_signal_connect((gpointer) stwidgets.fullscreencheck, "toggled",
G_CALLBACK(on_fullscreencheck_toggled),
NULL);
#ifdef POLYMER
g_signal_connect((gpointer) stwidgets.polymercheck, "toggled",
G_CALLBACK(on_polymercheck_toggled),
NULL);
#endif
g_signal_connect((gpointer) stwidgets.inputdevcombo, "changed",
G_CALLBACK(on_inputdevcombo_changed),
NULL);
g_signal_connect((gpointer) stwidgets.custommodcombo, "changed",
G_CALLBACK(on_custommodcombo_changed),
NULL);
g_signal_connect((gpointer) stwidgets.autoloadcheck, "toggled",
G_CALLBACK(on_autoloadcheck_toggled),
NULL);
g_signal_connect((gpointer) stwidgets.alwaysshowcheck, "toggled",
G_CALLBACK(on_alwaysshowcheck_toggled),
NULL);
g_signal_connect((gpointer) stwidgets.cancelbutton, "clicked",
G_CALLBACK(on_cancelbutton_clicked),
NULL);
g_signal_connect((gpointer) stwidgets.startbutton, "clicked",
G_CALLBACK(on_startbutton_clicked),
NULL);
{
GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(stwidgets.gamelist));
gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE);
g_signal_connect((gpointer) sel, "changed",
G_CALLBACK(on_gamelist_selection_changed),
NULL);
}
// Associate labels with their controls
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.vmode3dlabel), stwidgets.vmode3dcombo);
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.inputdevlabel), stwidgets.inputdevcombo);
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.custommodlabel), stwidgets.custommodcombo);
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.gamelabel), stwidgets.gamelist);
return stwidgets.startwin;
}
// -- BUILD ENTRY POINTS ------------------------------------------------------
int32_t startwin_open(void)
{
if (!gtkenabled) return 0;
if (stwidgets.startwin) return 1;
stwidgets.startwin = create_window();
if (stwidgets.startwin)
{
SetPage(TAB_MESSAGES);
gtk_widget_show_all(stwidgets.startwin);
gtk_main_iteration_do(FALSE);
return 0;
}
return -1;
}
int32_t startwin_close(void)
{
if (!gtkenabled) return 0;
if (!stwidgets.startwin) return 1;
gtk_widget_destroy(stwidgets.startwin);
stwidgets.startwin = NULL;
return 0;
}
int32_t startwin_puts(const char *str)
{
GtkWidget *textview;
GtkTextBuffer *textbuffer;
GtkTextIter enditer;
GtkTextMark *mark;
const char *aptr, *bptr;
if (!gtkenabled || !str) return 0;
if (!stwidgets.startwin) return 1;
if (!(textview = stwidgets.messagestext)) return -1;
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
gtk_text_buffer_get_end_iter(textbuffer, &enditer);
for (aptr = bptr = str; *aptr != 0;)
{
switch (*bptr)
{
case '\b':
if (bptr > aptr)
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
#if GTK_CHECK_VERSION(2,6,0)
gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
#else
{
GtkTextIter iter2 = enditer;
gtk_text_iter_backward_cursor_position(&iter2);
//FIXME: this seems be deleting one too many chars somewhere!
if (!gtk_text_iter_equal(&iter2, &enditer))
gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE);
}
#endif
aptr = ++bptr;
break;
case 0:
if (bptr > aptr)
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
aptr = bptr;
break;
case '\r': // FIXME
default:
bptr++;
break;
}
}
mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0);
gtk_text_buffer_delete_mark(textbuffer, mark);
return 0;
}
int32_t startwin_settitle(const char *title)
{
if (!gtkenabled) return 0;
if (!stwidgets.startwin) return 1;
gtk_window_set_title(GTK_WINDOW(stwidgets.startwin), title);
return 0;
}
int32_t startwin_idle(void *s)
{
UNREFERENCED_PARAMETER(s);
if (!gtkenabled) return 0;
//if (!stwidgets.startwin) return 1;
gtk_main_iteration_do(FALSE);
return 0;
}
int32_t startwin_run(void)
{
if (!gtkenabled) return 1;
if (!stwidgets.startwin) return 1;
SetPage(TAB_CONFIG);
settings.shared = gSetup;
settings.gamedir = g_modDir;
settings.grp = g_selectedGrp;
#ifdef POLYMER
settings.polymer = (glrendmode == REND_POLYMER) & (settings.shared.bpp != 8);
#endif
PopulateForm(ALL);
gtk_main();
SetPage(TAB_MESSAGES);
if (retval) // launch the game with these parameters
{
gSetup = settings.shared;
#ifdef POLYMER
glrendmode = (settings.polymer) ? REND_POLYMER : REND_POLYMOST;
#endif
g_selectedGrp = settings.grp;
Bstrcpy(g_modDir, (g_noSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/");
}
return retval;
}

Some files were not shown because too many files have changed in this diff Show more