diff --git a/lib/exceptionhandler/exceptionhandler.cpp b/lib/exceptionhandler/exceptionhandler.cpp index 1ee6399f0..5685d8135 100644 --- a/lib/exceptionhandler/exceptionhandler.cpp +++ b/lib/exceptionhandler/exceptionhandler.cpp @@ -121,6 +121,7 @@ static LONG WINAPI windowsExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) # include # include # include +# include # include #ifdef WZ_OS_LINUX # include @@ -465,7 +466,7 @@ static pid_t execGdb(int const dumpFile, int* gdbWritePipe) strlen("execcv(\"gdb\") failed\n")); // Terminate the child, indicating failure - exit(1); + _exit(1); } /** @@ -476,8 +477,43 @@ static pid_t execGdb(int const dumpFile, int* gdbWritePipe) * @return false if any failure occurred, preventing a full "extended" * backtrace. */ +#ifdef SA_SIGINFO +static bool gdbExtendedBacktrace(int const dumpFile, const ucontext_t* sigcontext) +#else static bool gdbExtendedBacktrace(int const dumpFile) +#endif { + /* + * Pointer to the stackframe of the function containing faulting + * instruction (assuming + * -fomit-frame-pointer has *not* been used). + * + * The frame pointer register (x86: %ebp, x64: %rbp) point's to the + * local variables of the current function (which are preceded by the + * previous frame pointer and the return address). Hence the + * additions to the frame-pointer register's content. + */ + void const * const frame = +#if defined(SA_SIGINFO) && __WORDSIZE == 64 + sigcontext ? (void*)(sigcontext->uc_mcontext.gregs[REG_RBP] + sizeof(greg_t) + sizeof(void (*)(void))) : NULL; +#elif defined(SA_SIGINFO) && __WORDSIZE == 32 + sigcontext ? (void*)(sigcontext->uc_mcontext.gregs[REG_EBP] + sizeof(greg_t) + sizeof(void (*)(void))) : NULL; +#else + NULL; +#endif + + /* + * Faulting instruction. + */ + void (*instruction)(void) = +#if defined(SA_SIGINFO) && __WORDSIZE == 64 + sigcontext ? (void (*)(void))sigcontext->uc_mcontext.gregs[REG_RIP] : NULL; +#elif defined(SA_SIGINFO) && __WORDSIZE == 32 + sigcontext ? (void (*)(void))sigcontext->uc_mcontext.gregs[REG_EIP] : NULL; +#else + NULL; +#endif + // Spawn a GDB instance and retrieve a pipe to its stdin int gdbPipe; int status; @@ -489,7 +525,7 @@ static bool gdbExtendedBacktrace(int const dumpFile) "frame 4\n" // Show the assembly code associated with that stack frame - "disassemble\n" + "disassemble /m\n" // Show the content of all registers "info registers\n" @@ -500,7 +536,20 @@ static bool gdbExtendedBacktrace(int const dumpFile) return false; } - write(gdbPipe, gdbCommands, sizeof(gdbCommands)); + // Disassemble the faulting instruction (if we know it) + if (instruction) + { + dprintf(gdbPipe, "x/i %p\n", (void*)instruction); + } + + // We have an intelligent guess for the *correct* frame, disassemble *that* one. + if (frame) + { + dprintf(gdbPipe, "frame %p\n" + "disassemble /m\n", frame); + } + + write(gdbPipe, gdbCommands, strlen(gdbCommands)); /* Flush our end of the pipe to make sure that GDB has all commands * directly available to it. @@ -558,7 +607,7 @@ static bool gdbExtendedBacktrace(int const dumpFile) * \param sigcontext Signal context */ #ifdef SA_SIGINFO -static void posixExceptionHandler(int signum, siginfo_t * siginfo, WZ_DECL_UNUSED void * sigcontext) +static void posixExceptionHandler(int signum, siginfo_t * siginfo, void * sigcontext) #else static void posixExceptionHandler(int signum) #endif @@ -616,7 +665,11 @@ static void posixExceptionHandler(int signum) fsync(dumpFile); // Use 'gdb' to provide an "extended" backtrace +#ifdef SA_SIGINFO + gdbExtendedBacktrace(dumpFile, (ucontext_t*)sigcontext); +#else gdbExtendedBacktrace(dumpFile); +#endif printf("Saved dump file to '%s'\n" "If you create a bugreport regarding this crash, please include this file.\n", dumpFilename); diff --git a/lib/framework/resource_lexer.l b/lib/framework/resource_lexer.l index ecf5239bd..d4bf96117 100644 --- a/lib/framework/resource_lexer.l +++ b/lib/framework/resource_lexer.l @@ -80,7 +80,7 @@ extern void res_set_debug(int bdebug); %} -%option yylineno noyywrap nounput never-interactive +%option yylineno noyywrap nounput %option prefix="res_" %x COMMENT diff --git a/lib/framework/strres_lexer.l b/lib/framework/strres_lexer.l index 2aaf8cd69..bfb8a96fe 100644 --- a/lib/framework/strres_lexer.l +++ b/lib/framework/strres_lexer.l @@ -84,7 +84,7 @@ extern void strres_set_debug(int bdebug); %} -%option yylineno noyywrap nounput never-interactive +%option yylineno noyywrap nounput %option prefix="strres_" %x COMMENT diff --git a/lib/framework/wz2100icon.h b/lib/framework/wz2100icon.h new file mode 100644 index 000000000..b53400954 --- /dev/null +++ b/lib/framework/wz2100icon.h @@ -0,0 +1,169 @@ +/* GIMP RGBA C-Source image dump (wz2100icon.c) */ + +static const struct { + unsigned int width; + unsigned int height; + unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ + unsigned char pixel_data[32 * 32 * 4 + 1]; +} wz2100icon = { + 32, 32, 4, + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ikn\15\224" + "\240\246g\232\245\251l\234\245\252i\241\250\253i\243\250\253i\241\247\253" + "i\237\246\252i\237\246\252i\234\245\252i\240\247\253i\251\253\255i\253\254" + "\256i\253\254\255i\253\253\255i\253\253\255i\252\252\255i\251\252\255i\246" + "\251\254i\243\247\253i\235\244\251i\227\242\251i\225\240\250i\224\237\246" + "k\225\241\244jijk\35\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0VZ\\\14\247\271" + "\302\236\335\370\377\374\335\361\375\377\344\365\377\376\352\370\377\376" + "\350\366\377\376\340\362\375\376\337\361\374\376\344\364\376\376\345\365" + "\376\376\356\373\377\376\365\374\377\376\365\371\377\376\362\370\377\376" + "\353\364\376\376\346\361\374\376\346\362\375\376\345\361\374\376\342\356" + "\372\376\333\354\370\376\326\352\367\376\322\350\366\376\322\350\367\376" + "\322\351\370\377\332\365\377\377\263\306\321\262OQT\34\0\0\0\0\0\0\0\0\0" + "\0\0\0chjX\351\366\372\357\361\377\377\377\232\236\240\377\221\221\224\377" + "\237\237\242\377\253\256\262\377\247\255\261\377\236\243\250\377\231\235" + "\241\377\234\236\241\377\240\241\243\377\250\250\250\377\247\250\251\377" + "\251\252\257\377\232\234\244\377\220\223\235\377\234\244\253\377\240\251" + "\261\377\226\235\243\377\222\230\234\377\227\233\237\377\232\235\237\377" + "\234\234\236\377\231\231\232\377\213\214\215\377\206\211\215\377\272\325" + "\346\377\313\366\377\375Rbjm\0\0\0\0\0\0\0\0\300\333\362\367\322\337\350" + "\377USS\377_bh\377\264\277\303\377\265\276\305\377\207\212\221\377|}\205" + "\377\212\216\230\377\274\301\306\377\303\313\321\377\273\304\312\377\210" + "\213\230\377\201\205\231\377\212\220\240\377\247\264\300\377\266\307\316" + "\377\237\247\261\377}|\207\377\234\242\253\377\311\327\335\377\266\306\322" + "\377\251\300\316\377\241\273\311\377\227\262\301\377\222\264\304\377Xaj\377" + "///\377\231\256\267\377\340\377\377\377\7\6\6\21\0\0\0\0\234\312\347\344" + "Yq\203\377...\377\205\222\241\377\366\377\377\377\346\367\377\377\223\230" + "\244\377\207\213\241\377\244\255\277\377\350\366\377\377\370\377\377\377" + "\365\377\377\377\237\244\262\377\212\220\241\377\213\217\231\377\335\353" + "\360\377\377\377\377\377\262\271\277\377}}\201\377\267\302\314\377\341\367" + "\377\377\311\343\361\377\316\346\362\377\316\346\361\377\332\361\377\377" + "\361\377\377\377u\177\215\377\25\25\25\377SU]\377\323\335\351\377\10\11\12" + "\32\13\15\17\2\245\312\344\350cr\200\377%*9\377\207\230\255\377\337\363\375" + "\377\327\346\355\377\206\212\226\377y|\221\377\211\216\231\377\344\356\364" + "\377\363\375\377\377\353\364\370\377\214\221\226\377qt~\377~\203\215\377" + "\333\342\347\377\377\377\377\377\250\256\265\377sv\202\377\177\203\211\377" + "z|\177\377\203\205\211\377}}\177\377\273\271\274\377\377\377\377\377\356" + "\366\376\377co~\377\5\12\31\377MXg\377\252\276\323\377!%*\36\30\35!\11\305" + "\335\351\355dow\377\11\17\35\377[h{\377\353\374\377\377\326\343\355\377Z" + "^d\377:CS\377QXb\377\334\345\357\377\356\371\377\377\342\354\365\377\\cn" + "\37726C\377BJX\377\320\330\344\377\377\377\377\377\212\224\242\377AK[\377" + "Xbs\377V^q\377U]r\377S]o\377\266\306\332\377\336\367\377\377\235\265\317" + "\377\33&9\377\26\40""5\377HVd\377\236\265\314\377\40$)%\0\0\0\20\313\336" + "\351\365\\dm\377\0\0\0\377NZi\377\343\373\373\377\274\320\336\377.7F\377" + "\32(D\377*6H\377\251\303\334\377\271\327\367\377\264\315\350\377:EW\377)" + "7N\3773AV\377\246\271\321\377\337\366\377\377o\200\230\377,;R\377DUm\377" + "(2F\377\14\21\36\377Tbu\377\275\334\370\377\274\342\377\377Rdv\377\22\35" + """2\377\34&:\377:FT\377}\242\277\377\15\23\27.\6\7\10\31\257\315\342\375" + "NZe\377\0\0\13\377[n\203\377\317\355\367\377\253\302\323\377/;L\3772C_\377" + "Sf\200\377\235\300\334\377\251\320\360\377\240\302\336\377GXo\3778E]\377" + "7E[\377q\233\277\377\227\323\375\377Oj\205\377\21\25%\377!,B\377#.C\377\12" + "\15\32\377X|\235\377\216\317\375\377l\234\300\377$0A\377(4G\377!):\3775B" + "Q\377k\232\270\377\26\37%6(-0\35\303\331\344\377NV^\377\16\32""2\377m\204" + "\232\377\323\356\366\377\260\301\314\377GTh\377Pf\206\377Ug\177\377\252\312" + "\343\377\272\334\367\377\244\307\341\3779Kb\377%1K\377.a\3778E^\377>Nb\377>GS\377\251\271\314\377(.3E\33\32\31.\344" + "\344\344\377MQZ\377\4\15'\377ax\216\377\326\363\367\377\260\306\320\377\22" + "\27!\377\23!?\377AQg\377\325\351\363\377\344\367\377\377\325\344\356\377" + "CPe\377*;X\377=L`\377\313\322\334\377\377\377\377\377\253\270\303\377q\223" + "\262\377Tf\212\377\34%H\377\250\264\311\377\357\375\377\377\254\300\330\377" + "#/B\377\"+<\377\30\37.\377\30\40""4\377/:F\377\177\252\305\377\37+2O#&*5" + "\277\321\342\377:CQ\377\0\3\32\377m{\213\377\367\367\367\377\307\310\316" + "\377,8H\377/Eg\377DNa\377\361\363\373\377\371\374\377\377\315\323\343\377" + "h|\223\377u\220\257\377Uh\205\377\240\267\317\377\276\342\374\377\201\236" + "\267\377Vi\201\377%/G\377?Pb\377\247\320\353\377\276\356\377\377_z\215\377" + "\0\0\12\377\34%8\377\36(;\377\25\36""1\377,7B\377\221\264\311\3775?HU6FP" + "<\211\265\322\377,8F\377\24\34.\377l\200\226\377\317\350\367\377\230\256" + "\301\377;I]\377{\226\266\377q\210\240\377\234\276\334\377\231\311\352\377" + "~\257\320\377@Ri\3779D]\377>Pj\377\210\272\333\377\261\347\376\377Um\203" + "\377\17\26.\377\13\26-\377\201\223\242\377\340\373\377\377\300\337\370\377" + "0=L\377\7\13\25\377\20\26%\377\36(8\377\",>\377.8C\377\227\265\313\377" + "U\377/9E\377w\243\274\3770CNp6IRU\215\265\314\377)0;\377\16\25(\377\7\14" + "\34\377\215\242\265\377\324\364\364\377\223\254\303\377e~\223\377\312\366" + "\377\377_{\223\377\1\7\30\377\\\211\246\377\247\344\377\377v\217\245\377" + "\242\305\340\377\302\357\377\377v\225\255\377Q`}\377\204\240\273\377\235" + "\274\320\377\305\347\377\377\271\331\361\377\262\315\343\377\246\303\327" + "\377\227\265\306\377\227\271\314\377Ret\377\1\4\20\377&/;\377\252\275\314" + "\377W`iwMV]]\266\302\316\377\34\36%\377\30$:\377#.H\377,8J\377z\234\263\377" + "\210\266\323\377\251\332\364\377k\215\243\377Re~\377j\201\242\377Qav\377" + "\262\304\320\377\334\363\377\377\272\326\356\377\224\263\312\377IYp\377I" + "\\|\3777Ia\377\177\225\250\377\304\337\362\377\260\305\331\377\263\313\343" + "\377\251\306\337\377\226\264\312\377\241\276\317\377n\203\221\377\0\5\21" + "\377\33!+\377\236\260\302\377Zgu\201JY\377\325\347\353\377\325\347\353\377f\216" + "\251\3773;V\377\325\347\353\377Y\200\234\377f\216\251\377\325\347\353\377" + "f\216\251\377Sf}\377f\216\251\377\325\347\353\377f\216\251\377\13\20\"\377" + "\23\34/\377e|\214\377\257\317\317\377\317\317\317\377knt\322\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""269y\203\217\221\326\255\270" + "\274\377\33\40+\377Pc{\377n\203\231\3776CX\377o\204\227\377\325\347\353\377" + "\0\0\20\377\305\326\331\377N^u\377\305\326\331\3775@P\377\304\325\331\377" + "j{\213\377\304\325\331\377\34\40-\377\304\325\331\377!-B\377\26\37/\377\201" + "\224\236\377\241\274\313\3774C\2249?C\2248?C\2247?C\2243=B\2244=C\2243 +#include #include #include #include diff --git a/lib/framework/wzglobal.h b/lib/framework/wzglobal.h index e777e9621..a720db250 100644 --- a/lib/framework/wzglobal.h +++ b/lib/framework/wzglobal.h @@ -587,10 +587,6 @@ #define PATH_MAX 4096 #endif -// Tell Flex not to include unistd when it is not present. -#if !defined(HAVE_UNISTD_H) && !defined(YY_NO_UNISTD_H) -# define YY_NO_UNISTD_H -#endif #if !defined(WZ_C99) && !defined(va_copy) /** diff --git a/lib/gamelib/audp_lexer.l b/lib/gamelib/audp_lexer.l index 01e50efb6..1679da245 100644 --- a/lib/gamelib/audp_lexer.l +++ b/lib/gamelib/audp_lexer.l @@ -84,7 +84,7 @@ extern void audp_set_extra(YY_EXTRA_TYPE user_defined); %} -%option yylineno noyywrap nounput never-interactive +%option yylineno noyywrap nounput %option prefix="audp_" %x COMMENT diff --git a/lib/script/chat_lexer.l b/lib/script/chat_lexer.l index 45adb6830..daa8100c7 100644 --- a/lib/script/chat_lexer.l +++ b/lib/script/chat_lexer.l @@ -80,7 +80,6 @@ static SDWORD playerIndex; %option prefix="chat_" %option nounput %option case-insensitive -%option never-interactive %% diff --git a/lib/script/script_lexer.l b/lib/script/script_lexer.l index 6f33c1c09..4acade23a 100644 --- a/lib/script/script_lexer.l +++ b/lib/script/script_lexer.l @@ -458,7 +458,6 @@ static void pushInclude(const char *pIncludePath) %option prefix="scr_" %option nounput %option yylineno -%option never-interactive %x COMMENT %x SLCOMMENT diff --git a/src/action.cpp b/src/action.cpp index c2e70e7e4..840c4c058 100644 --- a/src/action.cpp +++ b/src/action.cpp @@ -843,10 +843,15 @@ void actionUpdateDroid(DROID *psDroid) psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat; ASSERT_OR_RETURN(, psPropStats != NULL, "Invalid propulsion stats pointer"); + // Don't waste ammo unless given a direct attack order. + bool avoidOverkill = psDroid->order != DORDER_ATTACK && psDroid->order != DORDER_ATTACK && + (psDroid->action == DACTION_ATTACK || psDroid->action == DACTION_MOVEFIRE || psDroid->action == DACTION_MOVETOATTACK || + psDroid->action == DACTION_ROTATETOATTACK || psDroid->action == DACTION_VTOLATTACK); + // clear the target if it has died for (i = 0; i < DROID_MAXWEAPS; i++) { - if (psDroid->psActionTarget[i] && psDroid->psActionTarget[i]->died) + if (psDroid->psActionTarget[i] && (avoidOverkill? aiObjectIsProbablyDoomed(psDroid->psActionTarget[i]) : psDroid->psActionTarget[i]->died)) { setDroidActionTarget(psDroid, NULL, i); if (i == 0) @@ -859,7 +864,7 @@ void actionUpdateDroid(DROID *psDroid) // if VTOL - return to rearm pad if not patrolling if (isVtolDroid(psDroid)) { - if (psDroid->order == DORDER_PATROL) + if ((psDroid->order == DORDER_PATROL || psDroid->order == DORDER_CIRCLE) && !vtolEmpty(psDroid)) { // Back to the patrol. actionDroid(psDroid, DACTION_MOVE, psDroid->orderX,psDroid->orderY); @@ -925,7 +930,7 @@ void actionUpdateDroid(DROID *psDroid) WEAPON_STATS* const psWeapStats = &asWeaponStats[psDroid->asWeaps[i].nStat]; if (psDroid->asWeaps[i].nStat > 0 && psWeapStats->rotate - && aiBestNearestTarget(psDroid, &psTemp, i, NULL) >= 0) + && aiBestNearestTarget(psDroid, &psTemp, i) >= 0) { if (secondaryGetState(psDroid, DSO_ATTACK_LEVEL) == DSS_ALEV_ALWAYS) { @@ -1025,7 +1030,7 @@ void actionUpdateDroid(DROID *psDroid) && psDroid->asWeaps[i].nStat > 0 && psWeapStats->rotate && psWeapStats->fireOnMove != FOM_NO - && aiBestNearestTarget(psDroid, &psTemp, i, NULL) >= 0) + && aiBestNearestTarget(psDroid, &psTemp, i) >= 0) { if (secondaryGetState(psDroid, DSO_ATTACK_LEVEL) == DSS_ALEV_ALWAYS) { @@ -1089,7 +1094,7 @@ void actionUpdateDroid(DROID *psDroid) { // Can we find a good target for the weapon? BASE_OBJECT *psTemp; - if (aiBestNearestTarget(psDroid, &psTemp, i, NULL) >= 0) // assuming aiBestNearestTarget checks for electronic warfare + if (aiBestNearestTarget(psDroid, &psTemp, i) >= 0) // assuming aiBestNearestTarget checks for electronic warfare { bHasTarget = true; setDroidActionTarget(psDroid, psTemp, i); // this updates psDroid->psActionTarget[i] to != NULL @@ -1145,8 +1150,19 @@ void actionUpdateDroid(DROID *psDroid) } break; case DACTION_ATTACK: + case DACTION_ROTATETOATTACK: ASSERT_OR_RETURN( , psDroid->psActionTarget[0] != NULL, "target is NULL while attacking"); + if (psDroid->action == DACTION_ROTATETOATTACK) + { + if (psDroid->sMove.Status == MOVETURNTOTARGET) + { + moveTurnDroid(psDroid, psDroid->psActionTarget[0]->pos.x, psDroid->psActionTarget[0]->pos.y); + break; // Still turning. + } + psDroid->action = DACTION_ATTACK; + } + //check the target hasn't become one the same player ID - Electronic Warfare if ((electronicDroid(psDroid) && (psDroid->player == psDroid->psActionTarget[0]->player))) { @@ -1195,10 +1211,7 @@ void actionUpdateDroid(DROID *psDroid) if (nonNullWeapon[i] && actionVisibleTarget(psDroid, psActionTarget, i) - && actionInRange(psDroid, psActionTarget, i) - && (psDroid->order == DORDER_ATTACK - || psDroid->order == DORDER_ATTACKTARGET - || !aiObjectIsProbablyDoomed(psActionTarget))) + && actionInRange(psDroid, psActionTarget, i)) { WEAPON_STATS* const psWeapStats = &asWeaponStats[psDroid->asWeaps[i].nStat]; bHasTarget = true; @@ -1522,13 +1535,6 @@ void actionUpdateDroid(DROID *psDroid) } break; - case DACTION_ROTATETOATTACK: -// if (DROID_STOPPED(psDroid)) - if (psDroid->sMove.Status != MOVETURNTOTARGET) - { - psDroid->action = DACTION_ATTACK; - } - break; case DACTION_MOVETOBUILD: if (!psDroid->psTarStats) { @@ -2138,7 +2144,7 @@ void actionUpdateDroid(DROID *psDroid) WEAPON_STATS* const psWeapStats = &asWeaponStats[psDroid->asWeaps[i].nStat]; if (psDroid->asWeaps[i].nStat > 0 && psWeapStats->rotate && secondaryGetState(psDroid, DSO_ATTACK_LEVEL) == DSS_ALEV_ALWAYS - && aiBestNearestTarget(psDroid, &psTemp, i, NULL) >= 0 && psTemp) + && aiBestNearestTarget(psDroid, &psTemp, i) >= 0 && psTemp) { psDroid->action = DACTION_ATTACK; setDroidActionTarget(psDroid, psTemp, 0); diff --git a/src/ai.cpp b/src/ai.cpp index 871b95680..dfb790666 100644 --- a/src/ai.cpp +++ b/src/ai.cpp @@ -74,6 +74,27 @@ PlayerMask alliancebits[MAX_PLAYER_SLOTS]; /// A bitfield for the satellite uplink PlayerMask satuplinkbits; +static int aiObjRange(DROID *psDroid, int weapon_slot) +{ + int32_t longRange; + if (psDroid->droidType == DROID_SENSOR) + { + longRange = psDroid->sensorRange; + } + else if (psDroid->numWeaps == 0 || psDroid->asWeaps[0].nStat == 0) + { + // Can't attack without a weapon + return 0; + } + else + { + WEAPON_STATS *psWStats = psDroid->asWeaps[weapon_slot].nStat + asWeaponStats; + longRange = proj_GetLongRange(psWStats); + } + + return longRange; +} + // see if a structure has the range to fire on a target static bool aiStructHasRange(STRUCTURE *psStruct, BASE_OBJECT *psTarget, int weapon_slot) { @@ -85,32 +106,15 @@ static bool aiStructHasRange(STRUCTURE *psStruct, BASE_OBJECT *psTarget, int wea WEAPON_STATS *psWStats = psStruct->asWeaps[weapon_slot].nStat + asWeaponStats; - Vector2i diff = removeZ(psStruct->pos - psTarget->pos); int longRange = proj_GetLongRange(psWStats); - return diff*diff < longRange*longRange && lineOfFire(psStruct, psTarget, weapon_slot, true); + return objPosDiffSq(psStruct, psTarget) < longRange*longRange && lineOfFire(psStruct, psTarget, weapon_slot, true); } static bool aiDroidHasRange(DROID *psDroid, BASE_OBJECT *psTarget, int weapon_slot) { - int32_t longRange; + int32_t longRange = aiObjRange(psDroid, weapon_slot); - if (psDroid->droidType == DROID_SENSOR) - { - longRange = psDroid->sensorRange; - } - else if (psDroid->numWeaps == 0 || psDroid->asWeaps[0].nStat == 0) - { - // Can't attack without a weapon - return false; - } - else - { - WEAPON_STATS *psWStats = psDroid->asWeaps[weapon_slot].nStat + asWeaponStats; - longRange = proj_GetLongRange(psWStats); - } - - Vector2i diff = removeZ(psDroid->pos - psTarget->pos); - return diff*diff < longRange*longRange; + return objPosDiffSq(psDroid, psTarget) < longRange*longRange; } static bool aiObjHasRange(BASE_OBJECT *psObj, BASE_OBJECT *psTarget, int weapon_slot) @@ -476,7 +480,7 @@ static SDWORD targetAttackWeight(BASE_OBJECT *psTarget, BASE_OBJECT *psAttacker, // Find the best nearest target for a droid // Returns integer representing target priority, -1 if failed -SDWORD aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot, UWORD *targetOrigin) +int aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot, int extraRange) { SDWORD bestMod = 0,newMod, failure = -1; BASE_OBJECT *psTarget = NULL, *friendlyObj, *bestTarget = NULL, *iter, *targetInQuestion, *tempTarget; @@ -485,12 +489,6 @@ SDWORD aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot WEAPON_EFFECT weaponEffect; UWORD tmpOrigin = ORIGIN_UNKNOWN; - // reset origin - if (targetOrigin) - { - *targetOrigin = ORIGIN_UNKNOWN; - } - //don't bother looking if empty vtol droid if (vtolEmpty(psDroid)) { @@ -517,7 +515,9 @@ SDWORD aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot electronic = electronicDroid(psDroid); // Range was previously 9*TILE_UNITS. Increasing this doesn't seem to help much, though. Not sure why. - gridStartIterate(psDroid->pos.x, psDroid->pos.y, psDroid->sensorRange + 6*TILE_UNITS); + int droidRange = std::min(aiObjRange(psDroid, weapon_slot) + extraRange, psDroid->sensorRange + 6*TILE_UNITS); + + gridStartIterate(psDroid->pos.x, psDroid->pos.y, droidRange); for (iter = gridIterate(); iter != NULL; iter = gridIterate()) { friendlyObj = NULL; @@ -568,7 +568,7 @@ SDWORD aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot && targetInQuestion->visible[psDroid->player] == UBYTE_MAX && !aiCheckAlliances(targetInQuestion->player,psDroid->player) && validTarget(psDroid, targetInQuestion, weapon_slot) - && aiDroidHasRange(psDroid, targetInQuestion, weapon_slot)) + && objPosDiffSq(psDroid, targetInQuestion) < droidRange*droidRange) { if (targetInQuestion->type == OBJ_DROID) { @@ -654,10 +654,6 @@ SDWORD aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot } } - if (targetOrigin) - { - *targetOrigin = tmpOrigin; - } *ppsObj = bestTarget; return bestMod; } @@ -781,7 +777,7 @@ BOOL aiChooseTarget(BASE_OBJECT *psObj, BASE_OBJECT **ppsTarget, int weapon_slot BASE_OBJECT *psCurrTarget = ((DROID *)psObj)->psActionTarget[0]; /* find a new target */ - int newTargetWeight = aiBestNearestTarget((DROID *)psObj, &psTarget, weapon_slot, NULL); + int newTargetWeight = aiBestNearestTarget((DROID *)psObj, &psTarget, weapon_slot); /* Calculate weight of the current target if updating; but take care not to target * ourselves... */ @@ -959,7 +955,7 @@ BOOL aiChooseSensorTarget(BASE_OBJECT *psObj, BASE_OBJECT **ppsTarget) { BASE_OBJECT *psTarget = NULL; - if (aiBestNearestTarget((DROID *)psObj, &psTarget, 0, NULL) >= 0) + if (aiBestNearestTarget((DROID *)psObj, &psTarget, 0) >= 0) { /* See if in sensor range */ const int xdiff = psTarget->pos.x - psObj->pos.x; diff --git a/src/ai.h b/src/ai.h index 277ee2bfc..bab7f92f7 100644 --- a/src/ai.h +++ b/src/ai.h @@ -58,7 +58,8 @@ void aiUpdateDroid(DROID *psDroid); // Find the nearest best target for a droid // returns integer representing quality of choice, -1 if failed -SDWORD aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot, UWORD *targetOrigin); +int aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot, int extraRange = 0); +int aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot, void const *extraRange); // Are there a lot of bullets heading towards the structure? BOOL aiObjectIsProbablyDoomed(BASE_OBJECT *psObject); diff --git a/src/basedef.h b/src/basedef.h index 7d51e55ee..f852cb05c 100644 --- a/src/basedef.h +++ b/src/basedef.h @@ -137,11 +137,14 @@ static inline bool isDead(const BASE_OBJECT* psObj) static inline int objPosDiffSq(Position pos1, Position pos2) { - const int xdiff = pos1.x - pos2.x; - const int ydiff = pos1.y - pos2.y; - return (xdiff * xdiff + ydiff * ydiff); + const Vector2i diff = removeZ(pos1 - pos2); + return diff*diff; } +static inline int objPosDiffSq(SIMPLE_OBJECT const *pos1, SIMPLE_OBJECT const *pos2) +{ + return objPosDiffSq(pos1->pos, pos2->pos); +} // True iff object is a droid, structure or feature (not a projectile). Will incorrectly return true if passed a nonsense object of type OBJ_TARGET or OBJ_NUM_TYPES. static inline bool isBaseObject(SIMPLE_OBJECT const *psObject) { return psObject->type != OBJ_PROJECTILE; } diff --git a/src/droid.cpp b/src/droid.cpp index 95a561a7a..1be24da05 100644 --- a/src/droid.cpp +++ b/src/droid.cpp @@ -2911,7 +2911,7 @@ bool calcDroidMuzzleLocation(DROID *psDroid, Vector3i *muzzle, int weapon_slot) * \param aName Template aName * */ -DROID_TEMPLATE *GetHumanDroidTemplate(char *aName) +DROID_TEMPLATE *GetHumanDroidTemplate(const char *aName) { DROID_TEMPLATE *templatelist, *found = NULL, *foundOtherPlayer = NULL; int i, playerFound = 0; @@ -2959,7 +2959,7 @@ DROID_TEMPLATE *GetHumanDroidTemplate(char *aName) * \param aName Template aName * */ -DROID_TEMPLATE *GetAIDroidTemplate(char *aName) +DROID_TEMPLATE *GetAIDroidTemplate(const char *aName) { DROID_TEMPLATE *templatelist, *found = NULL; diff --git a/src/droid.h b/src/droid.h index b640ef116..3992306c4 100644 --- a/src/droid.h +++ b/src/droid.h @@ -218,8 +218,8 @@ bool calcDroidMuzzleLocation(DROID *psDroid, Vector3i *muzzle, int weapon_slot); bool calcDroidMuzzleBaseLocation(DROID *psDroid, Vector3i *muzzle, int weapon_slot); /* gets a template from its aName (when pName is unknown) */ -extern DROID_TEMPLATE *GetHumanDroidTemplate(char *aName); -extern DROID_TEMPLATE *GetAIDroidTemplate(char *aName); +extern DROID_TEMPLATE *GetHumanDroidTemplate(const char *aName); +extern DROID_TEMPLATE *GetAIDroidTemplate(const char *aName); /* gets a template from its name - relies on the name being unique */ extern DROID_TEMPLATE * getTemplateFromUniqueName(const char *pName, unsigned int player); /* gets a template from its name - relies on the name being unique */ @@ -241,9 +241,6 @@ extern const char *droidGetName(const DROID *psDroid); // Set a droid's name. extern void droidSetName(DROID *psDroid, const char *pName); -// Set a templates name. -extern void templateSetName(DROID_TEMPLATE *psTemplate,char *pName); - // returns true when no droid on x,y square. extern BOOL noDroid (UDWORD x, UDWORD y); // true if no droid at x,y // returns an x/y coord to place a droid diff --git a/src/ingameop.cpp b/src/ingameop.cpp index 8ff71af48..0bcb8cfcb 100644 --- a/src/ingameop.cpp +++ b/src/ingameop.cpp @@ -178,6 +178,7 @@ static BOOL addSlideOptions(void) addFESlider(INTINGAMEOP_CDVOL_S, INTINGAMEOP, INTINGAMEOP_MID, INTINGAMEOP_3_Y-5, AUDIO_VOL_MAX, (int)(sound_GetMusicVolume() * 100)); +#ifdef DEBUG // Tactical UI: Target Origin if(tuiTargetOrigin) { @@ -189,6 +190,7 @@ static BOOL addSlideOptions(void) addIGTextButton(INTINGAMEOP_TUI_TARGET_ORIGIN_SW, INTINGAMEOP_4_Y, INTINGAMEOP_SW_W, _("Tactical UI (Target Origin Icon): Hide"), WBUT_PLAIN); } +#endif addIGTextButton(INTINGAMEOP_RESUME, INTINGAMEOP_5_Y, INTINGAMEOP_SW_W, _("Resume Game"), OPALIGN); @@ -261,10 +263,8 @@ static BOOL _intAddInGameOptions(void) // add 'resume' addIGTextButton(INTINGAMEOP_RESUME, INTINGAMEOP_1_Y, INTINGAMEOP_OP_W, _("Resume Game"), OPALIGN); -#ifdef DEBUG // add 'options' addIGTextButton(INTINGAMEOP_OPTIONS, INTINGAMEOP_2_Y, INTINGAMEOP_OP_W, _("Audio Options"), OPALIGN); -#endif if ((!bMultiPlayer || (NetPlay.bComms == 0)) && !bInTutorial) { diff --git a/src/level_lexer.l b/src/level_lexer.l index 158454c16..30bcf79da 100644 --- a/src/level_lexer.l +++ b/src/level_lexer.l @@ -87,7 +87,7 @@ extern void lev_set_extra(YY_EXTRA_TYPE user_defined); %} -%option yylineno noyywrap nounput never-interactive +%option yylineno noyywrap nounput %option prefix="lev_" %x COMMENT diff --git a/src/message_lexer.l b/src/message_lexer.l index d8f00698d..f5f125a3e 100644 --- a/src/message_lexer.l +++ b/src/message_lexer.l @@ -79,7 +79,7 @@ extern void message_set_debug(int bdebug); %} -%option yylineno noyywrap nounput never-interactive +%option yylineno noyywrap nounput %option prefix="message_" %x COMMENT diff --git a/src/move.cpp b/src/move.cpp index 72830e143..f5b1b222a 100644 --- a/src/move.cpp +++ b/src/move.cpp @@ -2515,18 +2515,6 @@ void moveUpdateDroid(DROID *psDroid) case MOVETURNTOTARGET: moveSpeed = 0; moveDir = iAtan2(psDroid->sMove.target - removeZ(psDroid->pos)); - if (psDroid->rot.direction == moveDir) - { - if ( psPropStats->propulsionType == PROPULSION_TYPE_LIFT ) - { - psDroid->sMove.Status = MOVEPOINTTOPOINT; - } - else - { - psDroid->sMove.Status = MOVEINACTIVE; - } - objTrace(psDroid->id, "MOVETURNTOTARGET complete"); - } break; case MOVEHOVER: moveDescending(psDroid); @@ -2599,6 +2587,19 @@ void moveUpdateDroid(DROID *psDroid) updateDroidOrientation(psDroid); } + if (psDroid->sMove.Status == MOVETURNTOTARGET && psDroid->rot.direction == moveDir) + { + if (psPropStats->propulsionType == PROPULSION_TYPE_LIFT) + { + psDroid->sMove.Status = MOVEPOINTTOPOINT; + } + else + { + psDroid->sMove.Status = MOVEINACTIVE; + } + objTrace(psDroid->id, "MOVETURNTOTARGET complete"); + } + if( (psDroid->inFire && psDroid->droidType != DROID_PERSON) && psDroid->visible[selectedPlayer]) { pos.x = psDroid->pos.x + (18-rand()%36); diff --git a/src/multibot.cpp b/src/multibot.cpp index a05c96d4a..485aa4187 100644 --- a/src/multibot.cpp +++ b/src/multibot.cpp @@ -159,7 +159,8 @@ BOOL recvDroidSecondary(NETQUEUE queue) NETenum(&state); // If we can not find the droid should we not ask for it? - if (!IdToDroid(droid, player, &psDroid)) + psDroid = IdToDroid(droid, player); + if (!psDroid) { NETend(); return false; @@ -218,14 +219,16 @@ BOOL recvDroidEmbark(NETQUEUE queue) NETuint32_t(&transporterID); // we have to find the droid on our (local) list first. - if (!IdToDroid(droidID, player, &psDroid)) + psDroid = IdToDroid(droidID, player); + if (!psDroid) { NETend(); // Possible it already died? (sync error?) debug(LOG_WARNING, "player's %d droid %d wasn't found?", player,droidID); return false; } - if (!IdToDroid(transporterID, player, &psTransporterDroid)) + psTransporterDroid = IdToDroid(transporterID, player); + if (!psTransporterDroid) { NETend(); // Possible it already died? (sync error?) @@ -310,7 +313,8 @@ BOOL recvDroidDisEmbark(NETQUEUE queue) NETend(); // find the transporter first - if (!IdToDroid(transporterID, player, &psTransporterDroid)) + psTransporterDroid = IdToDroid(transporterID, player); + if (!psTransporterDroid) { // Possible it already died? (sync error?) debug(LOG_WARNING, "player's %d transport droid %d wasn't found?", player, transporterID); @@ -676,8 +680,8 @@ BOOL recvDroidInfo(NETQUEUE queue) NETuint32_t(&deltaDroidId); info.droidId += deltaDroidId; - DROID *psDroid = NULL; - if (!IdToDroid(info.droidId, ANYPLAYER, &psDroid)) + DROID *psDroid = IdToDroid(info.droidId, ANYPLAYER); + if (!psDroid) { debug(LOG_NEVER, "Packet from %d refers to non-existent droid %u, [%s : p%d]", queue.index, info.droidId, isHumanPlayer(info.player) ? "Human" : "AI", info.player); @@ -734,21 +738,17 @@ static BASE_OBJECT *processDroidTarget(OBJECT_TYPE desttype, uint32_t destid) else { BASE_OBJECT *psObj = NULL; - DROID *pD; switch (desttype) { case OBJ_DROID: - if (IdToDroid(destid, ANYPLAYER, &pD)) - { - psObj = (BASE_OBJECT*)pD; - } + psObj = IdToDroid(destid, ANYPLAYER); break; case OBJ_STRUCTURE: - psObj = (BASE_OBJECT*)IdToStruct(destid,ANYPLAYER); + psObj = IdToStruct(destid, ANYPLAYER); break; case OBJ_FEATURE: - psObj = (BASE_OBJECT*)IdToFeature(destid,ANYPLAYER); + psObj = IdToFeature(destid, ANYPLAYER); break; // We should not get this! @@ -804,7 +804,8 @@ BOOL recvDestroyDroid(NETQUEUE queue) // Retrieve the droid NETuint32_t(&id); - if (!IdToDroid(id, ANYPLAYER, &psDroid)) + psDroid = IdToDroid(id, ANYPLAYER); + if (!psDroid) { debug(LOG_DEATH, "droid %d on request from player %d can't be found? Must be dead already?", id, queue.index ); diff --git a/src/multigifts.cpp b/src/multigifts.cpp index 20b014614..0bf5e75b2 100644 --- a/src/multigifts.cpp +++ b/src/multigifts.cpp @@ -182,9 +182,9 @@ void giftRadar(uint8_t from, uint8_t to, BOOL send) // \param to :player that should be getting the droid static void recvGiftDroids(uint8_t from, uint8_t to, uint32_t droidID) { - DROID *psDroid; + DROID *psDroid = IdToDroid(droidID, from); - if (IdToDroid(droidID, from, &psDroid)) + if (psDroid) { syncDebugDroid(psDroid, '<'); giftSingleDroid(psDroid, to); diff --git a/src/multijoin.cpp b/src/multijoin.cpp index f143a1008..a422cc755 100644 --- a/src/multijoin.cpp +++ b/src/multijoin.cpp @@ -243,7 +243,7 @@ BOOL MultiPlayerLeave(UDWORD playerIndex) { sendPlayerLeft(playerIndex); } - game.skDiff[playerIndex] = DIFF_SLIDER_STOPS / 2; + game.skDiff[playerIndex] = 0; addConsoleMessage(buf, DEFAULT_JUSTIFY, SYSTEM_MESSAGE); diff --git a/src/multiplay.cpp b/src/multiplay.cpp index 1e192f90c..0debaa6f4 100644 --- a/src/multiplay.cpp +++ b/src/multiplay.cpp @@ -290,110 +290,82 @@ BOOL multiPlayerLoop(void) // quikie functions. // to get droids ... -BOOL IdToDroid(UDWORD id, UDWORD player, DROID **psDroid) +DROID *IdToDroid(UDWORD id, UDWORD player) { - UDWORD i; - DROID *d; - - if(player == ANYPLAYER) + if (player == ANYPLAYER) { - for(i=0;iid !=id) )d=d->psNext; - if(d) + for (DROID *d = apsDroidLists[i]; d; d = d->psNext) { - *psDroid = d; - return true; + if (d->id == id) + { + return d; + } } } - return false; } - else // find the droid, given player + else if (player < MAX_PLAYERS) { - if (player >= MAX_PLAYERS) + for (DROID *d = apsDroidLists[player]; d; d = d->psNext) { - debug(LOG_FEATURE, "Feature detected"); - // feature hack, player = PLAYER_FEATURE are features - return false; + if (d->id == id) + { + return d; + } } - d = apsDroidLists[player]; - while( (d != NULL ) && (d->id !=id))d=d->psNext; - if(d) - { - *psDroid = d; - return true; - } - return false; } + return NULL; } // //////////////////////////////////////////////////////////////////////////// // find a structure -STRUCTURE *IdToStruct(UDWORD id,UDWORD player) +STRUCTURE *IdToStruct(UDWORD id, UDWORD player) { - STRUCTURE *psStr = NULL; - UDWORD i; - - if(player == ANYPLAYER) + if (player == ANYPLAYER) { - for(i=0;iid != id)); psStr=psStr->psNext) {} - if(psStr) + for (STRUCTURE *d = apsStructLists[i]; d; d = d->psNext) { - return psStr; + if (d->id == id) + { + return d; + } } } } - else + else if (player < MAX_PLAYERS) { - if (player >= MAX_PLAYERS) + for (STRUCTURE *d = apsStructLists[player]; d; d = d->psNext) { - debug(LOG_FEATURE, "Feature detected"); - // feature hack, player = PLAYER_FEATURE are features - return NULL; + if (d->id == id) + { + return d; + } } - for (psStr=apsStructLists[player];((psStr != NULL )&&(psStr->id != id) );psStr=psStr->psNext) {} } - return psStr; + return NULL; } // //////////////////////////////////////////////////////////////////////////// // find a feature -FEATURE *IdToFeature(UDWORD id,UDWORD player) +FEATURE *IdToFeature(UDWORD id, UDWORD player) { - FEATURE *psF =NULL; - UDWORD i; - - STATIC_ASSERT(MAX_PLAYERS + 2 < ANYPLAYER); - if(player == ANYPLAYER) + (void)player; // unused, all features go into player 0 + for (FEATURE *d = apsFeatureLists[0]; d; d = d->psNext) { - for(i=0;iid == id) { - for(psF=apsFeatureLists[i];( (psF != NULL) && (psF->id != id)); psF=psF->psNext) {} - if(psF) - { - return psF; - } + return d; } } - else - { - if (player >= MAX_PLAYERS) - { - debug(LOG_FEATURE, "Feature detected"); - // feature hack, player = PLAYER_FEATURE are features - but we're in a function called IdTo **Feature**... - return NULL; - } - for(psF=apsFeatureLists[player];((psF != NULL )&&(psF->id != id) );psF=psF->psNext) {} - } - return psF; + return NULL; } // //////////////////////////////////////////////////////////////////////////// -DROID_TEMPLATE *IdToTemplate(UDWORD tempId,UDWORD player) +DROID_TEMPLATE *IdToTemplate(UDWORD tempId, UDWORD player) { DROID_TEMPLATE *psTempl = NULL; UDWORD i; @@ -428,7 +400,9 @@ BASE_OBJECT *IdToPointer(UDWORD id,UDWORD player) STRUCTURE *pS; FEATURE *pF; // droids. - if (IdToDroid(id,player,&pD)) + + pD = IdToDroid(id, player); + if (pD) { return (BASE_OBJECT*)pD; } diff --git a/src/multiplay.h b/src/multiplay.h index c503ccdbc..292f0e2a1 100644 --- a/src/multiplay.h +++ b/src/multiplay.h @@ -149,7 +149,7 @@ extern UBYTE bDisplayMultiJoiningStatus; // draw load progress? extern WZ_DECL_WARN_UNUSED_RESULT BASE_OBJECT *IdToPointer(UDWORD id,UDWORD player); extern WZ_DECL_WARN_UNUSED_RESULT STRUCTURE *IdToStruct(UDWORD id,UDWORD player); -extern WZ_DECL_WARN_UNUSED_RESULT BOOL IdToDroid(UDWORD id, UDWORD player, DROID **psDroid); +extern WZ_DECL_WARN_UNUSED_RESULT DROID *IdToDroid(UDWORD id, UDWORD player); extern WZ_DECL_WARN_UNUSED_RESULT FEATURE *IdToFeature(UDWORD id,UDWORD player); extern WZ_DECL_WARN_UNUSED_RESULT DROID_TEMPLATE *IdToTemplate(UDWORD tempId,UDWORD player); diff --git a/src/multistruct.cpp b/src/multistruct.cpp index d91fd09d8..be83d2232 100644 --- a/src/multistruct.cpp +++ b/src/multistruct.cpp @@ -173,12 +173,12 @@ BOOL recvDemolishFinished(NETQUEUE queue) NETend(); psStruct = IdToStruct(structID, ANYPLAYER); - if (!IdToDroid(droidID, ANYPLAYER, &psDroid)) + psDroid = IdToDroid(droidID, ANYPLAYER); + if (!psDroid) { debug(LOG_ERROR, "recvDemolishFinished: Packet with bad droid ID received. Discarding!"); return false; } - if (psStruct) { // Demolish it diff --git a/src/multisync.cpp b/src/multisync.cpp index b90e0d9af..686174e1e 100644 --- a/src/multisync.cpp +++ b/src/multisync.cpp @@ -347,7 +347,8 @@ BOOL recvDroidCheck(NETQUEUE queue) NETauto(&pc); // Find the droid in question - if (!IdToDroid(pc.droidID, pc.player, &pD)) + pD = IdToDroid(pc.droidID, pc.player); + if (!pD) { NETlogEntry("Recvd Unknown droid info. val=player", SYNC_FLAG, pc.player); debug(LOG_SYNC, "Received checking info for an unknown (as yet) droid. player:%d ref:%d", pc.player, pc.droidID); diff --git a/src/order.cpp b/src/order.cpp index 1c15171a0..5a33789f6 100644 --- a/src/order.cpp +++ b/src/order.cpp @@ -97,9 +97,6 @@ static void orderCheckList(DROID *psDroid); // Clear all the orders from the list, up to listSize (without clearing pending (not yet synchronised) orders, that is). static void orderClearDroidList(DROID *psDroid); -//Watermelon:add a timestamp to order circle -static UDWORD orderStarted; - // whether an order effect has been displayed static BOOL bOrderEffectDisplayed = false; // what the droid's action / order is currently @@ -509,7 +506,7 @@ void orderUpdateDroid(DROID *psDroid) { // true if in condition to set actionDroid to attack/observe bool attack = secondaryGetState(psDroid, DSO_ATTACK_LEVEL) == DSS_ALEV_ALWAYS && - aiBestNearestTarget(psDroid, &psObj, 0, NULL) >= 0; + aiBestNearestTarget(psDroid, &psObj, 0, SCOUT_ATTACK_DIST) >= 0; switch (psDroid->droidType) { case DROID_CONSTRUCT: @@ -558,7 +555,6 @@ void orderUpdateDroid(DROID *psDroid) { if (psDroid->order == DORDER_PATROL) { - UDWORD tempCoord; // see if we have anything queued up if (orderDroidList(psDroid)) { @@ -571,12 +567,8 @@ void orderUpdateDroid(DROID *psDroid) break; } // head back to the other point - tempCoord = psDroid->orderX; - psDroid->orderX = psDroid->orderX2; - psDroid->orderX2 = tempCoord; - tempCoord = psDroid->orderY; - psDroid->orderY = psDroid->orderY2; - psDroid->orderY2 = tempCoord; + std::swap(psDroid->orderX, psDroid->orderX2); + std::swap(psDroid->orderY, psDroid->orderY2); actionDroid(psDroid, DACTION_MOVE, psDroid->orderX,psDroid->orderY); } else @@ -595,10 +587,8 @@ void orderUpdateDroid(DROID *psDroid) (psDroid->action == DACTION_OBSERVE) || (psDroid->action == DACTION_MOVETOOBSERVE)) { - // attacking something - see if the droid has gone too far - xdiff = (SDWORD)psDroid->pos.x - (SDWORD)psDroid->actionX; - ydiff = (SDWORD)psDroid->pos.y - (SDWORD)psDroid->actionY; - if (xdiff*xdiff + ydiff*ydiff > SCOUT_ATTACK_DIST*SCOUT_ATTACK_DIST) + // attacking something - see if the droid has gone too far, go up to twice the distance we want to go, so that we don't repeatedly turn back when the target is almost in range. + if (objPosDiffSq(psDroid->pos, Vector3i(psDroid->actionX, psDroid->actionY, 0)) > (SCOUT_ATTACK_DIST*2 * SCOUT_ATTACK_DIST*2)) { actionDroid(psDroid, DACTION_RETURNTOPOS, psDroid->actionX,psDroid->actionY); } @@ -608,7 +598,7 @@ void orderUpdateDroid(DROID *psDroid) // if there is an enemy around, attack it if (psDroid->action == DACTION_MOVE && secondaryGetState(psDroid, DSO_ATTACK_LEVEL) == DSS_ALEV_ALWAYS && - aiBestNearestTarget(psDroid, &psObj, 0, NULL) >= 0) + aiBestNearestTarget(psDroid, &psObj, 0, SCOUT_ATTACK_DIST) >= 0) { switch (psDroid->droidType) { @@ -631,45 +621,27 @@ void orderUpdateDroid(DROID *psDroid) { if (psDroid->action == DACTION_MOVE) { - if ( orderStarted && ((orderStarted + 500) > gameTime) ) - { - break; - } // see if we have anything queued up if (orderDroidList(psDroid)) { // started a new order, quit break; } - orderStarted = gameTime; } - psDroid->action = DACTION_NONE; - xdiff = (SDWORD)psDroid->pos.x - (SDWORD)psDroid->orderX; - ydiff = (SDWORD)psDroid->pos.y - (SDWORD)psDroid->orderY; - if (xdiff*xdiff + ydiff*ydiff <= 2000 * 2000) + Vector2i edgeDiff = removeZ(psDroid->pos) - Vector2i(psDroid->actionX, psDroid->actionY); + if (psDroid->action != DACTION_MOVE || edgeDiff*edgeDiff <= TILE_UNITS*4 * TILE_UNITS*4) { - if (psDroid->order == DORDER_CIRCLE) + //Watermelon:use orderX,orderY as local space origin and calculate droid direction in local space + Vector2i diff = removeZ(psDroid->pos) - Vector2i(psDroid->orderX, psDroid->orderY); + uint16_t angle = iAtan2(diff) - DEG(30); + do { - //Watermelon:use orderX,orderY as local space origin and calculate droid direction in local space - uint16_t angle = iAtan2(xdiff, ydiff); xoffset = iSinR(angle, 1500); yoffset = iCosR(angle, 1500); - xdiff = psDroid->pos.x - (psDroid->orderX + xoffset); - ydiff = psDroid->pos.y - (psDroid->orderY + yoffset); - if (xdiff*xdiff + ydiff*ydiff < TILE_UNITS * TILE_UNITS) - { - //Watermelon:conter-clockwise 30 degree's per action - angle -= DEG(30); - xoffset = iSinR(angle, 1500); - yoffset = iCosR(angle, 1500); - } - actionDroid(psDroid, DACTION_MOVE, psDroid->orderX + xoffset, psDroid->orderY + yoffset); - } - else - { - psDroid->order = DORDER_NONE; - } + angle -= DEG(10); + } while (!worldOnMap(psDroid->orderX + xoffset, psDroid->orderY + yoffset)); // Don't try to fly off map. + actionDroid(psDroid, DACTION_MOVE, psDroid->orderX + xoffset, psDroid->orderY + yoffset); } } else if ((psDroid->action == DACTION_ATTACK) || diff --git a/src/scriptvals_lexer.l b/src/scriptvals_lexer.l index ca8406dd4..36e0269ee 100644 --- a/src/scriptvals_lexer.l +++ b/src/scriptvals_lexer.l @@ -92,7 +92,7 @@ extern void scrv_set_extra(YY_EXTRA_TYPE user_defined); %} -%option yylineno noyywrap nounput never-interactive +%option yylineno noyywrap nounput %option warn nodefault %option prefix="scrv_" diff --git a/src/visibility.cpp b/src/visibility.cpp index a2204af33..6ca691d50 100644 --- a/src/visibility.cpp +++ b/src/visibility.cpp @@ -759,11 +759,12 @@ bool lineOfFire(const SIMPLE_OBJECT* psViewer, const BASE_OBJECT* psTarget, int { psStats = asWeaponStats + ((STRUCTURE*)psViewer)->asWeaps[weapon_slot].nStat; } + // 2d distance + int distance = iHypot(removeZ(psTarget->pos - psViewer->pos)); + int range = proj_GetLongRange(psStats); if (proj_Direct(psStats)) { /** direct shots could collide with ground **/ - int distance = iHypot(psTarget->pos - psViewer->pos); - int range = proj_GetLongRange(psStats); return range >= distance && LINE_OF_FIRE_MINIMUM <= checkFireLine(psViewer, psTarget, weapon_slot, wallsBlock, true); } else @@ -773,10 +774,6 @@ bool lineOfFire(const SIMPLE_OBJECT* psViewer, const BASE_OBJECT* psTarget, int * minimum angle doesn't move it out of range **/ int min_angle = checkFireLine(psViewer, psTarget, weapon_slot, wallsBlock, false); - /** 2d distance **/ - Vector3i diff = psTarget->pos - psViewer->pos; - int distance = iHypot3(diff.x, diff.y, std::max(diff.z, 0)); - int range = proj_GetLongRange(psStats); // NOTE This code seems similar to the code in combFire in combat.cpp. if (min_angle > DEG(PROJ_MAX_PITCH)) { diff --git a/win32/Warzone2100.vs2k8.sln b/win32/Warzone2100.vs2k8.sln deleted file mode 100644 index e045ef942..000000000 --- a/win32/Warzone2100.vs2k8.sln +++ /dev/null @@ -1,107 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Warzone2100", "Warzone2100.vs2k8.vcproj", "{BDDCCB7B-F4F7-4768-A1C3-AE20E9F5FDFC}" - ProjectSection(ProjectDependencies) = postProject - {8136A1F0-463E-44F6-B0B2-64B12F4C27BA} = {8136A1F0-463E-44F6-B0B2-64B12F4C27BA} - {C7698ECE-9255-4A60-8091-A9A76E8BE911} = {C7698ECE-9255-4A60-8091-A9A76E8BE911} - {EFE011B6-4C0B-40AA-9F18-5AD599E70D28} = {EFE011B6-4C0B-40AA-9F18-5AD599E70D28} - {E538D7A9-0660-4979-95F4-80B0C5C11DA7} = {E538D7A9-0660-4979-95F4-80B0C5C11DA7} - {F580F567-CE2A-4C58-A036-C1B71664BF2D} = {F580F567-CE2A-4C58-A036-C1B71664BF2D} - {30F5FC4A-31F5-42F5-9581-45309559382F} = {30F5FC4A-31F5-42F5-9581-45309559382F} - {4D637147-73F9-4A51-944B-34BF78E6C6DC} = {4D637147-73F9-4A51-944B-34BF78E6C6DC} - {32FC4941-5ADF-483F-BD90-CDEBC50BA4AE} = {32FC4941-5ADF-483F-BD90-CDEBC50BA4AE} - {33979915-684A-4885-BFEA-2A4CCC5A5FD6} = {33979915-684A-4885-BFEA-2A4CCC5A5FD6} - {2D0B0F06-3CA2-46C7-908D-5C7098645021} = {2D0B0F06-3CA2-46C7-908D-5C7098645021} - {0A5A8B49-7072-4196-AA26-DD767760C6B5} = {0A5A8B49-7072-4196-AA26-DD767760C6B5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "autorevision", "..\build_tools\autorevision\autorevision.vcproj", "{32FC4941-5ADF-483F-BD90-CDEBC50BA4AE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "widget", "..\lib\widget\widget.vcproj", "{E538D7A9-0660-4979-95F4-80B0C5C11DA7}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound", "..\lib\sound\sound.vcproj", "{8136A1F0-463E-44F6-B0B2-64B12F4C27BA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sequence", "..\lib\sequence\sequence.vcproj", "{30F5FC4A-31F5-42F5-9581-45309559382F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "script", "..\lib\script\script.vcproj", "{2D0B0F06-3CA2-46C7-908D-5C7098645021}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netplay", "..\lib\netplay\netplay.vcproj", "{C7698ECE-9255-4A60-8091-A9A76E8BE911}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ivis_opengl", "..\lib\ivis_opengl\ivis_opengl.vcproj", "{4D637147-73F9-4A51-944B-34BF78E6C6DC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ivis_common", "..\lib\ivis_common\ivis_common.vcproj", "{F580F567-CE2A-4C58-A036-C1B71664BF2D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gamelib", "..\lib\gamelib\gamelib.vcproj", "{EFE011B6-4C0B-40AA-9F18-5AD599E70D28}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "framework", "..\lib\framework\framework.vcproj", "{33979915-684A-4885-BFEA-2A4CCC5A5FD6}" - ProjectSection(ProjectDependencies) = postProject - {9DC871E4-D58D-4AF6-85A6-7DF7A39B8C18} = {9DC871E4-D58D-4AF6-85A6-7DF7A39B8C18} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exceptionhandler", "..\lib\exceptionhandler\exceptionhandler.vcproj", "{9DC871E4-D58D-4AF6-85A6-7DF7A39B8C18}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iniparser", "..\lib\iniparser\iniparser.vcproj", "{0A5A8B49-7072-4196-AA26-DD767760C6B5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BDDCCB7B-F4F7-4768-A1C3-AE20E9F5FDFC}.Debug|Win32.ActiveCfg = Debug|Win32 - {BDDCCB7B-F4F7-4768-A1C3-AE20E9F5FDFC}.Debug|Win32.Build.0 = Debug|Win32 - {BDDCCB7B-F4F7-4768-A1C3-AE20E9F5FDFC}.Release|Win32.ActiveCfg = Release|Win32 - {BDDCCB7B-F4F7-4768-A1C3-AE20E9F5FDFC}.Release|Win32.Build.0 = Release|Win32 - {32FC4941-5ADF-483F-BD90-CDEBC50BA4AE}.Debug|Win32.ActiveCfg = Debug|Win32 - {32FC4941-5ADF-483F-BD90-CDEBC50BA4AE}.Debug|Win32.Build.0 = Debug|Win32 - {32FC4941-5ADF-483F-BD90-CDEBC50BA4AE}.Release|Win32.ActiveCfg = Release|Win32 - {32FC4941-5ADF-483F-BD90-CDEBC50BA4AE}.Release|Win32.Build.0 = Release|Win32 - {E538D7A9-0660-4979-95F4-80B0C5C11DA7}.Debug|Win32.ActiveCfg = Debug|Win32 - {E538D7A9-0660-4979-95F4-80B0C5C11DA7}.Debug|Win32.Build.0 = Debug|Win32 - {E538D7A9-0660-4979-95F4-80B0C5C11DA7}.Release|Win32.ActiveCfg = Release|Win32 - {E538D7A9-0660-4979-95F4-80B0C5C11DA7}.Release|Win32.Build.0 = Release|Win32 - {8136A1F0-463E-44F6-B0B2-64B12F4C27BA}.Debug|Win32.ActiveCfg = Debug|Win32 - {8136A1F0-463E-44F6-B0B2-64B12F4C27BA}.Debug|Win32.Build.0 = Debug|Win32 - {8136A1F0-463E-44F6-B0B2-64B12F4C27BA}.Release|Win32.ActiveCfg = Release|Win32 - {8136A1F0-463E-44F6-B0B2-64B12F4C27BA}.Release|Win32.Build.0 = Release|Win32 - {30F5FC4A-31F5-42F5-9581-45309559382F}.Debug|Win32.ActiveCfg = Debug|Win32 - {30F5FC4A-31F5-42F5-9581-45309559382F}.Debug|Win32.Build.0 = Debug|Win32 - {30F5FC4A-31F5-42F5-9581-45309559382F}.Release|Win32.ActiveCfg = Release|Win32 - {30F5FC4A-31F5-42F5-9581-45309559382F}.Release|Win32.Build.0 = Release|Win32 - {2D0B0F06-3CA2-46C7-908D-5C7098645021}.Debug|Win32.ActiveCfg = Debug|Win32 - {2D0B0F06-3CA2-46C7-908D-5C7098645021}.Debug|Win32.Build.0 = Debug|Win32 - {2D0B0F06-3CA2-46C7-908D-5C7098645021}.Release|Win32.ActiveCfg = Release|Win32 - {2D0B0F06-3CA2-46C7-908D-5C7098645021}.Release|Win32.Build.0 = Release|Win32 - {C7698ECE-9255-4A60-8091-A9A76E8BE911}.Debug|Win32.ActiveCfg = Debug|Win32 - {C7698ECE-9255-4A60-8091-A9A76E8BE911}.Debug|Win32.Build.0 = Debug|Win32 - {C7698ECE-9255-4A60-8091-A9A76E8BE911}.Release|Win32.ActiveCfg = Release|Win32 - {C7698ECE-9255-4A60-8091-A9A76E8BE911}.Release|Win32.Build.0 = Release|Win32 - {4D637147-73F9-4A51-944B-34BF78E6C6DC}.Debug|Win32.ActiveCfg = Debug|Win32 - {4D637147-73F9-4A51-944B-34BF78E6C6DC}.Debug|Win32.Build.0 = Debug|Win32 - {4D637147-73F9-4A51-944B-34BF78E6C6DC}.Release|Win32.ActiveCfg = Release|Win32 - {4D637147-73F9-4A51-944B-34BF78E6C6DC}.Release|Win32.Build.0 = Release|Win32 - {F580F567-CE2A-4C58-A036-C1B71664BF2D}.Debug|Win32.ActiveCfg = Debug|Win32 - {F580F567-CE2A-4C58-A036-C1B71664BF2D}.Debug|Win32.Build.0 = Debug|Win32 - {F580F567-CE2A-4C58-A036-C1B71664BF2D}.Release|Win32.ActiveCfg = Release|Win32 - {F580F567-CE2A-4C58-A036-C1B71664BF2D}.Release|Win32.Build.0 = Release|Win32 - {EFE011B6-4C0B-40AA-9F18-5AD599E70D28}.Debug|Win32.ActiveCfg = Debug|Win32 - {EFE011B6-4C0B-40AA-9F18-5AD599E70D28}.Debug|Win32.Build.0 = Debug|Win32 - {EFE011B6-4C0B-40AA-9F18-5AD599E70D28}.Release|Win32.ActiveCfg = Release|Win32 - {EFE011B6-4C0B-40AA-9F18-5AD599E70D28}.Release|Win32.Build.0 = Release|Win32 - {33979915-684A-4885-BFEA-2A4CCC5A5FD6}.Debug|Win32.ActiveCfg = Debug|Win32 - {33979915-684A-4885-BFEA-2A4CCC5A5FD6}.Debug|Win32.Build.0 = Debug|Win32 - {33979915-684A-4885-BFEA-2A4CCC5A5FD6}.Release|Win32.ActiveCfg = Release|Win32 - {33979915-684A-4885-BFEA-2A4CCC5A5FD6}.Release|Win32.Build.0 = Release|Win32 - {9DC871E4-D58D-4AF6-85A6-7DF7A39B8C18}.Debug|Win32.ActiveCfg = Debug|Win32 - {9DC871E4-D58D-4AF6-85A6-7DF7A39B8C18}.Debug|Win32.Build.0 = Debug|Win32 - {9DC871E4-D58D-4AF6-85A6-7DF7A39B8C18}.Release|Win32.ActiveCfg = Release|Win32 - {9DC871E4-D58D-4AF6-85A6-7DF7A39B8C18}.Release|Win32.Build.0 = Release|Win32 - {0A5A8B49-7072-4196-AA26-DD767760C6B5}.Debug|Win32.ActiveCfg = Debug|Win32 - {0A5A8B49-7072-4196-AA26-DD767760C6B5}.Debug|Win32.Build.0 = Debug|Win32 - {0A5A8B49-7072-4196-AA26-DD767760C6B5}.Release|Win32.ActiveCfg = Release|Win32 - {0A5A8B49-7072-4196-AA26-DD767760C6B5}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/win32/Warzone2100.vs2k8.vcproj b/win32/Warzone2100.vs2k8.vcproj deleted file mode 100644 index e01487c30..000000000 --- a/win32/Warzone2100.vs2k8.vcproj +++ /dev/null @@ -1,1277 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/win32/__BUILD_SCRIPT b/win32/__BUILD_SCRIPT index 19eae3412..0af2f8975 100755 --- a/win32/__BUILD_SCRIPT +++ b/win32/__BUILD_SCRIPT @@ -19,6 +19,7 @@ execute() # Some default configuration settings HOST_TRIPLET=i586-mingw32msvc +DOWNLOADS="$(pwd)/downloads" INSTALLER_VERSION="2.2.0.999" DEBUGFLAG="--disable-debug" CC_FOR_BUILD="gcc" @@ -99,7 +100,7 @@ fi set -x # Make sure that the dependencies have been built -make $MAKE_FLAGS -C libs "HOST_TRIPLET=$HOST_TRIPLET" +make $MAKE_FLAGS -C libs "HOST_TRIPLET=$HOST_TRIPLET" "DOWNLOADS=$DOWNLOADS" cd build diff --git a/win32/libs/dejavu/Makefile b/win32/libs/dejavu/Makefile index 4050c6052..ea14e57ea 100644 --- a/win32/libs/dejavu/Makefile +++ b/win32/libs/dejavu/Makefile @@ -14,7 +14,7 @@ TARGETS:= \ include $(TOPDIR)/rules.mk -extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xjf $^ touch extract-stamp diff --git a/win32/libs/devpkg/Makefile b/win32/libs/devpkg/Makefile index 1a801126a..8dfca60be 100644 --- a/win32/libs/devpkg/Makefile +++ b/win32/libs/devpkg/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:=6a3a37022ffc3c0a573ad2d6c4766b6d include $(TOPDIR)/rules.mk -extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) @test -d $(TOPDIR)/build/libs || { \ echo mkdir -p $(TOPDIR)/build/libs ; \ mkdir -p $(TOPDIR)/build/libs || exit ; \ diff --git a/win32/libs/expat/Makefile b/win32/libs/expat/Makefile index 6562ccf22..b2762c358 100644 --- a/win32/libs/expat/Makefile +++ b/win32/libs/expat/Makefile @@ -12,7 +12,7 @@ TARGET:=$(TOPDIR)/builds/libs/lib/libexpat.la include $(TOPDIR)/rules.mk -extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xzf $^ touch extract-stamp diff --git a/win32/libs/fontconfig/Makefile b/win32/libs/fontconfig/Makefile index 87f7b1ffd..8720e671c 100644 --- a/win32/libs/fontconfig/Makefile +++ b/win32/libs/fontconfig/Makefile @@ -15,7 +15,7 @@ TARGETS:= \ include $(TOPDIR)/rules.mk -$(PKG_SOURCEBASE) extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +$(PKG_SOURCEBASE) extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xzf $^ touch extract-stamp diff --git a/win32/libs/freetype2/Makefile b/win32/libs/freetype2/Makefile index 33e8ee7cb..85a4de127 100644 --- a/win32/libs/freetype2/Makefile +++ b/win32/libs/freetype2/Makefile @@ -12,7 +12,7 @@ TARGET:=$(TOPDIR)/build/libs/lib/libfreetype.la include $(TOPDIR)/rules.mk -extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xjf $^ touch extract-stamp diff --git a/win32/libs/gettext/Makefile b/win32/libs/gettext/Makefile index 858a59081..c8efcc1e7 100644 --- a/win32/libs/gettext/Makefile +++ b/win32/libs/gettext/Makefile @@ -13,7 +13,7 @@ SHELL:=$(shell which bash) include $(TOPDIR)/rules.mk -$(PKG_SOURCEBASE) extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +$(PKG_SOURCEBASE) extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xzf $^ touch extract-stamp diff --git a/win32/libs/iconv/Makefile b/win32/libs/iconv/Makefile index f1acf985c..f2c4b1664 100644 --- a/win32/libs/iconv/Makefile +++ b/win32/libs/iconv/Makefile @@ -12,7 +12,7 @@ TARGET:=$(TOPDIR)/build/libs/lib/libiconv.la include $(TOPDIR)/rules.mk -$(PKG_SOURCEBASE) extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +$(PKG_SOURCEBASE) extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xzf $^ touch extract-stamp diff --git a/win32/libs/ogg/Makefile b/win32/libs/ogg/Makefile index e656020b2..3aa31334e 100644 --- a/win32/libs/ogg/Makefile +++ b/win32/libs/ogg/Makefile @@ -14,7 +14,7 @@ TARGETS:= \ include $(TOPDIR)/rules.mk -$(PKG_SOURCEBASE) extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +$(PKG_SOURCEBASE) extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xzf $^ @echo autoconf ; \ cd $(PKG_SOURCEBASE) && autoconf || $(RM) -r $(PKG_SOURCEBASE) diff --git a/win32/libs/png/Makefile b/win32/libs/png/Makefile index 5195bfe1f..3eb29667a 100644 --- a/win32/libs/png/Makefile +++ b/win32/libs/png/Makefile @@ -12,7 +12,7 @@ TARGET:=$(TOPDIR)/build/libs/lib/libpng14.la include $(TOPDIR)/rules.mk -extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xjf $^ touch extract-stamp diff --git a/win32/libs/sdl/Makefile b/win32/libs/sdl/Makefile index d533d74bd..5a14eb80a 100644 --- a/win32/libs/sdl/Makefile +++ b/win32/libs/sdl/Makefile @@ -15,7 +15,7 @@ TARGETS:= \ include $(TOPDIR)/rules.mk -$(PKG_SOURCEBASE) extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +$(PKG_SOURCEBASE) extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xzf $^ touch extract-stamp diff --git a/win32/libs/theora/Makefile b/win32/libs/theora/Makefile index ce278fb4f..ad921bea0 100644 --- a/win32/libs/theora/Makefile +++ b/win32/libs/theora/Makefile @@ -14,7 +14,7 @@ TARGETS:= \ include $(TOPDIR)/rules.mk -$(PKG_SOURCEBASE) extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +$(PKG_SOURCEBASE) extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xjf $^ touch extract-stamp diff --git a/win32/libs/vorbis/Makefile b/win32/libs/vorbis/Makefile index 1cb2dcae8..bceda7414 100644 --- a/win32/libs/vorbis/Makefile +++ b/win32/libs/vorbis/Makefile @@ -14,7 +14,7 @@ TARGETS:= \ include $(TOPDIR)/rules.mk -$(PKG_SOURCEBASE) extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +$(PKG_SOURCEBASE) extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xzf $^ touch extract-stamp diff --git a/win32/libs/zlib/Makefile b/win32/libs/zlib/Makefile index 848d689aa..e08fa7441 100644 --- a/win32/libs/zlib/Makefile +++ b/win32/libs/zlib/Makefile @@ -12,7 +12,7 @@ TARGETS:=$(TOPDIR)/build/libs/lib/libz.a $(TOPDIR)/build/libs/include/zconf.h $( include $(TOPDIR)/rules.mk -extract-stamp: $(TOPDIR)/downloads/$(PKG_SOURCE) +extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE) tar xzf $^ rm $(PKG_SOURCEBASE)/Makefile touch extract-stamp diff --git a/win32/rules.mk b/win32/rules.mk index 0c00b2a1b..b0c0f3fd9 100644 --- a/win32/rules.mk +++ b/win32/rules.mk @@ -1,10 +1,10 @@ all: build -$(TOPDIR)/downloads/$(PKG_SOURCE): - @if [ ! -d "$(TOPDIR)/downloads" ] ; then \ - echo mkdir -p $(TOPDIR)/downloads ; \ - mkdir -p $(TOPDIR)/downloads || exit ; \ +$(DOWNLOADS)/$(PKG_SOURCE): + @if [ ! -d "$(DOWNLOADS)" ] ; then \ + echo mkdir -p $(DOWNLOADS) ; \ + mkdir -p $(DOWNLOADS) || exit ; \ fi - $(TOPDIR)/download.pl $(TOPDIR)/downloads "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) + $(TOPDIR)/download.pl $(DOWNLOADS) "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) .PHONY: all build clean diff --git a/win32/warzone2100.vs2k8.rc b/win32/warzone2100.vs2k8.rc deleted file mode 100644 index 814ef8541..000000000 --- a/win32/warzone2100.vs2k8.rc +++ /dev/null @@ -1,47 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -1 VERSIONINFO - FILEVERSION 9,9,9,9 - PRODUCTVERSION 9,9,9,9 - FILEFLAGSMASK 0x0L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Warzone 2100 Project" - VALUE "FileDescription", "Warzone 2100" - VALUE "FileVersion", "master" - VALUE "InternalName", "Warzone 2100" - VALUE "LegalCopyright", "Copyright © 2005-2010 Warzone 2100 Project" - VALUE "OriginalFilename", "warzone2100.exe" - VALUE "ProductName", "Warzone 2100" - VALUE "ProductVersion", "master" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 0x04b0 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -2 ICON "../icons/warzone2100.ico"