ref: f19a3b937cf86daed8a2a67b63b9914cf3b497db
parent: 19bf783384014d10101e97fe81d2c83a9b30f408
author: Jacob Moody <[email protected]>
date: Sun Feb 5 20:29:11 EST 2023
first round of Game port work
--- a/Engine/src/mmulti.h
+++ b/Engine/src/mmulti.h
@@ -3,7 +3,7 @@
#include <stdint.h>
-void initmultiplayers();
+void initmultiplayers(void);
void sendpacket(int32_t other, const uint8_t* bufptr, int32_t messleng);
void setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount);
void uninitmultiplayers(void);
--- a/Engine/src/plan9_compat.h
+++ b/Engine/src/plan9_compat.h
@@ -26,7 +26,6 @@
#define O_BINARY 0
-
/*
#define SOL_IP SOL_SOCKET
#define IP_RECVERR SO_BROADCAST
@@ -39,6 +38,8 @@
#define O_CREAT OTRUNC
#define O_WRONLY OWRITE
#define O_RDONLY OREAD
+#define O_APPEND 0
+#define alloca malloc
#define lseek seek
--- a/Game/src/config.c
+++ b/Game/src/config.c
@@ -37,7 +37,7 @@
#include "engine.h"
#include "file_lib.h"
#include "function.h"
-#include "keyboard.h"
+#include "kbd.h"
#include "scriplib.h"
#include "util_lib.h"
--- a/Game/src/console.c
+++ b/Game/src/console.c
@@ -630,4 +630,4 @@
void CONSOLE_SetActive(int i)
{
nConsole_Active = (i == 0) ? 0 : 1;
-}
\ No newline at end of file
+}
--- a/Game/src/console.h
+++ b/Game/src/console.h
@@ -3,17 +3,17 @@
// Public member functions
-void CONSOLE_Init();
-void CONSOLE_Reset();
-void CONSOLE_Term();
-void CONSOLE_ParseStartupScript();
-void CONSOLE_HandleInput();
-void CONSOLE_Render();
+void CONSOLE_Init(void);
+void CONSOLE_Reset(void);
+void CONSOLE_Term(void);
+void CONSOLE_ParseStartupScript(void);
+void CONSOLE_HandleInput(void);
+void CONSOLE_Render(void);
void CONSOLE_ParseCommand(char * command);
void CONSOLE_Printf(const char *newmsg, ...);
-int CONSOLE_GetArgc();
+int CONSOLE_GetArgc(void);
char * CONSOLE_GetArgv(unsigned int var);
-int CONSOLE_IsActive();
+int CONSOLE_IsActive(void);
void CONSOLE_SetActive(int i);
#endif
--- a/Game/src/control.h
+++ b/Game/src/control.h
@@ -33,7 +33,7 @@
#ifndef _control_public
#define _control_public
-#include "keyboard.h"
+#include "kbd.h"
#ifdef __cplusplus
extern "C" {
--- a/Game/src/duke3d.h
+++ b/Game/src/duke3d.h
@@ -50,7 +50,11 @@
#include "dukewin.h"
#endif
+#if (defined __plan9__)
+#include "dukeplan9.h"
+#endif
+
// FIX_00022: Automatically recognize the shareware grp (v1.3) + full version (1.3d) +
// atomic (1.4/1.5 grp) and the con files version (either 1.3 or 1.4) (JonoF's idea)
@@ -282,8 +286,7 @@
};
*/
-#pragma pack(push)
-#pragma pack(1)
+#pragma pack on
typedef struct
{
@@ -292,7 +295,7 @@
uint32_t bits;
} input;
-#pragma pack(pop)
+#pragma pack off
/* !!! FIXME: "sync" is defined in unistd.h ... :( --ryan. */
#define sync duke_sync
@@ -324,7 +327,7 @@
extern short cyclers[MAXCYCLERS][6],numcyclers;
extern char myname[2048];
-#pragma pack(push, 4)
+#pragma pack on
struct user_defs
{
uint8_t god,warp_on,cashman,eog,showallmap;
@@ -370,7 +373,7 @@
uint32_t exeCRC[MAXPLAYERS];
uint32_t conCRC[MAXPLAYERS];
};
-#pragma pack(pop)
+#pragma pack off
struct player_orig
{
@@ -396,7 +399,7 @@
extern int32_t fricxv,fricyv;
-#pragma pack(push, 4)
+#pragma pack on
struct player_struct
{
int32_t zoom,exitx,exity,loogiex[64],loogiey[64],numloogs,loogcnt;
@@ -467,7 +470,7 @@
uint8_t fakeplayer;
};
-#pragma pack(pop)
+#pragma pack off
extern uint8_t tempbuf[2048];
extern uint8_t packbuf[576];
@@ -517,7 +520,7 @@
extern uint8_t inspace(short sectnum);
-#pragma pack(push, 4)
+#pragma pack on
struct weaponhit
{
uint8_t cgg;
@@ -527,7 +530,7 @@
int32_t floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz;
int32_t temp_data[6];
};
-#pragma pack(pop)
+#pragma pack off
extern struct weaponhit hittype[MAXSPRITES];
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -49,7 +49,7 @@
#include "file_lib.h"
#include "gamedefs.h"
#include "global.h"
-#include "keyboard.h"
+#include "kbd.h"
#include "util_lib.h"
#include "function.h"
#include "control.h"
@@ -7768,7 +7768,7 @@
void sendscore(char *s)
{
if(numplayers > 1)
- genericmultifunction(-1,s,strlen(s)+1,5);
+ genericmultifunction(-1,(uchar*)s,strlen(s)+1,5);
}
@@ -8039,8 +8039,10 @@
while ((dirEntry = readdir(dir)) != NULL)
{
-#ifdef __linux__
+#if defined(__linux__)
if (dukeGRP_Match(dirEntry->d_name, _D_EXACT_NAMLEN(dirEntry)))
+#elif defined(__plan9__)
+ if (dukeGRP_Match(dirEntry->d_name, strlen(dirEntry->d_name)))
#else
if (dukeGRP_Match(dirEntry->d_name,dirEntry->d_namlen))
#endif
@@ -10589,13 +10591,13 @@
if(getGameDir()[0] != '\0')
{
sprintf(szFilename, "%s\\%s", getGameDir(), SCREENSHOTPATH);
- mkdir(szFilename);
+ mkdir(szFilename, 0777);
sprintf(szFilename, "%s\\%s\\%s", getGameDir(), SCREENSHOTPATH, text);
}
// otherwise let's save it to the root.
else
{
- mkdir(SCREENSHOTPATH);
+ mkdir(SCREENSHOTPATH, 0777);
sprintf(szFilename, "%s\\%s", SCREENSHOTPATH, text);
}
--- a/Game/src/gamedef.c
+++ b/Game/src/gamedef.c
@@ -35,7 +35,7 @@
#include "duke3d.h"
#include "engine.h"
-#include "keyboard.h"
+#include "kbd.h"
#include "soundefs.h"
extern short otherp;
--- a/Game/src/global.c
+++ b/Game/src/global.c
@@ -338,7 +338,7 @@
return(0);
}
-#elif defined(UNIX) || defined(PLATFORM_MACOSX)
+#elif defined(UNIX) || defined(PLATFORM_MACOSX) || defined(__plan9__)
int _dos_findfirst(char *filename, int x, struct find_t *f)
{
char *ptr;
@@ -556,7 +556,7 @@
#if (defined WIN32)
handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND );
#else
- handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND , S_IREAD | S_IWRITE);
+ handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND);
#endif
if (handle == -1)
@@ -591,8 +591,7 @@
#if (defined WIN32)
handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC );
#else
- handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC
- , S_IREAD | S_IWRITE);
+ handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC);
#endif
if (handle == -1)