mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Add lifeCap, coinCap and coinToLife to gLevelValues (#429)
* Add lifeCap, coinCap and coinToLife to gLevelValues * autogen * forgor * renamed the properties
This commit is contained in:
parent
4210312a6a
commit
809cbc314b
8 changed files with 62 additions and 11 deletions
|
@ -663,10 +663,13 @@
|
|||
--- @field public hudCapTimer integer
|
||||
--- @field public hudRedCoinsRadar integer
|
||||
--- @field public hudSecretsRadar integer
|
||||
--- @field public maxCoins integer
|
||||
--- @field public maxLives integer
|
||||
--- @field public metalCapDuration integer
|
||||
--- @field public metalCapDurationCotmc integer
|
||||
--- @field public metalCapSequence integer
|
||||
--- @field public mushroom1UpHeal integer
|
||||
--- @field public numCoinsToLife integer
|
||||
--- @field public pauseExitAnywhere boolean
|
||||
--- @field public previewBlueCoins integer
|
||||
--- @field public pssSlideStarIndex integer
|
||||
|
|
|
@ -969,10 +969,13 @@
|
|||
| hudCapTimer | `integer` | |
|
||||
| hudRedCoinsRadar | `integer` | |
|
||||
| hudSecretsRadar | `integer` | |
|
||||
| maxCoins | `integer` | |
|
||||
| maxLives | `integer` | |
|
||||
| metalCapDuration | `integer` | |
|
||||
| metalCapDurationCotmc | `integer` | |
|
||||
| metalCapSequence | `integer` | |
|
||||
| mushroom1UpHeal | `integer` | |
|
||||
| numCoinsToLife | `integer` | |
|
||||
| pauseExitAnywhere | `boolean` | |
|
||||
| previewBlueCoins | `integer` | |
|
||||
| pssSlideStarIndex | `integer` | |
|
||||
|
|
|
@ -115,6 +115,9 @@ struct LevelValues gDefaultLevelValues = {
|
|||
.pauseExitAnywhere = 1,
|
||||
.disableActs = false,
|
||||
.wingCapLookUpReq = 10,
|
||||
.maxLives = 100,
|
||||
.maxCoins = 999,
|
||||
.numCoinsToLife = 50
|
||||
};
|
||||
|
||||
struct LevelValues gLevelValues = { 0 };
|
||||
|
|
|
@ -82,6 +82,9 @@ struct LevelValues {
|
|||
s16 floorLowerLimitShadow;
|
||||
bool pauseExitAnywhere;
|
||||
bool disableActs;
|
||||
u16 maxLives;
|
||||
u16 maxCoins;
|
||||
u16 numCoinsToLife;
|
||||
};
|
||||
|
||||
extern struct LevelValues gLevelValues;
|
||||
|
|
|
@ -3316,7 +3316,7 @@ void print_hud_course_complete_coins(s16 x, s16 y) {
|
|||
gCourseCompleteCoins++;
|
||||
play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gGlobalSoundSource);
|
||||
|
||||
if (gCourseCompleteCoins == 50 || gCourseCompleteCoins == 100 || gCourseCompleteCoins == 150) {
|
||||
if (gCourseCompleteCoins % gLevelValues.numCoinsToLife == 0 && gCourseCompleteCoins > 0) {
|
||||
play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource);
|
||||
gMarioStates[0].numLives++;
|
||||
}
|
||||
|
|
|
@ -1071,28 +1071,28 @@ void update_hud_values(void) {
|
|||
gHudDisplay.coins += 1;
|
||||
play_sound(coinSound, gMarioState->marioObj->header.gfx.cameraToObject);
|
||||
|
||||
if (gServerSettings.stayInLevelAfterStar > 0 && gCurrCourseNum != COURSE_NONE && (gHudDisplay.coins == 50 || gHudDisplay.coins == 100 || gHudDisplay.coins == 150)) {
|
||||
if (gServerSettings.stayInLevelAfterStar > 0 && gCurrCourseNum != COURSE_NONE && (gHudDisplay.coins % gLevelValues.numCoinsToLife == 0 && gHudDisplay.coins > 0)) {
|
||||
gMarioState->numLives++;
|
||||
play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gMarioState->numLives > 100) {
|
||||
gMarioState->numLives = 100;
|
||||
if (gMarioState->numLives > gLevelValues.maxLives) {
|
||||
gMarioState->numLives = gLevelValues.maxLives;
|
||||
}
|
||||
|
||||
#if BUGFIX_MAX_LIVES
|
||||
if (gMarioState->numCoins > 999) {
|
||||
gMarioState->numCoins = 999;
|
||||
if (gMarioState->numCoins > gLevelValues.maxCoins) {
|
||||
gMarioState->numCoins = gLevelValues.maxCoins;
|
||||
}
|
||||
|
||||
if (gHudDisplay.coins > 999) {
|
||||
gHudDisplay.coins = 999;
|
||||
if (gHudDisplay.coins > gLevelValues.maxCoins) {
|
||||
gHudDisplay.coins = gLevelValues.maxCoins;
|
||||
}
|
||||
#else
|
||||
if (gMarioState->numCoins > 999) {
|
||||
gMarioState->numCoins = (s16) 999;
|
||||
if (gMarioState->numCoins > gLevelValues.maxCoins) {
|
||||
gMarioState->numCoins = (s16) gLevelValues.maxCoins;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -743,7 +743,7 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] =
|
|||
{ "yaw", LVT_S16, offsetof(struct LakituState, yaw), false, LOT_NONE },
|
||||
};
|
||||
|
||||
#define LUA_LEVEL_VALUES_FIELD_COUNT 42
|
||||
#define LUA_LEVEL_VALUES_FIELD_COUNT 45
|
||||
static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = {
|
||||
{ "cellHeightLimit", LVT_S16, offsetof(struct LevelValues, cellHeightLimit), false, LOT_NONE },
|
||||
{ "coinsRequiredForCoinStar", LVT_S16, offsetof(struct LevelValues, coinsRequiredForCoinStar), false, LOT_NONE },
|
||||
|
@ -766,10 +766,13 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] =
|
|||
{ "hudCapTimer", LVT_U8, offsetof(struct LevelValues, hudCapTimer), false, LOT_NONE },
|
||||
{ "hudRedCoinsRadar", LVT_U8, offsetof(struct LevelValues, hudRedCoinsRadar), false, LOT_NONE },
|
||||
{ "hudSecretsRadar", LVT_U8, offsetof(struct LevelValues, hudSecretsRadar), false, LOT_NONE },
|
||||
{ "maxCoins", LVT_U16, offsetof(struct LevelValues, maxCoins), false, LOT_NONE },
|
||||
{ "maxLives", LVT_U16, offsetof(struct LevelValues, maxLives), false, LOT_NONE },
|
||||
{ "metalCapDuration", LVT_U16, offsetof(struct LevelValues, metalCapDuration), false, LOT_NONE },
|
||||
{ "metalCapDurationCotmc", LVT_U16, offsetof(struct LevelValues, metalCapDurationCotmc), false, LOT_NONE },
|
||||
{ "metalCapSequence", LVT_U8, offsetof(struct LevelValues, metalCapSequence), false, LOT_NONE },
|
||||
{ "mushroom1UpHeal", LVT_U8, offsetof(struct LevelValues, mushroom1UpHeal), false, LOT_NONE },
|
||||
{ "numCoinsToLife", LVT_U16, offsetof(struct LevelValues, numCoinsToLife), false, LOT_NONE },
|
||||
{ "pauseExitAnywhere", LVT_BOOL, offsetof(struct LevelValues, pauseExitAnywhere), false, LOT_NONE },
|
||||
{ "previewBlueCoins", LVT_U8, offsetof(struct LevelValues, previewBlueCoins), false, LOT_NONE },
|
||||
{ "pssSlideStarIndex", LVT_U8, offsetof(struct LevelValues, pssSlideStarIndex), false, LOT_NONE },
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
char gSmluaConstants[] = ""
|
||||
"math.randomseed(get_time())\n"
|
||||
"\n"
|
||||
"_CObjectPool = {}\n"
|
||||
"\n"
|
||||
"_CObject = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" return _get_field(t['_lot'], t['_pointer'], k, t)\n"
|
||||
|
@ -15,10 +17,12 @@ char gSmluaConstants[] = ""
|
|||
" return a['_pointer'] == b['_pointer'] and a['_lot'] == b['_lot'] and a['_pointer'] ~= nil and a['_lot'] ~= nil\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"function _NewCObject(lot, pointer)\n"
|
||||
" if _CObjectPool[lot] == nil then\n"
|
||||
" _CObjectPool[lot] = {}\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" if _CObjectPool[lot][pointer] == nil then\n"
|
||||
" local obj = {}\n"
|
||||
" rawset(obj, '_pointer', pointer)\n"
|
||||
|
@ -27,9 +31,12 @@ char gSmluaConstants[] = ""
|
|||
" _CObjectPool[lot][pointer] = obj\n"
|
||||
" return obj\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" return _CObjectPool[lot][pointer]\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"local _CPointerPool = {}\n"
|
||||
"\n"
|
||||
"_CPointer = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" return nil\n"
|
||||
|
@ -43,10 +50,12 @@ char gSmluaConstants[] = ""
|
|||
" return a['_pointer'] == b['_pointer'] and a['_pointer'] ~= nil and a['_lvt'] ~= nil\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"function _NewCPointer(lvt, pointer)\n"
|
||||
" if _CPointerPool[lvt] == nil then\n"
|
||||
" _CPointerPool[lvt] = {}\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" if _CPointerPool[lvt][pointer] == nil then\n"
|
||||
" local obj = {}\n"
|
||||
" rawset(obj, '_pointer', pointer)\n"
|
||||
|
@ -55,8 +64,10 @@ char gSmluaConstants[] = ""
|
|||
" _CPointerPool[lvt][pointer] = obj\n"
|
||||
" return obj\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" return _CPointerPool[lvt][pointer]\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"_SyncTable = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" local _table = rawget(t, '_table')\n"
|
||||
|
@ -68,6 +79,7 @@ char gSmluaConstants[] = ""
|
|||
" _set_sync_table_field(t, k, v)\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"_ReadOnlyTable = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" local _table = rawget(t, '_table')\n"
|
||||
|
@ -76,6 +88,7 @@ char gSmluaConstants[] = ""
|
|||
" __newindex = function (t,k,v)\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param src Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -85,6 +98,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = src.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param x number\n"
|
||||
"--- @param y number\n"
|
||||
|
@ -96,6 +110,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -105,6 +120,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z + a.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @param b Vec3f\n"
|
||||
|
@ -115,6 +131,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = a.z + b.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a number\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -124,6 +141,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z * a\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
"function vec3f_normalize(dest)\n"
|
||||
|
@ -131,23 +149,28 @@ char gSmluaConstants[] = ""
|
|||
" if divisor == 0 then\n"
|
||||
" return dest\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" local invsqrt = 1.0 / divisor\n"
|
||||
" dest.x = dest.x * invsqrt\n"
|
||||
" dest.y = dest.y * invsqrt\n"
|
||||
" dest.z = dest.z * invsqrt\n"
|
||||
"\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @return number\n"
|
||||
"function vec3f_length(a)\n"
|
||||
" return math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @param b Vec3f\n"
|
||||
"--- @return number\n"
|
||||
"function vec3f_dot(a, b)\n"
|
||||
" return a.x * b.x + a.y * b.y + a.z * b.z\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param vec Vec3f\n"
|
||||
"--- @param onto Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -159,6 +182,7 @@ char gSmluaConstants[] = ""
|
|||
" vec3f_mul(out, numerator / denominator)\n"
|
||||
" return out\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param v1 Vec3f\n"
|
||||
"--- @param v2 Vec3f\n"
|
||||
"--- @return number\n"
|
||||
|
@ -168,6 +192,7 @@ char gSmluaConstants[] = ""
|
|||
" dz = v1.z - v2.z\n"
|
||||
" return math.sqrt(dx * dx + dy * dy + dz * dz)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param src Vec3s\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -177,6 +202,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = src.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param x number\n"
|
||||
"--- @param y number\n"
|
||||
|
@ -188,6 +214,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a Vec3s\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -197,6 +224,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z + a.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a Vec3s\n"
|
||||
"--- @param b Vec3s\n"
|
||||
|
@ -207,6 +235,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = a.z + b.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a number\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -216,6 +245,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z * a\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param v1 Vec3s\n"
|
||||
"--- @param v2 Vec3s\n"
|
||||
"--- @return number\n"
|
||||
|
@ -225,6 +255,7 @@ char gSmluaConstants[] = ""
|
|||
" dz = v1.z - v2.z\n"
|
||||
" return math.sqrt(dx * dx + dy * dy + dz * dz)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param current number\n"
|
||||
"--- @param target number\n"
|
||||
"--- @param inc number\n"
|
||||
|
@ -244,6 +275,7 @@ char gSmluaConstants[] = ""
|
|||
" end\n"
|
||||
" return current;\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param current number\n"
|
||||
"--- @param target number\n"
|
||||
"--- @param inc number\n"
|
||||
|
@ -261,6 +293,7 @@ char gSmluaConstants[] = ""
|
|||
" current = target\n"
|
||||
" end\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" -- keep within 32 bits\n"
|
||||
" if current > 2147483647 then\n"
|
||||
" current = -2147483648 + (current - 2147483647)\n"
|
||||
|
@ -269,6 +302,7 @@ char gSmluaConstants[] = ""
|
|||
" end\n"
|
||||
" return current;\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param bank number\n"
|
||||
"--- @param soundID number\n"
|
||||
"--- @param priority number\n"
|
||||
|
@ -278,9 +312,11 @@ char gSmluaConstants[] = ""
|
|||
" if flags == nil then flags = 0 end\n"
|
||||
" return (bank << 28) | (soundID << 16) | (priority << 8) | flags | SOUND_STATUS_WAITING\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"-------------\n"
|
||||
"-- courses --\n"
|
||||
"-------------\n"
|
||||
"\n"
|
||||
"--- @type integer\n"
|
||||
"COURSE_NONE = 0\n"
|
||||
"--- @type integer\n"
|
||||
|
|
Loading…
Reference in a new issue