Forum
Questions, builds, help and the odd argument. The mods and guides are out front.
so i have this function in engine block java
Spoiler:
public void updatevariables()
{
super.updatevariables();
if (the_car)
{
float vol=DynoData.maxTorque/500;
SfxTable tab;
if (tab = the_car.getSfxTable(0))//on
{
tab.clear();
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C2r), 1500, 500.0, 2500.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C6r), 2000, 1500.0, 5000.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C4r), 4500, 4000.0, 6000.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C5r), 5500, 5000.0, 7000.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C1r), 6500, 6000.0, RPM_limit+600, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C3r), 6500, RPM_limit-600, 18000.0, 1.0, 1.0);
}
if (tab = the_car.getSfxTable(1))//off
{
tab.clear();
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BAr), 600, 500.0, 1250.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BCr), 1750, 750.0, 3000.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C0r), 2500, 2000.0, 5000.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BEr), 4500, 4000.0, 6500.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BFr), 6000, 5500.0, 8500.0, 1.0, 1.0);
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BBr), 8000, 7500.0, 18000.0, 1.0, 1.0);
}
if (tab = the_car.getSfxTable(2))
{
tab.clear();
the_car.setSfxExhaustMinVol(0.9);
}
}
}
and i want to make a copy of SfxTable tab. I tried to do something with SfxTable.java but it didn't work. I don't know how to do it without Native.java file.
you dont need the native.java, it is just an empty file with a lot of hungarian text that says that the game uses C sources for macros
do you have full source of the game?
I think original java files for vanilla SLRR is still available on GOM, if I recall correctly.
We have MWM source code in the D/L section, tho. You can also try to study those.
i know, i have those. but it's not all source.
What I said about this on GOM, posted here for reference:
Doesn't "SfxTable tab2 = tab;" work? I would think it would, unless you're talking about something entirely different.
Also, there's no "Native.java" (or actually, it's blank). Anything referring to "native" means that the code for that is inside the C++ code of the game engine. The game engine is built in C++, and all of the GUIs and most of the parts are built in a Java layer on top of that.
"SfxTable tab2 = tab;" doesn't work. Even if you write tab = the_car.getSfxTable(0); and tab2 = the_car.getSfxTable(0); it will link everything into one sfx table.
# mindeliszz :
do you have full source of the game?
Yes but i'm not authorized to share it.
Also i dont have exe source.
How about this?
SfxTable tab2 = new SfxTable;
tab2 = tab;
Sorry if I'm stating the obvious here.
nope, it doesn't work that way. also should be commas at the end of new sfx table, like this "SfxTable tab2 = new SfxTable();" i already tried everything. Even tried to crate another class that contained SfxTable inside and can be copied.
it's possible with the java file were .getSfxTable() function is. Maybe it's SfxRef.java, i don't know. It has to have a copy constructor, so you could use "SfxTable tab2 = new SfxTable(tab);"
i havent understood what you're trying to do honestly
i want to play more than 2 sounds at once at same rpm 😃
.__. you could say it before π i'll send you the script i use as soon as i get back home
wanted to do it on my own 😃
# mindeliszz :
public void updatevariables()
{
super.updatevariables();if (the_car) { float vol=DynoData.maxTorque/500; SfxTable tab; if (tab = the_car.getSfxTable(0))//on { tab.clear(); //INTAKE SOUNDS tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C2r), 1500, 500.0, 2500.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C6r), 2000, 1500.0, 5000.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C4r), 4500, 4000.0, 6000.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C5r), 5500, 5000.0, 7000.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C1r), 6500, 6000.0, RPM_limit+600, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C3r), 6500, RPM_limit-600, 18000.0, 1.0, 1.0); } if (tab = the_car.getSfxTable(1))//off { tab.clear(); //OTHER SOUNDS HERE(blowoff, exhaust popping etc) } if (tab = the_car.getSfxTable(2)) { tab.clear(); //EXHAUST SOUNDS tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BAr), 600, 500.0, 1250.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BCr), 1750, 750.0, 3000.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000C0r), 2500, 2000.0, 5000.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BEr), 4500, 4000.0, 6500.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BFr), 6000, 5500.0, 8500.0, 1.0, 1.0); tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BBr), 8000, 7500.0, 18000.0, 1.0, 1.0); the_car.setSfxExhaustMinVol(0.9); } }}
tab.addItem(new ResourceRef(Shift2_Sounds:0x000000BAr), 600, 500.0, 1250.0, 1.0, 1.0);
^ this means
tab.addItem(new ResourceRef(FileFolder:FileIDr), Pitch, Min RPM, Max RPM, Min Vol, Max Vol);
So just set intake and exhaust with same rpm bands and it will work fine(i always do it this way).
Also i commonly add other sounds(blowoff, exhaust popping etc) in the first tab because the center one often wont work(dont ask me why because i have no clue).