Merge branch 'nightly'

This commit is contained in:
Vortrex
2022-03-07 02:28:57 -06:00
48 changed files with 1005 additions and 486 deletions

View File

@@ -56,14 +56,18 @@ function makePedStopAnimation(pedId) {
return false;
}
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
if(getGame() != VRR_GAME_GTA_IV) {
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
}
}
if(getElementFromId(pedId) == localPlayer) {
localPlayer.collisionsEnabled = true;
if(getGame() != VRR_GAME_GTA_IV) {
localPlayer.collisionsEnabled = true;
}
setLocalPlayerControlState(true, false);
}
}

View File

@@ -8,7 +8,7 @@
// ===========================================================================
function getCustomImage(imageName) {
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
if(contentResource != null) {
if(contentResource.isStarted) {
let image = contentResource.exports.getCustomImage(imageName);
@@ -23,7 +23,7 @@ function getCustomImage(imageName) {
// ===========================================================================
function getCustomFont(fontName) {
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
if(contentResource != null) {
if(contentResource.isStarted) {
let font = contentResource.exports.getCustomFont(fontName);
@@ -38,7 +38,7 @@ function getCustomFont(fontName) {
// ===========================================================================
function getCustomAudio(audioName) {
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
if(contentResource != null) {
if(contentResource.isStarted) {
let audioFile = contentResource.exports.getCustomAudio(audioName);
@@ -53,7 +53,7 @@ function getCustomAudio(audioName) {
// ===========================================================================
function playCustomAudio(audioName, volume = 0.5, loop = false) {
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
if(contentResource != null) {
if(contentResource.isStarted) {
contentResource.exports.playCustomAudio(audioName, volume, loop);

View File

@@ -91,7 +91,7 @@ function initGUI() {
// ===========================================================================
let closeAllWindows = function() {
function closeAllWindows() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing all GUI windows`);
infoDialog.window.shown = false;
yesNoDialog.window.shown = false;
@@ -104,6 +104,7 @@ let closeAllWindows = function() {
listDialog.window.shown = false;
resetPassword.window.shown = false;
passwordChange.window.shown = false;
mexui.setInput(false);
mexui.focusedControl = false;
@@ -116,7 +117,7 @@ let closeAllWindows = function() {
// ===========================================================================
let isAnyGUIActive = function() {
function isAnyGUIActive() {
if(!guiReady) {
return false;
}
@@ -299,14 +300,22 @@ function processGUIKeyPress(keyCode) {
if(guiSubmitKey != false) {
guiSubmitKey();
}
} else if(keyCode == SDLK_LEFT) {
} else if(keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
if(guiLeftKey != false) {
guiLeftKey();
}
} else if(keyCode == SDLK_RIGHT) {
} else if(keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
if(guiRightKey != false) {
guiRightKey();
}
} else if(keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
if(guiDownKey != false) {
guiDownKey();
}
} else if(keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
if(guiUpKey != false) {
guiUpKey();
}
}
}

View File

@@ -15,4 +15,6 @@ let clanManager = {
vehiclesTab: null,
businessesTab: null,
housesTab: null,
};
};
// ===========================================================================

View File

@@ -46,7 +46,7 @@ function initErrorDialogGUI() {
},
});
errorDialog.okayButton = errorDialog.window.button(5, 105, 395, 30, 'OK', {
errorDialog.okayButton = errorDialog.window.button(5, 105, 390, 30, 'OK', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),

View File

@@ -45,7 +45,7 @@ function initInfoDialogGUI() {
},
});
infoDialog.okayButton = infoDialog.window.button(5, 105, 395, 30, 'OK', {
infoDialog.okayButton = infoDialog.window.button(5, 105, 390, 30, 'OK', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),

View File

@@ -22,7 +22,7 @@ let login = {
function initLoginGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
login.window = mexui.window(game.width/2-150, game.height/2-130, 300, 260, 'LOGIN', {
login.window = mexui.window(game.width/2-150, game.height/2-135, 300, 275, 'LOGIN', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -42,7 +42,7 @@ function initLoginGUI() {
login.window.titleBarIconSize = toVector2(0,0);
login.window.titleBarHeight = 0;
login.logoImage = login.window.image(5, 20, 290, 80, mainLogoPath, {
login.logoImage = login.window.image(5, 20, 290, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
@@ -168,4 +168,6 @@ function switchToPasswordResetGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
showResetPasswordGUI();
return false;
}
}
// ===========================================================================

View File

@@ -21,7 +21,7 @@ let newCharacter = {
function initNewCharacterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
newCharacter.window = mexui.window(game.width/2-130, game.height/2-100, 300, 200, 'New Character', {
newCharacter.window = mexui.window(game.width/2-130, game.height/2-115, 300, 230, 'New Character', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -46,7 +46,7 @@ function initNewCharacterGUI() {
},
});
newCharacter.messageLabel = newCharacter.window.text(20, 75, 260, 20, 'Name your character', {
newCharacter.messageLabel = newCharacter.window.text(20, 100, 260, 20, 'Name your character', {
main: {
textSize: 10.0,
textAlign: 0.5,
@@ -58,7 +58,7 @@ function initNewCharacterGUI() {
},
});
newCharacter.firstNameInput = newCharacter.window.textInput(20, 100, 260, 25, '', {
newCharacter.firstNameInput = newCharacter.window.textInput(20, 125, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
@@ -77,7 +77,7 @@ function initNewCharacterGUI() {
});
newCharacter.firstNameInput.placeholder = "First Name";
newCharacter.lastNameInput = newCharacter.window.textInput(20, 130, 260, 25, '', {
newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
@@ -96,7 +96,7 @@ function initNewCharacterGUI() {
});
newCharacter.lastNameInput.placeholder = "Last Name";
newCharacter.createCharacterButton = newCharacter.window.button(20, 160, 260, 25, 'CREATE CHARACTER', {
newCharacter.createCharacterButton = newCharacter.window.button(20, 185, 260, 25, 'CREATE CHARACTER', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(255, 255, 255, 255),

View File

@@ -90,4 +90,6 @@ function hideJobRouteLocation() {
destroyElement(jobRouteLocationBlip);
jobRouteLocationSphere = null;
jobRouteLocationBlip = null;
}
}
// ===========================================================================

View File

@@ -52,7 +52,7 @@ function deleteGameElement(element, position) {
// ===========================================================================
function createGameVehicle(modelIndex, position, heading) {
return game.createVehicle(getGameData().vehicles[getGame()][modelIndex][0], position, heading);
return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
}
// ===========================================================================

View File

@@ -82,6 +82,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
addNetworkEventHandler("vrr.gameScript", setGameScriptState);
@@ -128,10 +129,12 @@ function setPlayer2DRendering(hudState, labelState, smallGameMessageState, score
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
renderHUD = hudState;
if(typeof setHUDEnabled != "undefined") {
if(getGame() == VRR_GAME_GTA_IV) {
natives.displayHud(false);
} else {
if(getGame() == VRR_GAME_GTA_IV) {
natives.displayCash(hudState);
natives.displayAmmo(hudState);
natives.displayHud(hudState);
} else {
if(typeof setHUDEnabled != "undefined") {
setHUDEnabled(hudState);
}
}
@@ -297,4 +300,15 @@ function setLocalPlayerInfiniteRun(state) {
}
}
// ===========================================================================
function setLocalPlayerSkin(skinId) {
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), skinId);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = skinId;
}
}
// ===========================================================================

View File

@@ -53,7 +53,12 @@ function processSkinSelectKeyPress(keyCode) {
}
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
} else if(keyCode == SDLK_PAGEDOWN) {
if(skinSelectorIndex <= 0) {
skinSelectorIndex = allowedSkins.length-1;
@@ -62,7 +67,12 @@ function processSkinSelectKeyPress(keyCode) {
}
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
} else if(keyCode == SDLK_RETURN) {
sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
toggleSkinSelect(false);
@@ -109,7 +119,13 @@ function toggleSkinSelect(state) {
game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
}
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
setLocalPlayerControlState(false, false);
} else {

View File

@@ -116,7 +116,7 @@ function syncVehicleProperties(vehicle) {
}
if(getGame() == VRR_GAME_GTA_SA) {
let allUpgrades = getGameData().vehicleUpgrades[getGame()];
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
for(let i in allUpgrades) {
vehicle.removeUpgrade(i);
}
@@ -391,4 +391,20 @@ function syncElementProperties(element) {
}
}
// ===========================================================================
function receiveBlipFromServer(model, position) {
if(getGame() == VRR_GAME_GTA_IV) {
}
}
// ===========================================================================
function receivePickupFromServer(model, position) {
if(getGame() == VRR_GAME_GTA_IV) {
}
}
// ===========================================================================

View File

@@ -188,8 +188,10 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
game.SET_PLAYER_CONTROL(localClient.index, boolToInt(controlState));
}
localPlayer.collisionsEnabled = controlState;
localPlayer.invincible = true;
if(getGame() != VRR_GAME_GTA_IV) {
localPlayer.collisionsEnabled = controlState;
localPlayer.invincible = true;
}
}
// ===========================================================================
@@ -283,26 +285,21 @@ function enterVehicleAsPassenger() {
function giveLocalPlayerWeapon(weaponId, ammo, active) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
localPlayer.giveWeapon(weaponId, ammo, active);
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
forceWeapon = weaponId;
}
// ===========================================================================
function giveLocalPlayerWeapon(weaponId, ammo, active) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
if(getGame() == VRR_GAME_MAFIA_ONE) {
localPlayer.giveWeapon(weaponId, 0, ammo);
forceWeaponAmmo = 0;
forceWeaponClipAmmo = ammo;
} else {
localPlayer.giveWeapon(weaponId, ammo, active);
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
if(getGame() < VRR_GAME_GTA_IV) {
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
} else {
forceWeaponAmmo = ammo;
forceWeaponClipAmmo = ammo;
}
}
forceWeapon = weaponId;
}
// ===========================================================================
@@ -351,6 +348,9 @@ function setLocalPlayerInterior(interior) {
if(!isGTAIV()) {
localPlayer.interior = interior;
game.cameraInterior = interior;
} else {
let interiorId = natives.getInteriorAtCoords(localPlayer.position);
natives.activateInterior(interiorId, true);
}
}
@@ -618,11 +618,15 @@ function forceLocalPlayerEquippedWeaponItem() {
if(forceWeapon != 0) {
if(localPlayer.weapon != forceWeapon) {
localPlayer.weapon = forceWeapon;
localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
if(getGame() <= VRR_GAME_GTA_IV) {
localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
}
} else {
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
if(getGame() <= VRR_GAME_GTA_IV) {
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
}
}
} else {
if(localPlayer.weapon > 0) {
@@ -835,13 +839,13 @@ function setUpInitialGame() {
natives.setPlayersDropMoneyInNetworkGame(false);
natives.setSyncWeatherAndGameTime(false);
natives.usePlayerColourInsteadOfTeamColour(true);
natives.setDisplayPlayerNameAndIcon(false);
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
natives.removeTemporaryRadarBlipsForPickups();
natives.setPickupsFixCars(false);
natives.displayCash(true);
natives.displayAmmo(true);
natives.displayHud(true);
natives.displayAreaName(true);
natives.displayCash(false);
natives.displayAmmo(false);
natives.displayHud(false);
natives.displayAreaName(false);
natives.setPoliceRadarBlips(false);
natives.requestAnims("DANCING");