diff --git a/src/dehacked.c b/src/dehacked.c index ea3b92d511eb97eafe90dc945a97f995a7fa6a18..026ec949f1687d6514e081784d5877d4f16d5e61 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7394,6 +7394,61 @@ struct { {"V_CHARCOLORSHIFT",V_CHARCOLORSHIFT}, {"V_ALPHASHIFT",V_ALPHASHIFT}, + + // conditions + {"UC_PLAYTIME",UC_PLAYTIME}, + {"UC_GAMECLEAR",UC_GAMECLEAR}, + {"UC_ALLEMERALDS",UC_ALLEMERALDS}, + {"UC_ULTIMATECLEAR",UC_ULTIMATECLEAR}, + {"UC_OVERALLSCORE",UC_OVERALLSCORE}, + {"UC_OVERALLTIME",UC_OVERALLTIME}, + {"UC_OVERALLRINGS",UC_OVERALLRINGS}, + {"UC_MAPVISITED",UC_MAPVISITED}, + {"UC_MAPBEATEN",UC_MAPBEATEN}, + {"UC_MAPALLEMERALDS",UC_MAPALLEMERALDS}, + {"UC_MAPULTIMATE",UC_MAPULTIMATE}, + {"UC_MAPPERFECT",UC_MAPPERFECT}, + {"UC_MAPSCORE",UC_MAPSCORE}, + {"UC_MAPTIME",UC_MAPTIME}, + {"UC_MAPRINGS",UC_MAPRINGS}, + {"UC_NIGHTSSCORE",UC_NIGHTSSCORE}, + {"UC_NIGHTSTIME",UC_NIGHTSTIME}, + {"UC_NIGHTSGRADE",UC_NIGHTSGRADE}, + {"UC_TRIGGER",UC_TRIGGER}, + {"UC_TOTALEMBLEMS",UC_TOTALEMBLEMS}, + {"UC_EMBLEM",UC_EMBLEM}, + {"UC_EXTRAEMBLEM",UC_EXTRAEMBLEM}, + {"UC_CONDITIONSET",UC_CONDITIONSET}, + + {"MAXCONDITIONSETS",MAXCONDITIONSETS}, + + // emblems + {"ET_GLOBAL",ET_GLOBAL}, + {"ET_SKIN",ET_SKIN}, + {"ET_SCORE",ET_SCORE}, + {"ET_TIME",ET_TIME}, + {"ET_RINGS",ET_RINGS}, + {"ET_NGRADE",ET_NGRADE}, + {"ET_NTIME",ET_NTIME}, + {"ET_MAP",ET_MAP}, + + {"MAXEMBLEMS",MAXEMBLEMS}, + {"MAXEXTRAEMBLEMS",MAXEXTRAEMBLEMS}, + + // secrets + {"SECRET_NONE",SECRET_NONE}, + {"SECRET_ITEMFINDER",SECRET_ITEMFINDER}, + {"SECRET_EMBLEMHINTS",SECRET_EMBLEMHINTS}, + {"SECRET_PANDORA",SECRET_PANDORA}, + {"SECRET_RECORDATTACK",SECRET_RECORDATTACK}, + {"SECRET_NIGHTSMODE",SECRET_NIGHTSMODE}, + {"SECRET_HEADER",SECRET_HEADER}, + {"SECRET_LEVELSELECT",SECRET_LEVELSELECT}, + {"SECRET_WARP",SECRET_WARP}, + {"SECRET_SOUNDTEST",SECRET_SOUNDTEST}, + {"SECRET_CREDITS",SECRET_CREDITS}, + + {"MAXUNLOCKABLES",MAXUNLOCKABLES}, #endif {NULL,0} diff --git a/src/lua_condlib.c b/src/lua_condlib.c index e27ced1c2e65a542e6f4ddb1c6d0ed4785700ae0..5efca4d63c118bda657e3b441bfb7e9c7d422fc6 100644 --- a/src/lua_condlib.c +++ b/src/lua_condlib.c @@ -58,9 +58,9 @@ static int lib_getConditionsets(lua_State *L) UINT16 i; lua_remove(L, 1); - i = luaL_checkinteger(L, 1)-1; + i = luaL_checkinteger(L, 1); if (i >= MAXCONDITIONSETS) - return luaL_error(L, "conditionSets[] index %d out of range (1 - %d)", i+1, MAXCONDITIONSETS); + return luaL_error(L, "conditionSets[] index %d out of range (0 - %d)", i, MAXCONDITIONSETS-1); LUA_PushUserdata(L, &conditionSets[i], META_CONDITIONSET); return 1; } @@ -117,9 +117,9 @@ static int lib_getEmblemlocations(lua_State *L) UINT16 i; lua_remove(L, 1); - i = luaL_checkinteger(L, 1)-1; + i = luaL_checkinteger(L, 1); if (i >= MAXEMBLEMS) - return luaL_error(L, "emblemlocations[] index %d out of range (1 - %d)", i+1, MAXEMBLEMS); + return luaL_error(L, "emblemlocations[] index %d out of range (0 - %d)", i, MAXEMBLEMS-1); LUA_PushUserdata(L, &emblemlocations[i], META_EMBLEM); return 1; } @@ -168,9 +168,9 @@ static int lib_getExtraemblems(lua_State *L) UINT16 i; lua_remove(L, 1); - i = luaL_checkinteger(L, 1)-1; - if (1 >= MAXEXTRAEMBLEMS) - return luaL_error(L, "extraemblems[] index %d out of range (1 - %d)", i, MAXEXTRAEMBLEMS); + i = luaL_checkinteger(L, 1); + if (i >= MAXEXTRAEMBLEMS) + return luaL_error(L, "extraemblems[] index %d out of range (0 - %d)", i, MAXEXTRAEMBLEMS-1); LUA_PushUserdata(L, &extraemblems[i], META_EXTRAEMBLEM); return 1; } @@ -225,9 +225,9 @@ static int lib_getUnlockables(lua_State *L) UINT16 i; lua_remove(L, 1); - i = luaL_checkinteger(L, 1)-1; + i = luaL_checkinteger(L, 1); if (i >= MAXUNLOCKABLES) - return luaL_error(L, "unlockables[] index %d out of range (1 - %d)", i, MAXUNLOCKABLES); + return luaL_error(L, "unlockables[] index %d out of range (0 - %d)", i, MAXUNLOCKABLES-1); LUA_PushUserdata(L, &unlockables[i], META_UNLOCKABLE); return 1; } @@ -280,7 +280,7 @@ int LUA_CondLib(lua_State *L) lua_pushcfunction(L, lib_numconditionsets); lua_setfield(L, -2, "__len"); lua_setmetatable(L, -2); - lua_setglobal(L, "conditionsets"); + lua_setglobal(L, "conditionSets"); lua_newuserdata(L, 0); lua_createtable(L, 0, 2);