Adapted to Mingw. Still some elements must adapted.
git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@167 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32__
|
||||||
|
|
||||||
void RaiseDebugger() {
|
void RaiseDebugger() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -119,7 +119,7 @@ void RaiseDebugger() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32__
|
||||||
|
|
||||||
#include "AuxLib.h" // for Windows.h
|
#include "AuxLib.h" // for Windows.h
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ void OlxWriteCoreDump(const char* fileName)
|
|||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
//#include <sys/wait.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ static void GdbWriteCoreDump(const char* fname) {
|
|||||||
if(p) {
|
if(p) {
|
||||||
fprintf(p, "%s", gdbparam);
|
fprintf(p, "%s", gdbparam);
|
||||||
fflush(p);
|
fflush(p);
|
||||||
int status = 0; wait(&status);
|
//int status = 0; wait(&status);
|
||||||
pclose(p);
|
pclose(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ void DumpCallstack(void (*PrintOutFct) (const std::string&)) {
|
|||||||
free(strs);
|
free(strs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WIN32)
|
#elif defined(WIN32__)
|
||||||
|
|
||||||
#include "StackWalker.h" // Call Luke Stackwalker for help
|
#include "StackWalker.h" // Call Luke Stackwalker for help
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ void DumpCallstack(void (*LineOutFct) (const std::string&))
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#warning No DumpCallstack implementation for this arch/sys
|
//#warning No DumpCallstack implementation for this arch/sys
|
||||||
|
|
||||||
void DumpCallstackPrintf(void* callpnt) {
|
void DumpCallstackPrintf(void* callpnt) {
|
||||||
printf("DumpCallstackPrintf not implemented\n");
|
printf("DumpCallstackPrintf not implemented\n");
|
||||||
|
|||||||
@@ -507,6 +507,7 @@ size_t FileSize(const std::string& path)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define uchar unsigned char
|
||||||
// Checks if the given path is absolute
|
// Checks if the given path is absolute
|
||||||
bool IsAbsolutePath(const std::string& path)
|
bool IsAbsolutePath(const std::string& path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ std::string Utf16ToUtf8(const Utf16String& str);
|
|||||||
Utf16String Utf8ToUtf16(const std::string& str);
|
Utf16String Utf8ToUtf16(const std::string& str);
|
||||||
std::string UnicodeToUtf8(const UnicodeString& str);
|
std::string UnicodeToUtf8(const UnicodeString& str);
|
||||||
UnicodeString Utf8ToUnicode(const std::string& str);
|
UnicodeString Utf8ToUnicode(const std::string& str);
|
||||||
#ifdef WIN32
|
#ifdef WIN32__
|
||||||
std::string Utf8ToSystemNative(const std::string& utf8str);
|
std::string Utf8ToSystemNative(const std::string& utf8str);
|
||||||
std::string SystemNativeToUtf8(const std::string& natstr);
|
std::string SystemNativeToUtf8(const std::string& natstr);
|
||||||
#else // Other platforms use natively utf8 (at least we suppose so)
|
#else // Other platforms use natively utf8 (at least we suppose so)
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ reprocess: ;
|
|||||||
{
|
{
|
||||||
if (objects[o].ai.vortelite.timesincefire > VORTELITE_MIN_TIME_BETWEEN_FIRE)
|
if (objects[o].ai.vortelite.timesincefire > VORTELITE_MIN_TIME_BETWEEN_FIRE)
|
||||||
{
|
{
|
||||||
if (rnd()%VORTELITE_FIRE_PROB == (VORTELITE_FIRE_PROB/2))
|
if (rand()%VORTELITE_FIRE_PROB == (VORTELITE_FIRE_PROB/2))
|
||||||
{ // let's fire
|
{ // let's fire
|
||||||
// usually shoot toward keen
|
// usually shoot toward keen
|
||||||
if (rnd()%5 != 0)
|
if (rand()%5 != 0)
|
||||||
{
|
{
|
||||||
if (objects[o].x < player[primaryplayer].x)
|
if (objects[o].x < player[primaryplayer].x)
|
||||||
{
|
{
|
||||||
@@ -295,7 +295,7 @@ void vortelite_initiatejump(int o)
|
|||||||
objects[o].ai.vortelite.frame = 0;
|
objects[o].ai.vortelite.frame = 0;
|
||||||
objects[o].ai.vortelite.animtimer = 0;
|
objects[o].ai.vortelite.animtimer = 0;
|
||||||
objects[o].ai.vortelite.inertiay = \
|
objects[o].ai.vortelite.inertiay = \
|
||||||
-((rnd()%(VORTELITE_MAX_JUMP_HEIGHT-VORTELITE_MIN_JUMP_HEIGHT))+VORTELITE_MIN_JUMP_HEIGHT);
|
-((rand()%(VORTELITE_MAX_JUMP_HEIGHT-VORTELITE_MIN_JUMP_HEIGHT))+VORTELITE_MIN_JUMP_HEIGHT);
|
||||||
|
|
||||||
if (objects[o].ai.vortelite.movedir==RIGHT)
|
if (objects[o].ai.vortelite.movedir==RIGHT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ char spawn_object(int x, int y, int otype);
|
|||||||
|
|
||||||
unsigned int getmaptileat(unsigned int x, unsigned int y);
|
unsigned int getmaptileat(unsigned int x, unsigned int y);
|
||||||
|
|
||||||
uint rnd(void);
|
|
||||||
|
|
||||||
void vortelite_ai(int o);
|
void vortelite_ai(int o);
|
||||||
void vortelite_initiatejump(int o);
|
void vortelite_initiatejump(int o);
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void CPatcher::patchMemory()
|
|||||||
TrimSpaces(newbuf);
|
TrimSpaces(newbuf);
|
||||||
size_t p = newbuf.find(' ');
|
size_t p = newbuf.find(' ');
|
||||||
if(p != std::string::npos) {
|
if(p != std::string::npos) {
|
||||||
size_t offset = 0;
|
long offset = 0;
|
||||||
sscanf(newbuf.substr(0,p).c_str(), "%lx", &offset); // Only hexadecimal numbers supported
|
sscanf(newbuf.substr(0,p).c_str(), "%lx", &offset); // Only hexadecimal numbers supported
|
||||||
std::string patch_file_name = newbuf.substr(p+1);
|
std::string patch_file_name = newbuf.substr(p+1);
|
||||||
TrimSpaces(patch_file_name);
|
TrimSpaces(patch_file_name);
|
||||||
@@ -125,7 +125,7 @@ bool CPatcher::loadPatchfile()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPatcher::patchMemfromFile(const std::string& patch_file_name, int offset)
|
void CPatcher::patchMemfromFile(const std::string& patch_file_name, long offset)
|
||||||
{
|
{
|
||||||
unsigned char *buf_to_patch;
|
unsigned char *buf_to_patch;
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
virtual ~CPatcher();
|
virtual ~CPatcher();
|
||||||
|
|
||||||
void patchMemory();
|
void patchMemory();
|
||||||
void patchMemfromFile(const std::string& patch_file_name, int offset);
|
void patchMemfromFile(const std::string& patch_file_name, long offset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -1102,15 +1102,6 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
} while(1);
|
} while(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// a random number generator
|
|
||||||
ulong random_seed;
|
|
||||||
void srnd(ulong newseed) { random_seed = newseed; }
|
|
||||||
uint rnd(void)
|
|
||||||
{
|
|
||||||
random_seed = random_seed * 1103515245 + 12345;
|
|
||||||
return (uint)(random_seed / 65536) % 32768;
|
|
||||||
}
|
|
||||||
|
|
||||||
int endsequence(stCloneKeenPlus *pCKP)
|
int endsequence(stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user