mirror of
https://github.com/GTAmodding/modelviewjs.git
synced 2025-07-09 10:30:14 +02:00
Add possibility to start app with specific game and vehicle
This commit is contained in:
parent
bea1a1c2a0
commit
599f4fe34a
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
iii/*
|
||||||
|
vc/*
|
||||||
|
sa/*
|
71
index.html
71
index.html
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="control">
|
<div id="control">
|
||||||
<a href="javascript: startVehicleViewerIII();">III</a>
|
<a href="javascript: startVehicleViewerIII(defaultModel);">III</a>
|
||||||
<a href="javascript: startVehicleViewerVC();">VC</a>
|
<a href="javascript: startVehicleViewerVC(defaultModel);">VC</a>
|
||||||
<a href="javascript: startVehicleViewerSA();">SA</a>
|
<a href="javascript: startVehicleViewerSA(defaultModel);">SA</a>
|
||||||
</div>
|
</div>
|
||||||
<canvas id="glcanvas" width="640" height="480" style="float:left"></canvas>
|
<canvas id="glcanvas" width="640" height="480" style="float:left"></canvas>
|
||||||
<div style="float:left">
|
<div style="float:left">
|
||||||
@ -40,44 +40,95 @@
|
|||||||
<script src="main.js"></script>
|
<script src="main.js"></script>
|
||||||
<script src="loaddata.js"></script>
|
<script src="loaddata.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
var defaultModel = 'cheetah';
|
||||||
|
var initialGame = 'iii';
|
||||||
|
var initialModel = defaultModel;
|
||||||
|
var currentGame;
|
||||||
|
|
||||||
InitRW();
|
InitRW();
|
||||||
|
|
||||||
function
|
function
|
||||||
startVehicleViewerIII()
|
startVehicleViewerIII(model)
|
||||||
{
|
{
|
||||||
|
currentGame = 'iii';
|
||||||
DataDirPath = "iii/data";
|
DataDirPath = "iii/data";
|
||||||
ModelsDirPath = "iii/models";
|
ModelsDirPath = "iii/models";
|
||||||
TexturesDirPath = "iii/textures";
|
TexturesDirPath = "iii/textures";
|
||||||
loadCar = loadCarIII;
|
loadCar = loadCarIII;
|
||||||
loadVehicleViewer("default.ide", function() {
|
loadVehicleViewer("default.ide", function() {
|
||||||
SelectModel("cheetah");
|
if(parseInt(model)) {
|
||||||
|
SelectModelByID(model);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SelectModel(model);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function
|
function
|
||||||
startVehicleViewerVC()
|
startVehicleViewerVC(model)
|
||||||
{
|
{
|
||||||
|
currentGame = 'vc';
|
||||||
DataDirPath = "vc/data";
|
DataDirPath = "vc/data";
|
||||||
ModelsDirPath = "vc/models";
|
ModelsDirPath = "vc/models";
|
||||||
TexturesDirPath = "vc/textures";
|
TexturesDirPath = "vc/textures";
|
||||||
loadCar = loadCarVC;
|
loadCar = loadCarVC;
|
||||||
loadVehicleViewer("default.ide", function() {
|
loadVehicleViewer("default.ide", function() {
|
||||||
SelectModel("cheetah");
|
if(parseInt(model)) {
|
||||||
|
SelectModelByID(model);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SelectModel(model);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function
|
function
|
||||||
startVehicleViewerSA()
|
startVehicleViewerSA(model)
|
||||||
{
|
{
|
||||||
|
currentGame = 'sa';
|
||||||
DataDirPath = "sa/data";
|
DataDirPath = "sa/data";
|
||||||
ModelsDirPath = "sa/models";
|
ModelsDirPath = "sa/models";
|
||||||
TexturesDirPath = "sa/textures";
|
TexturesDirPath = "sa/textures";
|
||||||
loadCar = loadCarSA;
|
loadCar = loadCarSA;
|
||||||
loadVehicleViewer("vehicles.ide", function() {
|
loadVehicleViewer("vehicles.ide", function() {
|
||||||
SelectModel("cheetah");
|
if(parseInt(model)) {
|
||||||
|
SelectModelByID(model);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SelectModel(model);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
startVehicleViewerIII();
|
var hash = window.location.hash;
|
||||||
|
if(hash.length !== '') {
|
||||||
|
hash = hash.substring(1).toLowerCase();
|
||||||
|
var hashParts = hash.split('/');
|
||||||
|
|
||||||
|
if(['iii', 'vc', 'sa'].includes(hashParts[0])) {
|
||||||
|
initialGame = hashParts[0];
|
||||||
|
if(hashParts.length > 1) {
|
||||||
|
initialModel = hashParts[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Invalid location hash, reset it
|
||||||
|
window.location.hash = '';
|
||||||
|
if(window.history) {
|
||||||
|
history.replaceState(null, null, ' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(initialGame === 'iii') {
|
||||||
|
startVehicleViewerIII(initialModel);
|
||||||
|
}
|
||||||
|
else if(initialGame === 'vc') {
|
||||||
|
startVehicleViewerVC(initialModel);
|
||||||
|
}
|
||||||
|
else if(initialGame === 'sa') {
|
||||||
|
startVehicleViewerSA(initialModel);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
@ -68,6 +68,14 @@ SelectModel(model)
|
|||||||
SetCarColors(CurrentModel.colors[0]);
|
SetCarColors(CurrentModel.colors[0]);
|
||||||
|
|
||||||
loadCar(model + ".dff");
|
loadCar(model + ".dff");
|
||||||
|
|
||||||
|
window.location.hash = currentGame + '/' + model;
|
||||||
|
}
|
||||||
|
|
||||||
|
function
|
||||||
|
SelectModelByID(modelID) {
|
||||||
|
model = ModelInfos[modelID];
|
||||||
|
SelectModel(model.model);
|
||||||
}
|
}
|
||||||
|
|
||||||
function
|
function
|
||||||
|
Loading…
x
Reference in New Issue
Block a user