Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Hanicef/SRB2Classic
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Jisk/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
118 results
Show changes
Commits on Source (6)
...@@ -539,8 +539,11 @@ static void readfreeslots(MYFILE *f) ...@@ -539,8 +539,11 @@ static void readfreeslots(MYFILE *f)
{ {
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8))) if (used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8)))
{ {
if (!sprnames[i][4] && memcmp(sprnames[i],word,4)==0) if (memcmp(sprnames[i],word,4)==0)
sprnames[i][4] = (char)f->wad; {
deh_warning("Freeslots: Sprite 'SPR_%s' already exists", word);
break; // don't continue
}
continue; // Already allocated, next. continue; // Already allocated, next.
} }
// Found a free slot! // Found a free slot!
...@@ -552,21 +555,31 @@ static void readfreeslots(MYFILE *f) ...@@ -552,21 +555,31 @@ static void readfreeslots(MYFILE *f)
} }
else if (fastcmp(type, "S")) else if (fastcmp(type, "S"))
{ {
for (i = 0; i < NUMSTATEFREESLOTS; i++) for (i = 0; i < NUMSTATEFREESLOTS; i++) {
if (!FREE_STATES[i]) { if (!FREE_STATES[i]) {
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL); FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_STATES[i],word); strcpy(FREE_STATES[i],word);
break; break;
} }
else if (fastcmp(word, FREE_STATES[i])) {
deh_warning("Freeslots: State 'S_%s' already exists", word);
break; // don't continue
}
}
} }
else if (fastcmp(type, "MT")) else if (fastcmp(type, "MT"))
{ {
for (i = 0; i < NUMMOBJFREESLOTS; i++) for (i = 0; i < NUMMOBJFREESLOTS; i++) {
if (!FREE_MOBJS[i]) { if (!FREE_MOBJS[i]) {
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL); FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_MOBJS[i],word); strcpy(FREE_MOBJS[i],word);
break; break;
} }
else if (fastcmp(word, FREE_MOBJS[i])) {
deh_warning("Freeslots: MobjType 'MT_%s' already exists", word);
break; // don't continue
}
}
} }
else if (fastcmp(type, "SKINCOLOR")) else if (fastcmp(type, "SKINCOLOR"))
{ {
...@@ -577,13 +590,20 @@ static void readfreeslots(MYFILE *f) ...@@ -577,13 +590,20 @@ static void readfreeslots(MYFILE *f)
M_AddMenuColor(numskincolors++); M_AddMenuColor(numskincolors++);
break; break;
} }
else if (fastcmp(word, FREE_SKINCOLORS[i])) {
deh_warning("Freeslots: Skincolor 'SKINCOLOR_%s' already exists", word);
break; // don't continue
}
} }
else if (fastcmp(type, "SPR2")) else if (fastcmp(type, "SPR2"))
{ {
// Search if we already have an SPR2 by that name... // Search if we already have an SPR2 by that name...
for (i = SPR2_FIRSTFREESLOT; i < (int)free_spr2; i++) for (i = SPR2_FIRSTFREESLOT; i < (int)free_spr2; i++)
if (memcmp(spr2names[i],word,4) == 0) if (memcmp(spr2names[i],word,4) == 0)
{
deh_warning("Freeslots: Player sprite 'SPR2_%s' already exists", word);
break; break;
}
// We found it? (Two mods using the same SPR2 name?) Then don't allocate another one. // We found it? (Two mods using the same SPR2 name?) Then don't allocate another one.
if (i < (int)free_spr2) if (i < (int)free_spr2)
continue; continue;
...@@ -10155,8 +10175,14 @@ static spritenum_t get_sprite(const char *word) ...@@ -10155,8 +10175,14 @@ static spritenum_t get_sprite(const char *word)
if (fastncmp("SPR_",word,4)) if (fastncmp("SPR_",word,4))
word += 4; // take off the SPR_ word += 4; // take off the SPR_
for (i = 0; i < NUMSPRITES; i++) for (i = 0; i < NUMSPRITES; i++)
if (!sprnames[i][4] && memcmp(word,sprnames[i],4)==0) {
if (i >= SPR_FIRSTFREESLOT) {
if (!(used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8))))
break;
}
if (memcmp(word,sprnames[i],4)==0)
return i; return i;
}
deh_warning("Couldn't find sprite named 'SPR_%s'",word); deh_warning("Couldn't find sprite named 'SPR_%s'",word);
return SPR_NULL; return SPR_NULL;
} }
...@@ -10628,17 +10654,15 @@ static inline int lib_freeslot(lua_State *L) ...@@ -10628,17 +10654,15 @@ static inline int lib_freeslot(lua_State *L)
} }
else if (fastcmp(type, "SPR")) else if (fastcmp(type, "SPR"))
{ {
char wad;
spritenum_t j; spritenum_t j;
lua_getfield(L, LUA_REGISTRYINDEX, "WAD");
wad = (char)lua_tointeger(L, -1);
lua_pop(L, 1);
for (j = SPR_FIRSTFREESLOT; j <= SPR_LASTFREESLOT; j++) for (j = SPR_FIRSTFREESLOT; j <= SPR_LASTFREESLOT; j++)
{ {
if (used_spr[(j-SPR_FIRSTFREESLOT)/8] & (1<<(j%8))) if (used_spr[(j-SPR_FIRSTFREESLOT)/8] & (1<<(j%8)))
{ {
if (!sprnames[j][4] && memcmp(sprnames[j],word,4)==0) if (memcmp(sprnames[j],word,4)==0) {
sprnames[j][4] = wad; CONS_Printf("Sprite SPR_%s already exists.\n", word);
break; // don't continue
}
continue; // Already allocated, next. continue; // Already allocated, next.
} }
// Found a free slot! // Found a free slot!
...@@ -10656,7 +10680,7 @@ static inline int lib_freeslot(lua_State *L) ...@@ -10656,7 +10680,7 @@ static inline int lib_freeslot(lua_State *L)
else if (fastcmp(type, "S")) else if (fastcmp(type, "S"))
{ {
statenum_t i; statenum_t i;
for (i = 0; i < NUMSTATEFREESLOTS; i++) for (i = 0; i < NUMSTATEFREESLOTS; i++) {
if (!FREE_STATES[i]) { if (!FREE_STATES[i]) {
CONS_Printf("State S_%s allocated.\n",word); CONS_Printf("State S_%s allocated.\n",word);
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL); FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
...@@ -10665,13 +10689,18 @@ static inline int lib_freeslot(lua_State *L) ...@@ -10665,13 +10689,18 @@ static inline int lib_freeslot(lua_State *L)
r++; r++;
break; break;
} }
else if (fastcmp(word, FREE_STATES[i])) {
CONS_Printf("State S_%s already exists.\n", word);
break;
}
}
if (i == NUMSTATEFREESLOTS) if (i == NUMSTATEFREESLOTS)
CONS_Alert(CONS_WARNING, "Ran out of free State slots!\n"); CONS_Alert(CONS_WARNING, "Ran out of free State slots!\n");
} }
else if (fastcmp(type, "MT")) else if (fastcmp(type, "MT"))
{ {
mobjtype_t i; mobjtype_t i;
for (i = 0; i < NUMMOBJFREESLOTS; i++) for (i = 0; i < NUMMOBJFREESLOTS; i++) {
if (!FREE_MOBJS[i]) { if (!FREE_MOBJS[i]) {
CONS_Printf("MobjType MT_%s allocated.\n",word); CONS_Printf("MobjType MT_%s allocated.\n",word);
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL); FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
...@@ -10680,13 +10709,18 @@ static inline int lib_freeslot(lua_State *L) ...@@ -10680,13 +10709,18 @@ static inline int lib_freeslot(lua_State *L)
r++; r++;
break; break;
} }
else if (fastcmp(word, FREE_MOBJS[i])) {
CONS_Printf("MobjType MT_%s already exists.\n", word);
break;
}
}
if (i == NUMMOBJFREESLOTS) if (i == NUMMOBJFREESLOTS)
CONS_Alert(CONS_WARNING, "Ran out of free MobjType slots!\n"); CONS_Alert(CONS_WARNING, "Ran out of free MobjType slots!\n");
} }
else if (fastcmp(type, "SKINCOLOR")) else if (fastcmp(type, "SKINCOLOR"))
{ {
skincolornum_t i; skincolornum_t i;
for (i = 0; i < NUMCOLORFREESLOTS; i++) for (i = 0; i < NUMCOLORFREESLOTS; i++) {
if (!FREE_SKINCOLORS[i]) { if (!FREE_SKINCOLORS[i]) {
CONS_Printf("Skincolor SKINCOLOR_%s allocated.\n",word); CONS_Printf("Skincolor SKINCOLOR_%s allocated.\n",word);
FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL); FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
...@@ -10696,6 +10730,11 @@ static inline int lib_freeslot(lua_State *L) ...@@ -10696,6 +10730,11 @@ static inline int lib_freeslot(lua_State *L)
r++; r++;
break; break;
} }
else if (fastcmp(word, FREE_SKINCOLORS[i])) {
CONS_Printf("Skincolor SKINCOLOR_%s already exists.\n", word);
break;
}
}
if (i == NUMCOLORFREESLOTS) if (i == NUMCOLORFREESLOTS)
CONS_Alert(CONS_WARNING, "Ran out of free skincolor slots!\n"); CONS_Alert(CONS_WARNING, "Ran out of free skincolor slots!\n");
} }
...@@ -10705,7 +10744,10 @@ static inline int lib_freeslot(lua_State *L) ...@@ -10705,7 +10744,10 @@ static inline int lib_freeslot(lua_State *L)
playersprite_t i; playersprite_t i;
for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++) for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++)
if (memcmp(spr2names[i],word,4) == 0) if (memcmp(spr2names[i],word,4) == 0)
{
CONS_Printf("Player sprite SPR2_%s already exists.\n", word);
break; break;
}
// We don't, so allocate a new one. // We don't, so allocate a new one.
if (i >= free_spr2) { if (i >= free_spr2) {
if (free_spr2 < NUMPLAYERSPRITES) if (free_spr2 < NUMPLAYERSPRITES)
...@@ -10713,9 +10755,9 @@ static inline int lib_freeslot(lua_State *L) ...@@ -10713,9 +10755,9 @@ static inline int lib_freeslot(lua_State *L)
CONS_Printf("Sprite SPR2_%s allocated.\n",word); CONS_Printf("Sprite SPR2_%s allocated.\n",word);
strncpy(spr2names[free_spr2],word,4); strncpy(spr2names[free_spr2],word,4);
spr2defaults[free_spr2] = 0; spr2defaults[free_spr2] = 0;
lua_pushinteger(L, free_spr2); spr2names[free_spr2][4] = 0;
lua_pushinteger(L, free_spr2++);
r++; r++;
spr2names[free_spr2++][4] = 0;
} else } else
CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n"); CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n");
} }
...@@ -10927,11 +10969,16 @@ static inline int lib_getenum(lua_State *L) ...@@ -10927,11 +10969,16 @@ static inline int lib_getenum(lua_State *L)
} }
else if (fastncmp("SPR_",word,4)) { else if (fastncmp("SPR_",word,4)) {
p = word+4; p = word+4;
for (i = 0; i < NUMSPRITES; i++) for (i = 0; i < NUMSPRITES; i++) {
if (!sprnames[i][4] && fastncmp(p,sprnames[i],4)) { if (i >= SPR_FIRSTFREESLOT) {
if (!(used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8))))
break;
}
if (fastncmp(p,sprnames[i],4)) {
lua_pushinteger(L, i); lua_pushinteger(L, i);
return 1; return 1;
} }
}
if (mathlib) return luaL_error(L, "sprite '%s' could not be found.\n", word); if (mathlib) return luaL_error(L, "sprite '%s' could not be found.\n", word);
return 0; return 0;
} }
......
...@@ -480,8 +480,6 @@ static inline void LUA_LoadFile(MYFILE *f, char *name, boolean noresults) ...@@ -480,8 +480,6 @@ static inline void LUA_LoadFile(MYFILE *f, char *name, boolean noresults)
CONS_Printf("Loading Lua script from %s\n", name); CONS_Printf("Loading Lua script from %s\n", name);
if (!gL) // Lua needs to be initialized if (!gL) // Lua needs to be initialized
LUA_ClearState(); LUA_ClearState();
lua_pushinteger(gL, f->wad);
lua_setfield(gL, LUA_REGISTRYINDEX, "WAD");
lua_lumploading++; // turn on loading flag lua_lumploading++; // turn on loading flag
......