Merge branch 'tutorial-scenario'
I'll carry on working on the tutorial mainly in the branch, but I'd rather be able to get it tested via nightlies a bit at a time to spread out the feedback. The scenario support and new start menu are also needing testing. So further merges from this branch will happen in future.
This commit is contained in:
commit
b17b39afde
@ -33,6 +33,7 @@ after-all::
|
||||
$(CP) $(CP_FLAGS) Resources/InfoPlist.strings $(PROGDIR)/Resources
|
||||
$(CP) $(CP_FLAGS) Resources/AIs $(PROGDIR)/Resources
|
||||
$(CP) $(CP_FLAGS) Resources/Config $(PROGDIR)/Resources
|
||||
$(CP) $(CP_FLAGS) Resources/Scenarios $(PROGDIR)/Resources
|
||||
$(CP) $(CP_FLAGS) Resources/Scripts $(PROGDIR)/Resources
|
||||
$(CP) $(CP_FLAGS) Resources/Shaders $(PROGDIR)/Resources
|
||||
$(CP) $(CP_FLAGS) Resources/Binary/Images $(PROGDIR)/Resources
|
||||
|
@ -1009,6 +1009,28 @@
|
||||
"load-previous-commander-yes" = "y"; // Defines the key that corresponds to the yes answer to load-previous-commander.
|
||||
"load-previous-commander-no" = "n"; // Defines the key that corresponds to the no answer to load-previous-commander.
|
||||
|
||||
"oolite-start-option-1" = " Start New Commander ";
|
||||
"oolite-start-option-2" = " Load Commander ";
|
||||
"oolite-start-option-3" = " View Ship Library ";
|
||||
"oolite-start-option-4" = " Manage Expansion Packs "; // not yet implemented
|
||||
"oolite-start-option-5" = " Exit Game ";
|
||||
|
||||
"oolite-newgame-title" = "Start New Commander";
|
||||
|
||||
"oolite-ship-library-title" = "Ship Library";
|
||||
"oolite-ship-library-exit" = "Press space to exit ship library";
|
||||
|
||||
"oolite-loadsave-exit" = "Return to Menu";
|
||||
"oolite-scenario-exit" = "Return to Menu";
|
||||
"oolite-scenario-standard-name" = "Normal Start";
|
||||
"oolite-scenario-strict-name" = "Strict Mode";
|
||||
"oolite-scenario-tutorial-name" = "Tutorial";
|
||||
"oolite-scenario-standard-description" = "Start with a Cobra Mk III and 100 credits at Lave station, and try to make a living.";
|
||||
"oolite-scenario-strict-description" = "Strict Mode starts like the normal start, but all expansion packs are permanently disabled for this Commander.";
|
||||
"oolite-scenario-tutorial-description" = "Take a standard Cooperative flight training course, including simulated combat and docking practice.";
|
||||
|
||||
|
||||
|
||||
// Loading screen (currently Mac only), also logged under start.progress
|
||||
"loading-ships" = "Loading ship data";
|
||||
"populating-space" = "Populating space";
|
||||
@ -1111,6 +1133,7 @@
|
||||
"options-save-commander" = " Save Commander ";
|
||||
"options-load-commander" = " Load Commander ";
|
||||
"options-begin-new-game" = " Begin New Game ";
|
||||
"options-return-to-menu" = " End Game and Return to Menu ";
|
||||
"options-game-options" = " Game Options… ";
|
||||
"options-exit-game" = " Exit Game ";
|
||||
"options-reset-to-unrestricted-play" = " Reset and enable OXPs ";
|
||||
@ -1294,7 +1317,7 @@
|
||||
"shipyard-price-@" = " Price %@.";
|
||||
|
||||
// Load/Save screens shared information
|
||||
"loadsavescreen-commander-name" = "Commander Name";
|
||||
"loadsavescreen-commander-name" = "Commander";
|
||||
"loadsavescreen-rating" = "Rating";
|
||||
"loadsavescreen-no-commanders-found" = "No commanders found";
|
||||
"loadsavescreen-commander-@-rated-@-has-@-legal-status-@-ship-@-location-@-g-@-timestamp-@" = "Commander %@ is rated %@ and has %@ in the bank. Legal status: %@. Ship: %@. Location: %@ (G%d). Timestamp: %@";
|
||||
|
@ -372,5 +372,19 @@
|
||||
{
|
||||
available_to_player = false;
|
||||
}
|
||||
),
|
||||
/* condition script blocks this one from appearing normally */
|
||||
(
|
||||
100, 500000, "Tutorial Controls",
|
||||
"EQ_OOLITE_TUTORIAL_CONTROLS",
|
||||
"Tutorial Controls.",
|
||||
{
|
||||
condition_script = "oolite-conditions.js";
|
||||
script = "oolite-tutorial-equipment.js";
|
||||
available_to_all = true;
|
||||
visible = false; // Hidden on status screen.
|
||||
damage_probability = 0;
|
||||
}
|
||||
)
|
||||
|
||||
)
|
||||
|
@ -26,8 +26,8 @@
|
||||
{ // scanner zoom indicator
|
||||
alpha = 1.0;
|
||||
selector = "drawScannerZoomIndicator:";
|
||||
x = 108;
|
||||
y = 32;
|
||||
x = 100;
|
||||
y = 36;
|
||||
y_origin = -1;
|
||||
},
|
||||
//{ // stick sensitivity indicator
|
||||
@ -233,6 +233,7 @@
|
||||
y_origin = -1;
|
||||
height = 20;
|
||||
width = 10;
|
||||
with_dial = "drawForwardShieldBar:";
|
||||
},
|
||||
{ text = "AFT";
|
||||
x = -262;
|
||||
@ -240,6 +241,7 @@
|
||||
y_origin = -1;
|
||||
height = 20;
|
||||
width = 10;
|
||||
with_dial = "drawAftShieldBar:";
|
||||
},
|
||||
{
|
||||
text = "FUEL";
|
||||
@ -248,6 +250,7 @@
|
||||
y_origin = -1;
|
||||
height = 14;
|
||||
width = 9;
|
||||
with_dial = "drawFuelBar:";
|
||||
},
|
||||
{
|
||||
text = "CT";
|
||||
@ -256,6 +259,7 @@
|
||||
y_origin = -1;
|
||||
height = 14;
|
||||
width = 9;
|
||||
with_dial = "drawCabinTempBar:";
|
||||
},
|
||||
{
|
||||
text = "LT";
|
||||
@ -264,6 +268,7 @@
|
||||
y_origin = -1;
|
||||
height = 14;
|
||||
width = 9;
|
||||
with_dial = "drawWeaponTempBar:";
|
||||
},
|
||||
{
|
||||
text = "ALT";
|
||||
@ -272,6 +277,7 @@
|
||||
y_origin = -1;
|
||||
height = 14;
|
||||
width = 9;
|
||||
with_dial = "drawAltitudeBar:";
|
||||
},
|
||||
{
|
||||
text = "MISS";
|
||||
@ -280,6 +286,7 @@
|
||||
y_origin = -1;
|
||||
height = 16;
|
||||
width = 10;
|
||||
with_dial = "drawMissileDisplay:";
|
||||
},
|
||||
{ // RHS
|
||||
text = "SPD";
|
||||
@ -288,6 +295,7 @@
|
||||
y_origin = -1;
|
||||
height = 20;
|
||||
width = 10;
|
||||
with_dial = "drawSpeedBar:";
|
||||
},
|
||||
{
|
||||
text = "ROLL";
|
||||
@ -296,6 +304,7 @@
|
||||
y_origin = -1;
|
||||
height = 12;
|
||||
width = 9;
|
||||
with_dial = "drawRollBar:";
|
||||
},
|
||||
//{ // yaw bar legend, disabled by default
|
||||
// // uncomment as required to enable
|
||||
@ -304,6 +313,7 @@
|
||||
// y = -138;
|
||||
// height = 12;
|
||||
// width = 9;
|
||||
// with_dial = "drawYawBar:";
|
||||
//},
|
||||
{
|
||||
text = "PITCH";
|
||||
@ -312,6 +322,7 @@
|
||||
y_origin = -1;
|
||||
height = 12;
|
||||
width = 9;
|
||||
with_dial = "drawPitchBar:";
|
||||
}
|
||||
);
|
||||
multi_function_displays = (
|
||||
|
@ -183,4 +183,98 @@
|
||||
|
||||
"oolite-primablemanager-completed" = "Equipment configuration is complete.\n\nFirst fast activation (defensive):\n [oolite-primable-a]\n\nSecond fast activation (offensive):\n [oolite-primable-b]";
|
||||
|
||||
|
||||
// tutorial
|
||||
"oolite-tutorial-no-witchspace" = "Witchspace controls are not available in this simulator.";
|
||||
|
||||
"oolite-tutorial-no-death" = "If this wasn't a simulator, that would have killed you. Be more careful this time!";
|
||||
|
||||
|
||||
"oolite-tutorial-0-0-title" = "Flight Training Course";
|
||||
"oolite-tutorial-0-0-message" = "Welcome to the Cooperative Flight Training Course, pilot. This course will demonstrate the basic functionality of Cooperative ships to you, in a specially-prepared simulator.\n\nThe course is in multiple sections. While in the simulator, you can use the '[oolite_key_activate_equipment]' key to advance to the next entry in the current lesson, and the '[oolite_key_mode_equipment]' key to go to the next lesson, if you wish to skip sections you have previously completed.\n\nOnce the simulation begins, a panel on your screen will display instructions, which you should follow to progress through the course. If you wish to temporarily hide the panel, press the '[oolite_key_cycle_mfd]' key. You can bring it back with the same key, or it will automatically reappear when there are new instructions.\n\nWhere an instruction asks you to press a letter key, press the letter key alone if it is lower case (e.g. 'i'), and press shift and the key together if it is upper case (e.g. 'K').\n\nWhen you are ready, press the Enter key to begin the simulation with the first lesson.";
|
||||
"oolite-tutorial-0-0-choices" = { "1" = "Begin Course"; };
|
||||
|
||||
"oolite-tutorial-0-2" = "Welcome to the pilot's training course. The lesson information will be displayed on this panel.\n\nYou will often need to press '[oolite_key_activate_equipment]' to go to the next step - do this now to start the first lesson.\n\nRemember, you can also press '[oolite_key_mode_equipment]' to skip to the next lesson.";
|
||||
|
||||
"oolite-tutorial-1-0" = "Lesson 1: the HUD\nThis lesson introduces the HUD components in turn.\nFor now, the HUD components have all been hidden. As you go through this lesson, they will be made visible and introduced.";
|
||||
|
||||
"oolite-tutorial-1-1" = "Energy banks: 1/3\nThe energy bank gauge shows the stored energy in your ship's capacitors, which are used to power various high-energy systems.\nThey are continually recharged from your ship's power plant, but intensive activity will drain them faster than they can be charged.";
|
||||
|
||||
"oolite-tutorial-1-2" = "Energy banks: 2/3\nA crucial system powered by the banks is the emergency hull shield. This will protect your ship and most of its systems from high-energy impact. If your energy banks are too empty to power this shield, this may be fatal.";
|
||||
|
||||
"oolite-tutorial-1-3" = "Energy banks: 3/3\nIf your energy banks are low, the gauge will change colour to alert you. Watch how long it takes to recharge from nearly empty, and avoid placing too much strain on the banks.";
|
||||
|
||||
"oolite-tutorial-1-4" = "Primary Shields: 1/3\nTo protect your ship further from high energy impacts it is fitted with two shield generators. A pre-charged shield is much more reliable than the emergency hull shield.\nOne generator protects your forward arc...\n";
|
||||
|
||||
"oolite-tutorial-1-5" = "Primary Shields: 2/3\n...while the other protects your aft.\nThe charge levels are independent, so try to take impacts on the stronger shield.";
|
||||
|
||||
"oolite-tutorial-1-6" = "Primary Shields: 3/3\nThe shields will slowly recharge from the energy banks if they are drained, and the bars will change colour to highlight a drained state. As with the energy banks, a full recharge will take some time.";
|
||||
|
||||
"oolite-tutorial-1-7" = "Fuel: 1/2\nThis bar shows the amount of witchspace fuel currently available. The full capacity is sufficient for a seven light-year witchspace jump. With the correct equipment, fuel can also be used to significantly boost your speed in normal space.";
|
||||
|
||||
"oolite-tutorial-1-8" = "Fuel: 2/2\nThe vertical line shows the amount of fuel needed to reach the currently selected witchspace destination. If the fuel is insufficient, this will change colour.";
|
||||
|
||||
"oolite-tutorial-1-9" = "Cabin Temperature: 1/2\nIn normal flight, your ship will maintain a steady-state temperature, with waste heat gradually being radiated into space. If you are near a hot object such as a star, or travelling quickly through a planet's upper atmosphere, the temperature will rise.";
|
||||
|
||||
"oolite-tutorial-1-10" = "Cabin Temperature: 2/2\nAt extremely high temperatures your life support systems will fail. Emergency loops will drain power from your shields and energy banks to buy a few more seconds, but you should have got out long before then.";
|
||||
|
||||
"oolite-tutorial-1-11" = "Laser Temperature: 1/2\nFiring your laser generates a significant amount of waste heat. Coolant pumps will diffuse it harmlessly through the much greater mass of your ship, but most types of laser generate heat far faster than the pumps can remove it.";
|
||||
|
||||
"oolite-tutorial-1-12" = "Laser Temperature: 2/2\nHold the '[oolite_key_fire_lasers]' key to fire your laser for a while, and note the temperature slowly rises. More powerful lasers generate a much larger volume of waste heat. At high temperatures, your laser will automatically cut out to prevent meltdown.";
|
||||
|
||||
"oolite-tutorial-1-13" = "Altitude:\nThis bar shows your height above the nearest major body - a star, planet or moon. Your ship is neither authorised nor equipped for planetary approach. As long as you remain in the upper atmosphere or higher - some bar still showing - you will be safe.";
|
||||
|
||||
"oolite-tutorial-1-14" = "Speed:\nThis bar shows your flight speed as a proportion of the maximum speed generated by your ship's inertialess drive. Use the '[oolite_key_increase_speed]' and '[oolite_key_decrease_speed]' keys to speed up and slow down.";
|
||||
|
||||
"oolite-tutorial-1-15" = "Roll:\nYour ship's rate of roll is indicated by this dial. Use the '[oolite_key_roll_left]' and '[oolite_key_roll_right]' keys to turn.";
|
||||
|
||||
"oolite-tutorial-1-16" = "Pitch:\nYour ship's rate of pitch is indicated by this dial. Use the '[oolite_key_pitch_forward]' and '[oolite_key_pitch_back]' keys to turn in this axis.\nNotice that the dial is relative to your ship's maximum turn rate in the axis. Almost all ships can roll faster than they can pitch.";
|
||||
|
||||
"oolite-tutorial-1-17" = "Pylon Status:\nThe icons here show the missiles, mines and other deployable equipment attached to your external pylons. Currently your ship has three standard missiles fitted. Other types of pylon-mounted item have different icons.";
|
||||
|
||||
"oolite-tutorial-1-18" = "Scanner:\nThe scanner is perhaps the most important part of your HUD, and using it to locate and identify nearby objects will be the subject of the next lesson.";
|
||||
|
||||
"oolite-tutorial-1-19" = "Compass:\nThe compass is used to locate more distant objects outside scanner range. The basic model is used to detect the system's major planet, which appears as a circle on the compass. If the circle is green, the planet is in front of you. Otherwise, it is behind you. Use of the compass for navigation will be covered in a later lesson.";
|
||||
|
||||
"oolite-tutorial-1-20" = "Status light: 1/2\nThe status light summarises the local situation. If it is green, as now, there are no large or powered objects nearby. Yellow, which is most common, indicates that there are nearby large or powered objects, and care should be taken while flying.";
|
||||
|
||||
"oolite-tutorial-1-21" = "Status light: 2/2\nA red status light indicates that something nearby presents a direct danger to your ship. An alarm will sound to indicate a change to this status.";
|
||||
|
||||
"oolite-tutorial-1-22" = "Clock: 1/2\nThe clock shows the current galactic standard time. The first seven digit number is the count of standard days since the start of the calendar. The remaining digits are the time on that standard day. For historical reasons, the standard day does not correspond exactly to that of any Cooperative planet, though it is close to many.";
|
||||
|
||||
"oolite-tutorial-1-23" = "Clock: 2/2\nIf the clock becomes unsynchronised with standard time, it will display 'adjusting' while it resynchronises. This is normal after witchspace jumps and when restarting the system after maintenance.";
|
||||
|
||||
"oolite-tutorial-1-24" = "This concludes the introduction to the HUD. There are a few additional HUD indicators which depend either on particular equipment or special circumstances, and these will be described in later lessons.";
|
||||
|
||||
"oolite-tutorial-2-0" = "Lesson 2: Using the Scanner\nThis lesson introduces use of the scanner for navigation and identification, and the basic flight controls used in space.\n\nStart by bringing your ship to a complete stop using the '[oolite_key_decrease_speed]' key, then press '[oolite_key_activate_equipment]' to start the lesson.";
|
||||
|
||||
"oolite-tutorial-2-1-error" = "First bring your ship to a complete stop using the '[oolite_key_decrease_speed]' key.";
|
||||
|
||||
"oolite-tutorial-2-1" = "Scanner use: 1/8\nWe have added several asteroids around you, which appear on your scanner as a white marker.\nThe circle of the scanner represents the horizontal plane around your ship, with the lines forward approximately indicating your field of view.";
|
||||
|
||||
"oolite-tutorial-2-2" = "Scanner use: 2/8\nThe position of an object above or below the plane is then marked with a stick. The further the object is from the plane, the longer the stick will be.";
|
||||
|
||||
"oolite-tutorial-2-3" = "Scanner use: 3/8\nTo bring an object on the scanner into your forward view, first roll your ship with the '[oolite_key_roll_left]' and '[oolite_key_roll_right]' keys until the object is on the forward/back line of the scanner. Then, use the '[oolite_key_pitch_forward]' and '[oolite_key_pitch_back]' keys to turn your ship so that it is in front of you.";
|
||||
|
||||
"oolite-tutorial-2-4" = "Scanner use: 4/8\nThe scanner can detect objects up to a substantial distance. Pick one of the asteroids and fly towards it. Accelerate with the '[oolite_key_increase_speed]' key, and decelerate again when nearby with the '[oolite_key_decrease_speed]' key.\nBe careful not to collide with it!";
|
||||
|
||||
"oolite-tutorial-2-5" = "Scanner use: 5/8\nWhen concentrating on close-up objects, it may be useful to zoom the scanner, sacrificing range for detail. Press the '[oolite_key_scanner_zoom]' key to zoom in, up to 5x zoom.\nYou can reset the zoom to maximum range using the '[oolite_key_scanner_unzoom]' key. Note the zoom level indicator by the scanner.";
|
||||
|
||||
"oolite-tutorial-2-6" = "Scanner use: 6/8\nThe colour of the marker is used to indicate something about its nature. Asteroids are unpowered objects and appear white. Other objects which will appear white include debris, cargo containers, and escape capsules";
|
||||
|
||||
"oolite-tutorial-2-7" = "Scanner use: 7/8\nPowered ships usually appear yellow on the scanner, unless they are attacking, when they appear red. Don't worry - this one isn't actually attacking!\nPolice and other official ships are indicated with a purple marker - be careful not to accidentally hit them as this is an illegal act.";
|
||||
|
||||
"oolite-tutorial-2-8" = "Scanner use: 8/8\nOther common colours include yellow/green flashing for navigation buoys, light blue for missiles, and red/yellow flashing for mines. Again, don't worry, these are all disarmed!";
|
||||
|
||||
"oolite-tutorial-2-9" = "View controls: 1/x\nYour ship is fitted with four view cameras. Use the '[oolite_key_view_forward]', '[oolite_key_view_aft]', '[oolite_key_view_port]' and '[oolite_key_view_starboard]' keys to switch between them. The view lines on the scanner will move as you do. Notice that the crosshair is replaced on the other views, as you have no other weapons mounted.";
|
||||
|
||||
"oolite-tutorial-2-10" = "View controls: 2/x\nYour ship can also simulate an external view for you. Press '[oolite_key_custom_view]' to switch to external view mode and to cycle through the available external views. Any of the internal view keys will return you to internal viewing.";
|
||||
|
||||
"oolite-tutorial-3-0" = "Lesson 3: Flight Training\nThis lesson gives you opportunity to practice basic piloting skills in a relatively safe environment.";
|
||||
|
||||
|
||||
"oolite-tutorial-end-title" = "Course Complete";
|
||||
"oolite-tutorial-end-message" = "You have now completed the Pilot's Training Course.";
|
||||
"oolite-tutorial-end-choices" = { "1" = "Exit Simulator"; };
|
||||
|
||||
}
|
||||
|
21
Resources/Config/scenarios.plist
Normal file
21
Resources/Config/scenarios.plist
Normal file
@ -0,0 +1,21 @@
|
||||
(
|
||||
{
|
||||
"file" = "oolite-standard.oolite-save";
|
||||
"name" = "[oolite-scenario-standard-name]";
|
||||
"description" = "[oolite-scenario-standard-description]";
|
||||
"model" = "cobra3-trader";
|
||||
},
|
||||
{
|
||||
"file" = "oolite-tutorial.oolite-save";
|
||||
"name" = "[oolite-scenario-tutorial-name]";
|
||||
"description" = "[oolite-scenario-tutorial-description]";
|
||||
"model" = "coriolis-station";
|
||||
"scenario" = "oolite-tutorial";
|
||||
},
|
||||
{
|
||||
"file" = "oolite-strict.oolite-save";
|
||||
"name" = "[oolite-scenario-strict-name]";
|
||||
"description" = "[oolite-scenario-strict-description]";
|
||||
"model" = "cobra3-trader";
|
||||
}
|
||||
)
|
@ -987,6 +987,15 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
"oolite_template_tutorial-buoy" =
|
||||
{
|
||||
like_ship = "oolite_template_buoy";
|
||||
is_template = 1;
|
||||
beacon = "Buoy (training)";
|
||||
beacon_label = "Training Buoy";
|
||||
name = "Training Buoy";
|
||||
roles = "oolite-tutorial-buoy";
|
||||
};
|
||||
"oolite_template_buoy-witchpoint" =
|
||||
{
|
||||
like_ship = "oolite_template_buoy";
|
||||
@ -2946,6 +2955,7 @@
|
||||
max_flight_speed = 1000;
|
||||
model = "qbomb.dat";
|
||||
name = "Quirium Cascade Mine";
|
||||
scan_class = "CLASS_MINE";
|
||||
roles = "energy-bomb EQ_QC_MINE";
|
||||
thrust = 0;
|
||||
};
|
||||
@ -3087,7 +3097,20 @@
|
||||
weapon_position_port = "-9.0 0.0 11.5";
|
||||
weapon_position_starboard = "9.0 0.0 11.5";
|
||||
};
|
||||
"oolite_template_sidewinder" = {
|
||||
"oolite_template_tutorial-station" =
|
||||
{
|
||||
is_template = 1;
|
||||
like_ship = "oolite_template_coriolis-station";
|
||||
ai_type = "nullAI.plist";
|
||||
is_carrier = 1;
|
||||
market = "none";
|
||||
name = "Tutorial Station";
|
||||
roles = "oolite-tutorial-station";
|
||||
rotating = no;
|
||||
scan_class = "CLASS_NO_DRAW";
|
||||
};
|
||||
"oolite_template_sidewinder" =
|
||||
{
|
||||
aft_eject_position = "0.0 -11.5 -22.5";
|
||||
ai_type = "oolite-pirateAI.js";
|
||||
auto_ai = yes;
|
||||
@ -4046,6 +4069,17 @@
|
||||
};
|
||||
|
||||
|
||||
/* Begin definitions for entities used in the tutorial */
|
||||
"oolite-tutorial-station" =
|
||||
{
|
||||
like_ship = "oolite_template_tutorial-station";
|
||||
};
|
||||
"oolite-tutorial-buoy" =
|
||||
{
|
||||
"like_ship" = "oolite_template_tutorial-buoy";
|
||||
};
|
||||
|
||||
|
||||
/* Begin subentity definitions. Subentities do not have templates. */
|
||||
|
||||
// subentity, doesn't need template
|
||||
|
@ -18,6 +18,8 @@
|
||||
"oolite-cloaking-device-mission.js",
|
||||
"oolite-nova-mission.js",
|
||||
"oolite-thargoid-plans-mission.js",
|
||||
"oolite-trumbles-mission.js"
|
||||
"oolite-trumbles-mission.js",
|
||||
|
||||
/* Tutorial */
|
||||
"oolite-tutorial.js"
|
||||
)
|
||||
|
1310
Resources/Scenarios/oolite-standard.oolite-save
Normal file
1310
Resources/Scenarios/oolite-standard.oolite-save
Normal file
File diff suppressed because it is too large
Load Diff
1312
Resources/Scenarios/oolite-strict.oolite-save
Normal file
1312
Resources/Scenarios/oolite-strict.oolite-save
Normal file
File diff suppressed because it is too large
Load Diff
1331
Resources/Scenarios/oolite-tutorial.oolite-save
Normal file
1331
Resources/Scenarios/oolite-tutorial.oolite-save
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,42 @@
|
||||
/*
|
||||
|
||||
oolite-cloaking-device-equipment.js
|
||||
|
||||
Equipment script for cloaking device.
|
||||
|
||||
|
||||
Oolite
|
||||
Copyright © 2004-2013 Giles C Williams and contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*jslint white: true, undef: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
|
||||
/*global worldScripts*/
|
||||
|
||||
|
||||
"use strict";
|
||||
|
||||
this.name = "Cloaking Device";
|
||||
this.author = "cim";
|
||||
this.copyright = "© 2008-2013 the Oolite team.";
|
||||
this.version = "1.79";
|
||||
|
||||
|
||||
this.activated = function()
|
||||
{
|
||||
|
@ -42,39 +42,47 @@ this.version = "1.79";
|
||||
/* contexts: npc, purchase, scripted, newShip, (loading), (damage), (portable) */
|
||||
this.allowAwardEquipment = function(equipment, ship, context)
|
||||
{
|
||||
if (equipment == "EQ_NAVAL_ENERGY_UNIT")
|
||||
if (equipment == "EQ_NAVAL_ENERGY_UNIT")
|
||||
{
|
||||
// Naval Energy Unit purchase (including repair) by player
|
||||
// requires Thargoid Plans complete
|
||||
if (context == "purchase" && missionVariables.thargplans != "MISSION_COMPLETE")
|
||||
{
|
||||
// Naval Energy Unit purchase (including repair) by player
|
||||
// requires Thargoid Plans complete
|
||||
if (context == "purchase" && missionVariables.thargplans != "MISSION_COMPLETE")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (equipment == "EQ_CLOAKING_DEVICE")
|
||||
if (equipment == "EQ_CLOAKING_DEVICE")
|
||||
{
|
||||
// Cloaking Device can't be purchased by player, can be repaired
|
||||
if (context == "purchase" && player.ship.equipmentStatus("EQ_CLOAKING_DEVICE") != "EQUIPMENT_DAMAGED")
|
||||
{
|
||||
// Cloaking Device can't be purchased by player, can be repaired
|
||||
if (context == "purchase" && player.ship.equipmentStatus("EQ_CLOAKING_DEVICE") != "EQUIPMENT_DAMAGED")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Never found on ships in shipyards
|
||||
if (context == "newShip")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// OXP hook to allow stations to forbid specific equipment
|
||||
if (context == "purchase" && player.ship.dockedStation && player.ship.dockedStation.scriptInfo["oolite-barred-equipment"])
|
||||
// Never found on ships in shipyards
|
||||
if (context == "newShip")
|
||||
{
|
||||
if (player.ship.dockedStation.scriptInfo["oolite-barred-equipment"].indexOf(equipment) != -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise allowed
|
||||
return true;
|
||||
if (equipment == "EQ_OOLITE_TUTORIAL_CONTROLS")
|
||||
{
|
||||
if (context == "purchase" || context == "npc" || context == "newShip" || context == "scripted")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// OXP hook to allow stations to forbid specific equipment
|
||||
if (context == "purchase" && player.ship.dockedStation && player.ship.dockedStation.scriptInfo["oolite-barred-equipment"])
|
||||
{
|
||||
if (player.ship.dockedStation.scriptInfo["oolite-barred-equipment"].indexOf(equipment) != -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise allowed
|
||||
return true;
|
||||
}
|
||||
|
50
Resources/Scripts/oolite-tutorial-equipment.js
Normal file
50
Resources/Scripts/oolite-tutorial-equipment.js
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
|
||||
oolite-tutorial-equipment.js
|
||||
|
||||
Equipment script for tutorial.
|
||||
|
||||
|
||||
Oolite
|
||||
Copyright © 2004-2013 Giles C Williams and contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*jslint white: true, undef: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
|
||||
/*global worldScripts*/
|
||||
|
||||
|
||||
"use strict";
|
||||
|
||||
this.name = "Tutorial Controls";
|
||||
this.author = "cim";
|
||||
this.copyright = "© 2008-2013 the Oolite team.";
|
||||
this.version = "1.79";
|
||||
|
||||
|
||||
this.activated = function()
|
||||
{
|
||||
worldScripts["oolite-tutorial"]._nextItem();
|
||||
}
|
||||
|
||||
|
||||
this.mode = function()
|
||||
{
|
||||
worldScripts["oolite-tutorial"]._nextSection();
|
||||
}
|
569
Resources/Scripts/oolite-tutorial.js
Normal file
569
Resources/Scripts/oolite-tutorial.js
Normal file
@ -0,0 +1,569 @@
|
||||
/*
|
||||
|
||||
oolite-tutorial.js
|
||||
|
||||
World script for tutorial.
|
||||
|
||||
|
||||
Oolite
|
||||
Copyright © 2004-2013 Giles C Williams and contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*jslint white: true, undef: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
|
||||
/*global worldScripts, player, missionVariables */
|
||||
|
||||
|
||||
"use strict";
|
||||
|
||||
this.name = "oolite-tutorial";
|
||||
this.author = "cim";
|
||||
this.copyright = "© 2008-2013 the Oolite team.";
|
||||
this.version = "1.79";
|
||||
|
||||
this.startUp = function()
|
||||
{
|
||||
if (!missionVariables.oolite_tutorial)
|
||||
{
|
||||
return;
|
||||
}
|
||||
log(this.name,"Tutorial mode active");
|
||||
// define rest of script now, otherwise it's pointless as it never
|
||||
// gets used in normal play
|
||||
|
||||
this.$tutorialSound = new SoundSource;
|
||||
this.$tutorialSpeech = new SoundSource;
|
||||
|
||||
this.$tutorialStage = 0;
|
||||
this.$tutorialSubstage = 0;
|
||||
|
||||
/* Number of substages in each stage */
|
||||
this.$tutorialStages = [
|
||||
3, // stage 0: mission screen, post-launch cleanup, intro message
|
||||
25, // stage 1: HUD displays
|
||||
11, // stage 2: scanner and views
|
||||
1, // stage 3: basic flight (not yet started)
|
||||
];
|
||||
|
||||
this.$shipList = [];
|
||||
|
||||
// alternative populator
|
||||
this.ooliteTutorialWillPopulate = function()
|
||||
{
|
||||
var addTutorialStation = function(pos)
|
||||
{
|
||||
system.addShips("oolite-tutorial-station",1,pos,0);
|
||||
}
|
||||
|
||||
system.setPopulator("oolite-tutorial-station",
|
||||
{
|
||||
priority: 5,
|
||||
location: "OUTER_SYSTEM_OFFPLANE",
|
||||
locationSeed: 600,
|
||||
callback: addTutorialStation,
|
||||
deterministic: true
|
||||
});
|
||||
}
|
||||
|
||||
this.ooliteTutorialWillRepopulate = function()
|
||||
{
|
||||
// nothing yet
|
||||
}
|
||||
|
||||
|
||||
this.missionScreenOpportunity = function()
|
||||
{
|
||||
if (this.$tutorialStage == 0 && this.$tutorialSubstage == 0)
|
||||
{
|
||||
player.ship.targetSystem = 55;
|
||||
player.ship.hudHidden = true;
|
||||
mission.runScreen(
|
||||
{
|
||||
titleKey: "oolite-tutorial-0-0-title",
|
||||
messageKey: "oolite-tutorial-0-0-message",
|
||||
choicesKey: "oolite-tutorial-0-0-choices",
|
||||
screenID: "oolite-tutorial-0-0"
|
||||
},function()
|
||||
{
|
||||
player.ship.hudHidden = false;
|
||||
player.ship.launch();
|
||||
this._nextItem();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.shipLaunchedFromStation = function(station)
|
||||
{
|
||||
if (this.$tutorialStage == 0 && this.$tutorialSubstage == 1)
|
||||
{
|
||||
station.remove();
|
||||
this._nextItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.shipTakingDamage = function(amount, whom, type)
|
||||
{
|
||||
if (amount >= player.ship.energy)
|
||||
{
|
||||
player.ship.position = system.locationFromCode("OUTER_SYSTEM_OFFPLANE");
|
||||
--this.$tutorialStage;
|
||||
this.$tutorialSubstage = 9999;
|
||||
player.ship.dealEnergyDamage(1,10000,0);
|
||||
this._playSound("bigbang.ogg");
|
||||
player.consoleMessage(expandMissionText("oolite-tutorial-no-death"));
|
||||
this._nextItem(); // will call nextSection, which will reset energy
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.playerStartedJumpCountdown = function()
|
||||
{
|
||||
player.ship.cancelHyperspaceCountdown();
|
||||
player.consoleMessage(expandMissionText("oolite-tutorial-no-witchspace"));
|
||||
}
|
||||
|
||||
this._playSound = function(snd)
|
||||
{
|
||||
this.$tutorialSound.stop();
|
||||
this.$tutorialSound.sound = snd;
|
||||
this.$tutorialSound.play();
|
||||
}
|
||||
|
||||
// move to the next item in the current tutorial
|
||||
this._nextItem = function()
|
||||
{
|
||||
this.$tutorialSubstage++;
|
||||
if (this.$tutorialSubstage >= this.$tutorialStages[this.$tutorialStage])
|
||||
{
|
||||
this._nextSection();
|
||||
}
|
||||
else
|
||||
{
|
||||
var fn = "__stage"+this.$tutorialStage+"sub"+this.$tutorialSubstage;
|
||||
if (this[fn])
|
||||
{
|
||||
this[fn]();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// move to the next section of the tutorial
|
||||
this._nextSection = function()
|
||||
{
|
||||
this._resetPlayerShip();
|
||||
this.$tutorialStage++;
|
||||
this.$tutorialSubstage = 0;
|
||||
var fn = "__stage"+this.$tutorialStage+"sub"+this.$tutorialSubstage;
|
||||
if (this[fn])
|
||||
{
|
||||
this[fn]();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._endTutorial();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this._setInstructions = function(key)
|
||||
{
|
||||
if (player.ship.multiFunctionDisplays == 0)
|
||||
{
|
||||
log(this.name,"Installed HUD does not support multi-function displays - unable to show instructions");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ship.setMultiFunctionText("oolite-tutorial",expandMissionText(key),true);
|
||||
player.ship.setMultiFunctionDisplay(0,"oolite-tutorial");
|
||||
this.$tutorialSpeech.stop();
|
||||
this.$tutorialSpeech.sound = key+".ogg";
|
||||
this.$tutorialSpeech.play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.$HUDSelectors = ["drawEnergyGauge:","drawForwardShieldBar:","drawAftShieldBar:","drawSpeedBar:","drawRollBar:","drawPitchBar:","drawYellowSurround:","drawFuelBar:","drawCabinTempBar:","drawWeaponTempBar:","drawAltitudeBar:","drawMissileDisplay:","drawStatusLight:","drawClock:","drawCompass:","drawScanner:","drawScannerZoomIndicator:"];
|
||||
this.$HUDHighlighter = null;
|
||||
this.$HUDHighlighterSelector = null;
|
||||
this.$HUDHighlighterCycles = 10;
|
||||
|
||||
this._showHUDItem = function(selector)
|
||||
{
|
||||
player.ship.showHUDSelector(selector);
|
||||
if (this.$HUDHighlighterSelector)
|
||||
{
|
||||
player.ship.showHUDSelector(this.$HUDHighlighterSelector);
|
||||
}
|
||||
this.$HUDHighlighterSelector = selector;
|
||||
if (this.$HUDHighlighter)
|
||||
{
|
||||
this.$HUDHighlighter.stop();
|
||||
}
|
||||
if (selector == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.$HUDHighlighterCycles = 6;
|
||||
this.$HUDHighlighter = new Timer
|
||||
(this,
|
||||
function()
|
||||
{
|
||||
if (this.$HUDHighlighterCycles == 0)
|
||||
{
|
||||
this.$HUDHighlighter.stop();
|
||||
}
|
||||
else if (this.$HUDHighlighterCycles % 2 == 0)
|
||||
{
|
||||
player.ship.hideHUDSelector(this.$HUDHighlighterSelector);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ship.showHUDSelector(this.$HUDHighlighterSelector);
|
||||
}
|
||||
--this.$HUDHighlighterCycles;
|
||||
},0.5,0.5);
|
||||
}
|
||||
|
||||
this._resetHUDItems = function()
|
||||
{
|
||||
this._showHUDItem("");
|
||||
for (var i=0; i<this.$HUDSelectors.length; i++)
|
||||
{
|
||||
player.ship.showHUDSelector(this.$HUDSelectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this._hideHUDItems = function()
|
||||
{
|
||||
for (var i=0; i<this.$HUDSelectors.length; i++)
|
||||
{
|
||||
player.ship.hideHUDSelector(this.$HUDSelectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this._resetPlayerShip = function()
|
||||
{
|
||||
player.ship.fuel = 2.0;
|
||||
player.ship.energy = 256;
|
||||
player.ship.forwardShield = 128;
|
||||
player.ship.aftShield = 128;
|
||||
player.ship.forwardWeapon = "EQ_WEAPON_PULSE_LASER";
|
||||
for (var i=0;i<4;i++)
|
||||
{
|
||||
player.ship.removeEquipment("EQ_MISSILE");
|
||||
}
|
||||
for (i=0;i<3;i++)
|
||||
{
|
||||
player.ship.awardEquipment("EQ_MISSILE");
|
||||
}
|
||||
this._resetHUDItems();
|
||||
player.ship.hudHidden = false;
|
||||
for (i=this.$shipList.length-1;i>=0;i--)
|
||||
{
|
||||
if (this.$shipList[i] && this.$shipList[i].isShip)
|
||||
{
|
||||
this.$shipList[i].remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._addShips = function(role,num,pos,rad)
|
||||
{
|
||||
var arr = system.addShips(role,num,pos,rad);
|
||||
this.$shipList = this.$shipList.concat(arr);
|
||||
return arr;
|
||||
}
|
||||
|
||||
/* Tutorial stages */
|
||||
|
||||
// __stage0sub1 not needed
|
||||
|
||||
this.__stage0sub2 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-0-2");
|
||||
}
|
||||
|
||||
this.__stage1sub0 = function()
|
||||
{
|
||||
this._hideHUDItems();
|
||||
this._setInstructions("oolite-tutorial-1-0");
|
||||
}
|
||||
|
||||
this.__stage1sub1 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-1");
|
||||
this._showHUDItem("drawEnergyGauge:");
|
||||
}
|
||||
|
||||
this.__stage1sub2 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-2");
|
||||
this._showHUDItem("");
|
||||
}
|
||||
|
||||
this.__stage1sub3 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-3");
|
||||
player.ship.energy = 1;
|
||||
}
|
||||
|
||||
this.__stage1sub4 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-4");
|
||||
this._showHUDItem("drawForwardShieldBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub5 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-5");
|
||||
this._showHUDItem("drawAftShieldBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub6 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-6");
|
||||
this._showHUDItem("");
|
||||
player.ship.energy = 256;
|
||||
player.ship.forwardShield = 0;
|
||||
player.ship.aftShield = 0;
|
||||
}
|
||||
|
||||
this.__stage1sub7 = function()
|
||||
{
|
||||
player.ship.fuel = 5;
|
||||
this._setInstructions("oolite-tutorial-1-7");
|
||||
this._showHUDItem("drawYellowSurround:");
|
||||
this._showHUDItem("drawFuelBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub8 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-8");
|
||||
this._showHUDItem("");
|
||||
player.ship.fuelLeakRate = 5;
|
||||
}
|
||||
|
||||
this.__stage1sub9 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-9");
|
||||
this._showHUDItem("drawCabinTempBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub10 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-10");
|
||||
this._showHUDItem("");
|
||||
player.ship.temperature = 0.999;
|
||||
}
|
||||
|
||||
this.__stage1sub11 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-11");
|
||||
this._showHUDItem("drawWeaponTempBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub12 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-12");
|
||||
this._showHUDItem("");
|
||||
}
|
||||
|
||||
this.__stage1sub13 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-13");
|
||||
this._showHUDItem("drawAltitudeBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub14 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-14");
|
||||
this._showHUDItem("drawSpeedBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub15 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-15");
|
||||
this._showHUDItem("drawRollBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub16 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-16");
|
||||
this._showHUDItem("drawPitchBar:");
|
||||
}
|
||||
|
||||
this.__stage1sub17 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-17");
|
||||
this._showHUDItem("drawMissileDisplay:");
|
||||
}
|
||||
|
||||
this.__stage1sub18 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-18");
|
||||
this._showHUDItem("drawScannerZoomIndicator:");
|
||||
this._showHUDItem("drawScanner:");
|
||||
}
|
||||
|
||||
this.__stage1sub19 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-19");
|
||||
this._showHUDItem("drawCompass:");
|
||||
}
|
||||
|
||||
this.__stage1sub20 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-20");
|
||||
this._showHUDItem("drawStatusLight:");
|
||||
}
|
||||
|
||||
this.__stage1sub21 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-21");
|
||||
this._showHUDItem("");
|
||||
}
|
||||
|
||||
this.__stage1sub22 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-22");
|
||||
this._showHUDItem("drawClock:");
|
||||
}
|
||||
|
||||
this.__stage1sub23 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-23");
|
||||
this._showHUDItem("");
|
||||
clock.addSeconds(7200);
|
||||
}
|
||||
|
||||
this.__stage1sub24 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-1-24");
|
||||
}
|
||||
|
||||
this.__stage2sub0 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-0");
|
||||
}
|
||||
|
||||
this.__stage2sub1 = function()
|
||||
{
|
||||
if (player.ship.speed > 0.1)
|
||||
{
|
||||
player.consoleMessage(expandMissionText("oolite-tutorial-2-1-error"));
|
||||
this._setInstructions("oolite-tutorial-2-0");
|
||||
--this.$tutorialSubstage;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-1");
|
||||
this._addShips("asteroid",10,player.ship.position,25E3);
|
||||
}
|
||||
}
|
||||
|
||||
this.__stage2sub2 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-2");
|
||||
}
|
||||
|
||||
this.__stage2sub3 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-3");
|
||||
}
|
||||
|
||||
this.__stage2sub4 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-4");
|
||||
}
|
||||
|
||||
this.__stage2sub5 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-5");
|
||||
this._showHUDItem("drawScannerZoomIndicator:");
|
||||
}
|
||||
|
||||
this.__stage2sub6 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-6");
|
||||
}
|
||||
|
||||
this.__stage2sub7 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-7");
|
||||
var yellow = this._addShips("[adder]",1,player.ship.position,5E3)[0];
|
||||
yellow.setAI("nullAI.plist");
|
||||
var red = this._addShips("[adder]",1,player.ship.position,5E3)[0];
|
||||
red.setAI("nullAI.plist");
|
||||
red.target = player.ship;
|
||||
red.thrust = 0;
|
||||
red.performFlee();
|
||||
var purple = this._addShips("police",1,player.ship.position,5E3)[0];
|
||||
purple.setAI("nullAI.plist");
|
||||
|
||||
}
|
||||
|
||||
this.__stage2sub8 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-8");
|
||||
this._addShips("oolite-tutorial-buoy",1,player.ship.position,10E3);
|
||||
var miss = this._addShips("missile",1,player.ship.position,10E3)[0];
|
||||
miss.setAI("nullAI.plist");
|
||||
var mine = this._addShips("energy-bomb",1,player.ship.position,10E3)[0];
|
||||
mine.setAI("nullAI.plist");
|
||||
}
|
||||
|
||||
|
||||
this.__stage2sub9 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-9");
|
||||
}
|
||||
|
||||
this.__stage2sub10 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-2-10");
|
||||
}
|
||||
|
||||
this.__stage3sub0 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-3-0");
|
||||
}
|
||||
|
||||
|
||||
|
||||
this._endTutorial = function()
|
||||
{
|
||||
player.ship.hudHidden = true;
|
||||
mission.runScreen(
|
||||
{
|
||||
titleKey: "oolite-tutorial-end-title",
|
||||
messageKey: "oolite-tutorial-end-message",
|
||||
choicesKey: "oolite-tutorial-end-choices",
|
||||
screenID: "oolite-tutorial-end"
|
||||
},function()
|
||||
{
|
||||
player.endScenario("oolite-tutorial");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -105,11 +105,10 @@ enum
|
||||
GUI_ROW_OPTIONS_QUICKSAVE,
|
||||
GUI_ROW_OPTIONS_SAVE,
|
||||
GUI_ROW_OPTIONS_LOAD,
|
||||
GUI_ROW_OPTIONS_BEGIN_NEW,
|
||||
GUI_ROW_OPTIONS_SPACER1,
|
||||
GUI_ROW_OPTIONS_GAMEOPTIONS,
|
||||
GUI_ROW_OPTIONS_SPACER2,
|
||||
GUI_ROW_OPTIONS_STRICT,
|
||||
GUI_ROW_OPTIONS_BEGIN_NEW,
|
||||
#if OOLITE_SDL
|
||||
GUI_ROW_OPTIONS_SPACER3,
|
||||
GUI_ROW_OPTIONS_QUIT,
|
||||
@ -126,11 +125,14 @@ enum
|
||||
GUI_ROW_MARKET_KEY = 1,
|
||||
GUI_ROW_MARKET_START = 2,
|
||||
GUI_ROW_MARKET_CASH = 20,
|
||||
GUI_ROW_INTERFACES_HEADING = 1,
|
||||
GUI_ROW_INTERFACES_START = 3,
|
||||
GUI_ROW_INTERFACES_HEADING = 1,
|
||||
GUI_ROW_INTERFACES_START = 3,
|
||||
GUI_MAX_ROWS_INTERFACES = 12,
|
||||
GUI_ROW_INTERFACES_DETAIL = GUI_ROW_INTERFACES_START + GUI_MAX_ROWS_INTERFACES + 1,
|
||||
GUI_ROW_NO_INTERFACES = 3
|
||||
GUI_ROW_NO_INTERFACES = 3,
|
||||
GUI_ROW_SCENARIOS_START = 3,
|
||||
GUI_MAX_ROWS_SCENARIOS = 12,
|
||||
GUI_ROW_SCENARIOS_DETAIL = GUI_ROW_SCENARIOS_START + GUI_MAX_ROWS_SCENARIOS + 2,
|
||||
|
||||
};
|
||||
#if GUI_FIRST_ROW() < 0
|
||||
@ -520,6 +522,7 @@ typedef enum
|
||||
|
||||
// save-file
|
||||
NSString *save_path;
|
||||
NSString *scenarioKey;
|
||||
|
||||
// position of viewports
|
||||
Vector forwardViewOffset, aftViewOffset, portViewOffset, starboardViewOffset;
|
||||
@ -809,6 +812,8 @@ typedef enum
|
||||
|
||||
- (BOOL) takeInternalDamage;
|
||||
|
||||
- (BOOL) endScenario:(NSString *)key;
|
||||
|
||||
- (NSMutableArray *) roleWeights;
|
||||
- (void) addRoleForAggression:(ShipEntity *)victim;
|
||||
- (void) addRoleForMining;
|
||||
@ -861,6 +866,7 @@ typedef enum
|
||||
- (void) calculateCurrentCargo;
|
||||
- (void) setGuiToMarketScreen;
|
||||
|
||||
- (void) setupStartScreenGui;
|
||||
- (void) setGuiToIntroFirstGo:(BOOL)justCobra;
|
||||
|
||||
- (void) noteGUIWillChangeTo:(OOGUIScreenID)toScreen;
|
||||
|
@ -842,6 +842,12 @@ static GLfloat sBaseMass = 0.0;
|
||||
[result setObject:ArrayFromHPVector(dpos) forKey:@"docked_station_position"];
|
||||
[result setObject:[UNIVERSE getStationMarkets] forKey:@"station_markets"];
|
||||
|
||||
// scenario information
|
||||
if (scenarioKey != nil)
|
||||
{
|
||||
[result setObject:scenarioKey forKey:@"scenario"];
|
||||
}
|
||||
|
||||
// create checksum
|
||||
clear_checksum();
|
||||
munge_checksum(galaxy_seed.a); munge_checksum(galaxy_seed.b); munge_checksum(galaxy_seed.c);
|
||||
@ -1746,6 +1752,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
- (void) completeSetUpAndSetTarget:(BOOL)setTarget
|
||||
{
|
||||
[OOSoundSource stopAll];
|
||||
|
||||
[self setDockedStation:[UNIVERSE station]];
|
||||
[self setLastAegisLock:[UNIVERSE planet]];
|
||||
|
||||
@ -1894,6 +1901,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
DESTROY(specialCargo);
|
||||
|
||||
DESTROY(save_path);
|
||||
DESTROY(scenarioKey);
|
||||
|
||||
DESTROY(_customViews);
|
||||
|
||||
@ -2004,7 +2012,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
[self updateTrumbles:delta_t];
|
||||
|
||||
OOEntityStatus status = [self status];
|
||||
if (EXPECT_NOT(status == STATUS_START_GAME && gui_screen != GUI_SCREEN_INTRO1 && gui_screen != GUI_SCREEN_INTRO2))
|
||||
if (EXPECT_NOT(status == STATUS_START_GAME && gui_screen != GUI_SCREEN_INTRO1 && gui_screen != GUI_SCREEN_INTRO2 && gui_screen != GUI_SCREEN_NEWGAME && gui_screen != GUI_SCREEN_LOAD))
|
||||
{
|
||||
UPDATE_STAGE(@"setGuiToIntroFirstGo:");
|
||||
[self setGuiToIntroFirstGo:YES]; //set up demo mode
|
||||
@ -2608,6 +2616,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
case GUI_SCREEN_MAIN:
|
||||
case GUI_SCREEN_INTRO1:
|
||||
case GUI_SCREEN_INTRO2:
|
||||
case GUI_SCREEN_NEWGAME:
|
||||
case GUI_SCREEN_MARKET:
|
||||
case GUI_SCREEN_OPTIONS:
|
||||
case GUI_SCREEN_GAMEOPTIONS:
|
||||
@ -5737,6 +5746,17 @@ static GLfloat sBaseMass = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) endScenario:(NSString *)key
|
||||
{
|
||||
if (scenarioKey != nil && [key isEqualToString:scenarioKey])
|
||||
{
|
||||
[UNIVERSE reinitAndShowDemo:YES];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (void) enterDock:(StationEntity *)station
|
||||
{
|
||||
NSParameterAssert(station != nil);
|
||||
@ -7405,7 +7425,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
GuiDisplayGen* gui = [UNIVERSE gui];
|
||||
GUI_ROW_INIT(gui);
|
||||
|
||||
int first_sel_row = (canLoadOrSave)? GUI_ROW(,SAVE) : GUI_ROW(,BEGIN_NEW);
|
||||
int first_sel_row = (canLoadOrSave)? GUI_ROW(,SAVE) : GUI_ROW(,GAMEOPTIONS);
|
||||
if (canQuickSave)
|
||||
first_sel_row = GUI_ROW(,QUICKSAVE);
|
||||
|
||||
@ -7431,7 +7451,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
[gui setColor:[OOColor grayColor] forRow:GUI_ROW(,LOAD)];
|
||||
}
|
||||
|
||||
[gui setText:DESC(@"options-begin-new-game") forRow:GUI_ROW(,BEGIN_NEW) align:GUI_ALIGN_CENTER];
|
||||
[gui setText:DESC(@"options-return-to-menu") forRow:GUI_ROW(,BEGIN_NEW) align:GUI_ALIGN_CENTER];
|
||||
[gui setKey:GUI_KEY_OK forRow:GUI_ROW(,BEGIN_NEW)];
|
||||
|
||||
[gui setText:DESC(@"options-game-options") forRow:GUI_ROW(,GAMEOPTIONS) align:GUI_ALIGN_CENTER];
|
||||
@ -7446,12 +7466,6 @@ static GLfloat sBaseMass = 0.0;
|
||||
[gui setKey:GUI_KEY_OK forRow:GUI_ROW(,QUIT)];
|
||||
#endif
|
||||
|
||||
if ([UNIVERSE strict])
|
||||
[gui setText:DESC(@"options-reset-to-unrestricted-play") forRow:GUI_ROW(,STRICT) align:GUI_ALIGN_CENTER];
|
||||
else
|
||||
[gui setText:DESC(@"options-reset-to-strict-play") forRow:GUI_ROW(,STRICT) align:GUI_ALIGN_CENTER];
|
||||
[gui setKey:GUI_KEY_OK forRow:GUI_ROW(,STRICT)];
|
||||
|
||||
[gui setSelectableRange:NSMakeRange(first_sel_row, GUI_ROW_OPTIONS_END_OF_LIST)];
|
||||
|
||||
if ([[UNIVERSE gameController] isGamePaused] || (!canLoadOrSave && [self status] == STATUS_DOCKED))
|
||||
@ -8106,6 +8120,71 @@ static NSString *last_outfitting_key=nil;
|
||||
}
|
||||
|
||||
|
||||
- (void) setupStartScreenGui
|
||||
{
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
NSString *text = nil;
|
||||
|
||||
[[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
|
||||
|
||||
[gui clear];
|
||||
|
||||
[gui setTitle:@"Oolite"];
|
||||
|
||||
text = DESC(@"game-copyright");
|
||||
[gui setText:text forRow:15 align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor whiteColor] forRow:15];
|
||||
|
||||
text = DESC(@"theme-music-credit");
|
||||
[gui setText:text forRow:17 align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor grayColor] forRow:17];
|
||||
|
||||
int row = 22;
|
||||
|
||||
text = DESC(@"oolite-start-option-1");
|
||||
[gui setText:text forRow:row align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:row];
|
||||
[gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
|
||||
|
||||
++row;
|
||||
|
||||
text = DESC(@"oolite-start-option-2");
|
||||
[gui setText:text forRow:row align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:row];
|
||||
[gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
|
||||
|
||||
++row;
|
||||
|
||||
text = DESC(@"oolite-start-option-3");
|
||||
[gui setText:text forRow:row align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:row];
|
||||
[gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
|
||||
|
||||
++row;
|
||||
|
||||
#if 0
|
||||
// not yet implemented
|
||||
text = DESC(@"oolite-start-option-4");
|
||||
[gui setText:text forRow:row align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:row];
|
||||
[gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
|
||||
#endif
|
||||
|
||||
++row;
|
||||
|
||||
text = DESC(@"oolite-start-option-5");
|
||||
[gui setText:text forRow:row align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:row];
|
||||
[gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
|
||||
|
||||
[gui setSelectableRange:NSMakeRange(22,5)];
|
||||
[gui setSelectedRow:22];
|
||||
|
||||
[gui setBackgroundTextureKey:@"intro"];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void) setGuiToIntroFirstGo:(BOOL)justCobra
|
||||
{
|
||||
NSString *text = nil;
|
||||
@ -8113,28 +8192,17 @@ static NSString *last_outfitting_key=nil;
|
||||
OOGUIRow msgLine = 2;
|
||||
|
||||
[[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
|
||||
[[UNIVERSE gameView] clearMouse];
|
||||
|
||||
if (justCobra)
|
||||
{
|
||||
[UNIVERSE removeDemoShips];
|
||||
[[OOCacheManager sharedCache] flush]; // At first startup, a lot of stuff is cached
|
||||
}
|
||||
[gui clear];
|
||||
[gui setTitle:@"Oolite"];
|
||||
|
||||
if (justCobra)
|
||||
{
|
||||
text = DESC(@"game-copyright");
|
||||
[gui setText:text forRow:15 align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor whiteColor] forRow:15];
|
||||
|
||||
text = DESC(@"theme-music-credit");
|
||||
[gui setText:text forRow:17 align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor grayColor] forRow:17];
|
||||
|
||||
text = DESC(@"load-previous-commander");
|
||||
[gui setText:text forRow:19 align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:19];
|
||||
|
||||
[self setupStartScreenGui];
|
||||
|
||||
// check for error messages from Resource Manager
|
||||
//[ResourceManager paths]; done in Universe already
|
||||
@ -8205,10 +8273,14 @@ static NSString *last_outfitting_key=nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
[gui setText:([UNIVERSE strict])? DESC(@"strict-play-enabled"):DESC(@"unrestricted-play-enabled") forRow:1 align:GUI_ALIGN_CENTER];
|
||||
text = DESC(@"press-space-commander");
|
||||
[gui setText:text forRow:21 align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:21];
|
||||
[gui clear];
|
||||
|
||||
text = DESC(@"oolite-ship-library-title");
|
||||
[gui setTitle:text];
|
||||
|
||||
text = DESC(@"oolite-ship-library-exit");
|
||||
[gui setText:text forRow:23 align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:23];
|
||||
}
|
||||
|
||||
[gui setShowTextCursor:NO];
|
||||
@ -8223,7 +8295,7 @@ static NSString *last_outfitting_key=nil;
|
||||
|
||||
[self setShowDemoShips:YES];
|
||||
[gui setBackgroundTextureKey:@"intro"];
|
||||
[UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
|
||||
[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
|
||||
}
|
||||
|
||||
|
||||
|
@ -379,6 +379,7 @@ static NSTimeInterval time_last_frame;
|
||||
BOOL arrow_up = [gameView isDown:key_gui_arrow_up];
|
||||
BOOL arrow_down = [gameView isDown:key_gui_arrow_down];
|
||||
BOOL mouse_click = [gameView isDown:gvMouseLeftButton];
|
||||
BOOL mouse_dbl_click = [gameView isDown:gvMouseDoubleClick];
|
||||
|
||||
if (arrow_down)
|
||||
{
|
||||
@ -433,6 +434,24 @@ static NSTimeInterval time_last_frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mouse_dbl_click)
|
||||
{
|
||||
int click_row = 0;
|
||||
if (UNIVERSE)
|
||||
click_row = UNIVERSE->cursor_row;
|
||||
if ([gui setSelectedRow:click_row])
|
||||
{
|
||||
result = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if double-clicked on an unselectable row, clear the
|
||||
// state so it doesn't activate whatever was last
|
||||
// selected
|
||||
[gameView clearMouse];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
upDownKeyPressed = (arrow_up || arrow_down || mouse_click);
|
||||
|
||||
@ -1845,7 +1864,7 @@ static NSTimeInterval time_last_frame;
|
||||
[demoShip release];
|
||||
demoShip = nil;
|
||||
|
||||
[self loadPlayerFromFile:commanderFile];
|
||||
[self loadPlayerFromFile:commanderFile asNew:NO];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1981,17 +2000,6 @@ static NSTimeInterval time_last_frame;
|
||||
[self setGuiToGameOptionsScreen];
|
||||
}
|
||||
|
||||
/* TODO: Investigate why this has to be handled last (if the
|
||||
quit item and this are swapped, the game crashes if
|
||||
strict mode is selected with SIGSEGV in the ObjC runtime
|
||||
system. The stack trace shows it crashes when it hits
|
||||
the if statement, trying to send the message to one of
|
||||
the things contained.) */
|
||||
if ((guiSelectedRow == GUI_ROW(,STRICT))&& selectKeyPress)
|
||||
{
|
||||
[UNIVERSE setStrict:![UNIVERSE strict]];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GUI_SCREEN_EQUIP_SHIP:
|
||||
@ -3485,53 +3493,55 @@ static BOOL autopilot_pause;
|
||||
switch (gui_screen)
|
||||
{
|
||||
case GUI_SCREEN_INTRO1:
|
||||
if(0) {} // Dummy statement so compiler does not complain.
|
||||
|
||||
// In order to support multiple languages, the Y/N response cannot be hardcoded. We get the keys
|
||||
// corresponding to Yes/No from descriptions.plist and if they are not found there, we set them
|
||||
// by default to [yY] and [nN] respectively.
|
||||
id valueYes = [[[UNIVERSE descriptions] oo_stringForKey:@"load-previous-commander-yes" defaultValue:@"y"] lowercaseString];
|
||||
id valueNo = [[[UNIVERSE descriptions] oo_stringForKey:@"load-previous-commander-no" defaultValue:@"n"] lowercaseString];
|
||||
unsigned char charYes, charNo;
|
||||
|
||||
charYes = [valueYes characterAtIndex: 0] & 0x00ff; // Use lower byte of unichar.
|
||||
charNo = [valueNo characterAtIndex: 0] & 0x00ff; // Use lower byte of unichar.
|
||||
|
||||
if (!disc_operation_in_progress)
|
||||
[self handleGUIUpDownArrowKeys];
|
||||
|
||||
int row_zero = 21;
|
||||
if (!selectPressed)
|
||||
{
|
||||
if (([gameView isDown:charYes]) || ([gameView isDown:charYes - 32]))
|
||||
if (!disc_operation_in_progress)
|
||||
{
|
||||
[[OOMusicController sharedController] stopThemeMusic];
|
||||
disc_operation_in_progress = YES;
|
||||
[self setStatus:STATUS_DOCKED];
|
||||
[UNIVERSE removeDemoShips];
|
||||
[gui clearBackground];
|
||||
if (![self loadPlayer])
|
||||
if (([gameView isDown:gvMouseDoubleClick] || [gameView isDown:13]) && [gui selectedRow] == 2+row_zero)
|
||||
{
|
||||
[self setGuiToIntroFirstGo:NO];
|
||||
[UNIVERSE selectIntro2Next];
|
||||
// [[OOMusicController sharedController] stopThemeMusic];
|
||||
disc_operation_in_progress = YES;
|
||||
[UNIVERSE removeDemoShips];
|
||||
[gui clearBackground];
|
||||
if (![self loadPlayer])
|
||||
{
|
||||
[self setGuiToIntroFirstGo:YES];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (([gameView isDown:gvMouseDoubleClick] || [gameView isDown:13]) && [gui selectedRow] == 1+row_zero)
|
||||
{
|
||||
missionTextRow = 0;
|
||||
[self setGuiToScenarioScreen:0];
|
||||
}
|
||||
else if (([gameView isDown:gvMouseDoubleClick] || [gameView isDown:13]) && [gui selectedRow] == 3+row_zero)
|
||||
{
|
||||
[self setGuiToIntroFirstGo:NO];
|
||||
}
|
||||
else if (([gameView isDown:gvMouseDoubleClick] || [gameView isDown:13]) && [gui selectedRow] == 5+row_zero)
|
||||
{
|
||||
[[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on start screen"];
|
||||
}
|
||||
else
|
||||
{
|
||||
disc_operation_in_progress = NO;
|
||||
}
|
||||
}
|
||||
if (([gameView isDown:charNo]) || ([gameView isDown:charNo - 32]))
|
||||
selectPressed = [gameView isDown:13];
|
||||
if ([gameView isDown:gvMouseDoubleClick])
|
||||
{
|
||||
[self setGuiToIntroFirstGo:NO];
|
||||
// removed intro inconsistency between normal startup and restart.
|
||||
//[UNIVERSE selectIntro2Next];
|
||||
[gameView clearMouse];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GUI_SCREEN_INTRO2:
|
||||
if ([gameView isDown:' ']) // '<space>'
|
||||
{
|
||||
[self setStatus: STATUS_DOCKED];
|
||||
[UNIVERSE removeDemoShips];
|
||||
[gui clearBackground];
|
||||
[[OOMusicController sharedController] stopThemeMusic];
|
||||
[[UNIVERSE gameView] supressKeysUntilKeyUp]; // to prevent a missionscreen on the first page from reacting on this keypress.
|
||||
[self setGuiToStatusScreen];
|
||||
[self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")]; // trigger missionScreenOpportunity immediately after (re)start
|
||||
[self setGuiToIntroFirstGo:YES];
|
||||
}
|
||||
if ([gameView isDown:key_gui_arrow_left]) // '<--'
|
||||
{
|
||||
@ -3545,7 +3555,32 @@ static BOOL autopilot_pause;
|
||||
}
|
||||
upDownKeyPressed = (([gameView isDown:key_gui_arrow_left])||([gameView isDown:key_gui_arrow_right]));
|
||||
break;
|
||||
|
||||
|
||||
case GUI_SCREEN_NEWGAME:
|
||||
if ([self handleGUIUpDownArrowKeys])
|
||||
{
|
||||
[self showScenarioDetails];
|
||||
}
|
||||
|
||||
if (!selectPressed)
|
||||
{
|
||||
if ([gameView isDown:13] || [gameView isDown:gvMouseDoubleClick]) // enter
|
||||
{
|
||||
if (![self startScenario])
|
||||
{
|
||||
[UNIVERSE removeDemoShips];
|
||||
[self setGuiToIntroFirstGo:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
selectPressed = [gameView isDown:13];
|
||||
if ([gameView isDown:gvMouseDoubleClick] || [gameView isDown:gvMouseLeftButton])
|
||||
{
|
||||
[gameView clearMouse];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case GUI_SCREEN_MISSION:
|
||||
if ([[self hud] isHidden])
|
||||
{
|
||||
@ -3621,6 +3656,23 @@ static BOOL autopilot_pause;
|
||||
}
|
||||
break;
|
||||
|
||||
#if OO_USE_CUSTOM_LOAD_SAVE
|
||||
// DJS: Farm off load/save screen options to LoadSave.m
|
||||
case GUI_SCREEN_LOAD:
|
||||
{
|
||||
NSString *commanderFile = [self commanderSelector];
|
||||
if(commanderFile)
|
||||
{
|
||||
// also release the demo ship here (see showShipyardModel and noteGUIDidChangeFrom)
|
||||
[demoShip release];
|
||||
demoShip = nil;
|
||||
|
||||
[self loadPlayerFromFile:commanderFile asNew:NO];
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -33,15 +33,16 @@ MA 02110-1301, USA.
|
||||
#import "MyOpenGLView.h"
|
||||
#import "Universe.h"
|
||||
|
||||
#define LABELROW 1
|
||||
#define BACKROW 2
|
||||
#define STARTROW 3
|
||||
#define ENDROW 16
|
||||
#define MOREROW 16
|
||||
#define EXITROW 1
|
||||
#define LABELROW 2
|
||||
#define BACKROW 3
|
||||
#define STARTROW 4
|
||||
#define ENDROW 17
|
||||
#define MOREROW 17
|
||||
#define NUMROWS 13
|
||||
#define COLUMNS 2
|
||||
#define INPUTROW 21
|
||||
#define CDRDESCROW 18
|
||||
#define CDRDESCROW 19
|
||||
#define SAVE_OVERWRITE_WARN_ROW 5
|
||||
#define SAVE_OVERWRITE_YES_ROW 8
|
||||
#define SAVE_OVERWRITE_NO_ROW 9
|
||||
@ -67,6 +68,12 @@ MA 02110-1301, USA.
|
||||
- (void) quicksavePlayer;
|
||||
- (void) autosavePlayer;
|
||||
|
||||
- (void) setGuiToScenarioScreen:(int)page;
|
||||
- (void) addScenarioModel:(NSString *)shipKey;
|
||||
- (void) showScenarioDetails;
|
||||
- (BOOL) startScenario;
|
||||
|
||||
|
||||
#if OO_USE_CUSTOM_LOAD_SAVE
|
||||
|
||||
// Interface for PlayerEntityControls
|
||||
@ -76,7 +83,7 @@ MA 02110-1301, USA.
|
||||
|
||||
#endif
|
||||
|
||||
- (BOOL) loadPlayerFromFile:(NSString *)fileToOpen;
|
||||
- (BOOL) loadPlayerFromFile:(NSString *)fileToOpen asNew:(BOOL)asNew;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -29,7 +29,11 @@
|
||||
|
||||
#import "NSFileManagerOOExtensions.h"
|
||||
#import "GameController.h"
|
||||
#import "ResourceManager.h"
|
||||
#import "OOStringExpander.h"
|
||||
#import "PlayerEntityControls.h"
|
||||
#import "ProxyPlayerEntity.h"
|
||||
#import "ShipEntityAI.h"
|
||||
#import "OOXMLExtensions.h"
|
||||
#import "OOSound.h"
|
||||
#import "OOColor.h"
|
||||
@ -200,6 +204,180 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
||||
}
|
||||
|
||||
|
||||
- (void) setGuiToScenarioScreen:(int)page
|
||||
{
|
||||
NSArray *scenarios = [UNIVERSE scenarios];
|
||||
[UNIVERSE removeDemoShips];
|
||||
// GUI stuff
|
||||
{
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
OOGUIRow start_row = GUI_ROW_SCENARIOS_START;
|
||||
OOGUIRow row = start_row;
|
||||
BOOL guiChanged = (gui_screen != GUI_SCREEN_NEWGAME);
|
||||
|
||||
[gui clearAndKeepBackground:!guiChanged];
|
||||
[gui setTitle:DESC(@"oolite-newgame-title")];
|
||||
|
||||
OOGUITabSettings tab_stops;
|
||||
tab_stops[0] = 0;
|
||||
tab_stops[1] = -480;
|
||||
[gui setTabStops:tab_stops];
|
||||
|
||||
unsigned n_rows = GUI_MAX_ROWS_SCENARIOS;
|
||||
NSUInteger i, count = [scenarios count];
|
||||
|
||||
NSDictionary *scenario = nil;
|
||||
|
||||
[gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-scenario-exit"), @" <----- ", nil] forRow:start_row - 2];
|
||||
[gui setColor:[OOColor redColor] forRow:start_row - 2];
|
||||
[gui setKey:@"exit" forRow:start_row - 2];
|
||||
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
[gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:start_row - 1];
|
||||
[gui setColor:[OOColor greenColor] forRow:start_row - 1];
|
||||
[gui setKey:[NSString stringWithFormat:@"__page:%lu",page-1] forRow:start_row - 1];
|
||||
}
|
||||
|
||||
[self setShowDemoShips:NO];
|
||||
|
||||
for (i = page*n_rows ; i < count && row < start_row + n_rows ; i++)
|
||||
{
|
||||
scenario = [[UNIVERSE scenarios] objectAtIndex:i];
|
||||
[gui setText:OOExpand([NSString stringWithFormat:@" %@ ",[scenario oo_stringForKey:@"name"]]) forRow:row];
|
||||
[gui setKey:[NSString stringWithFormat:@"Scenario:%lu", (unsigned long)i] forRow:row];
|
||||
++row;
|
||||
}
|
||||
|
||||
if ((page+1) * n_rows < count)
|
||||
{
|
||||
[gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:row];
|
||||
[gui setColor:[OOColor greenColor] forRow:row];
|
||||
[gui setKey:[NSString stringWithFormat:@"__page:%lu",page+1] forRow:row];
|
||||
++row;
|
||||
}
|
||||
|
||||
[gui setSelectableRange:NSMakeRange(start_row - 2,3 + row - start_row)];
|
||||
[gui setSelectedRow:start_row];
|
||||
[self showScenarioDetails];
|
||||
}
|
||||
|
||||
gui_screen = GUI_SCREEN_NEWGAME;
|
||||
[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
|
||||
}
|
||||
|
||||
- (void) addScenarioModel:(NSString *)shipKey
|
||||
{
|
||||
Quaternion q2 = { (GLfloat)M_SQRT1_2, (GLfloat)M_SQRT1_2, (GLfloat)0.0f, (GLfloat)0.0f };
|
||||
// MKW - retrieve last demo ships' orientation and release it
|
||||
if( demoShip != nil )
|
||||
{
|
||||
q2 = [demoShip orientation];
|
||||
[demoShip release];
|
||||
}
|
||||
NSDictionary *shipData = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipKey];
|
||||
ShipEntity *ship = [[ProxyPlayerEntity alloc] initWithKey:shipKey definition:shipData];
|
||||
[ship wasAddedToUniverse];
|
||||
|
||||
GLfloat cr = [ship collisionRadius];
|
||||
[ship setOrientation: q2];
|
||||
|
||||
[ship setPositionX:1.2 * cr y:0.8 * cr z:6.4 * cr];
|
||||
[ship setScanClass: CLASS_NO_DRAW];
|
||||
[ship setRoll: M_PI/10.0];
|
||||
[ship setPitch: M_PI/25.0];
|
||||
if([ship pendingEscortCount] > 0) [ship setPendingEscortCount:0];
|
||||
[ship setAITo: @"nullAI.plist"];
|
||||
id subEntStatus = [shipData objectForKey:@"subentities_status"];
|
||||
// show missing subentities if there's a subentities_status key
|
||||
if (subEntStatus != nil) [ship deserializeShipSubEntitiesFrom:(NSString *)subEntStatus];
|
||||
[UNIVERSE addEntity: ship];
|
||||
// MKW - save demo ship for its rotation
|
||||
demoShip = [ship retain];
|
||||
|
||||
[ship setStatus: STATUS_COCKPIT_DISPLAY];
|
||||
|
||||
[ship release];
|
||||
}
|
||||
|
||||
|
||||
- (void) showScenarioDetails
|
||||
{
|
||||
GuiDisplayGen* gui = [UNIVERSE gui];
|
||||
NSString* key = [gui selectedRowKey];
|
||||
[UNIVERSE removeDemoShips];
|
||||
|
||||
if ([key hasPrefix:@"Scenario"])
|
||||
{
|
||||
int item = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
|
||||
NSDictionary *scenario = [[UNIVERSE scenarios] objectAtIndex:item];
|
||||
[self setShowDemoShips:NO];
|
||||
for (NSUInteger i=GUI_ROW_SCENARIOS_DETAIL;i<=27;i++)
|
||||
{
|
||||
[gui setText:@"" forRow:i];
|
||||
}
|
||||
if (scenario)
|
||||
{
|
||||
[gui addLongText:OOExpand([scenario oo_stringForKey:@"description"]) startingAtRow:GUI_ROW_SCENARIOS_DETAIL align:GUI_ALIGN_LEFT];
|
||||
NSString *shipKey = [scenario oo_stringForKey:@"model"];
|
||||
if (shipKey != nil)
|
||||
{
|
||||
[self addScenarioModel:shipKey];
|
||||
[self setShowDemoShips:YES];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) startScenario
|
||||
{
|
||||
GuiDisplayGen* gui = [UNIVERSE gui];
|
||||
NSString* key = [gui selectedRowKey];
|
||||
|
||||
if ([key isEqualToString:@"exit"])
|
||||
{
|
||||
// intended to return to main menu
|
||||
return NO;
|
||||
}
|
||||
if ([key hasPrefix:@"__page"])
|
||||
{
|
||||
int page = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
|
||||
[self setGuiToScenarioScreen:page];
|
||||
return YES;
|
||||
}
|
||||
int selection = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
|
||||
|
||||
NSDictionary *scenario = [[UNIVERSE scenarios] objectAtIndex:selection];
|
||||
NSString *file = [scenario oo_stringForKey:@"file" defaultValue:nil];
|
||||
if (file == nil)
|
||||
{
|
||||
OOLog(@"scenario.init.error",@"No file entry found for scenario");
|
||||
return NO;
|
||||
}
|
||||
NSString *path = [ResourceManager pathForFileNamed:file inFolder:@"Scenarios"];
|
||||
if (path == nil)
|
||||
{
|
||||
OOLog(@"scenario.init.error",@"Game file not found for scenario %@",file);
|
||||
return NO;
|
||||
}
|
||||
BOOL result = [self loadPlayerFromFile:path asNew:YES];
|
||||
if (!result)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
[scenarioKey release];
|
||||
scenarioKey = [[scenario oo_stringForKey:@"scenario" defaultValue:nil] retain];
|
||||
|
||||
// don't drop the save game directory in
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if OO_USE_CUSTOM_LOAD_SAVE
|
||||
|
||||
- (NSString *)commanderSelector
|
||||
@ -254,6 +432,13 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
||||
NSDictionary *cdr;
|
||||
switch ([gui selectedRow])
|
||||
{
|
||||
case EXITROW:
|
||||
if ([self status] == STATUS_START_GAME)
|
||||
{
|
||||
[self setGuiToIntroFirstGo:YES];
|
||||
return nil;
|
||||
}
|
||||
break;
|
||||
case BACKROW:
|
||||
currentPage--;
|
||||
[self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
|
||||
@ -429,7 +614,7 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
||||
#endif
|
||||
|
||||
|
||||
- (BOOL) loadPlayerFromFile:(NSString *)fileToOpen
|
||||
- (BOOL) loadPlayerFromFile:(NSString *)fileToOpen asNew:(BOOL)asNew
|
||||
{
|
||||
/* TODO: it would probably be better to load by creating a new
|
||||
PlayerEntity, verifying that's OK, then replacing the global player.
|
||||
@ -515,11 +700,14 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
||||
|
||||
if (loadedOK)
|
||||
{
|
||||
[save_path autorelease];
|
||||
save_path = [fileToOpen retain];
|
||||
if (!asNew)
|
||||
{
|
||||
[save_path autorelease];
|
||||
save_path = [fileToOpen retain];
|
||||
|
||||
[[[UNIVERSE gameView] gameController] setPlayerFileToLoad:fileToOpen];
|
||||
[[[UNIVERSE gameView] gameController] setPlayerFileDirectory:fileToOpen];
|
||||
[[[UNIVERSE gameView] gameController] setPlayerFileToLoad:fileToOpen];
|
||||
[[[UNIVERSE gameView] gameController] setPlayerFileDirectory:fileToOpen];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -568,6 +756,14 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
||||
|
||||
[self calculateCurrentCargo];
|
||||
|
||||
// set scenario key if the scenario allows saving and has one
|
||||
NSString *scenario = [fileDic oo_stringForKey:@"scenario_key" defaultValue:nil];
|
||||
DESTROY(scenarioKey);
|
||||
if (scenario != nil)
|
||||
{
|
||||
scenarioKey = [scenario retain];
|
||||
}
|
||||
|
||||
// Remember the savegame target, run js startUp.
|
||||
[self completeSetUpAndSetTarget:NO];
|
||||
// run initial system population
|
||||
@ -617,7 +813,7 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
||||
NSURL *url = oPanel.URL;
|
||||
if (url.isFileURL)
|
||||
{
|
||||
return [self loadPlayerFromFile:url.path];
|
||||
return [self loadPlayerFromFile:url.path asNew:NO];
|
||||
}
|
||||
}
|
||||
|
||||
@ -888,18 +1084,19 @@ NSComparisonResult sortCommanders(id cdr1, id cdr2, void *context)
|
||||
tabStop[1]=160;
|
||||
tabStop[2]=270;
|
||||
[gui setTabStops: tabStop];
|
||||
[gui setColor: [OOColor greenColor] forRow: LABELROW];
|
||||
[gui setArray: [NSArray arrayWithObjects: DESC(@"loadsavescreen-commander-name"), DESC(@"loadsavescreen-rating"), nil]
|
||||
forRow:LABELROW];
|
||||
|
||||
// clear text lines here
|
||||
for (i = STARTROW - 1; i < ENDROW + 1; i++)
|
||||
for (i = EXITROW ; i < ENDROW + 1; i++)
|
||||
{
|
||||
[gui setText:@"" forRow:i align:GUI_ALIGN_LEFT];
|
||||
[gui setColor: [OOColor yellowColor] forRow: i];
|
||||
[gui setKey:GUI_KEY_SKIP forRow:i];
|
||||
}
|
||||
|
||||
|
||||
[gui setColor: [OOColor greenColor] forRow: LABELROW];
|
||||
[gui setArray: [NSArray arrayWithObjects: DESC(@"loadsavescreen-commander-name"), DESC(@"loadsavescreen-rating"), nil]
|
||||
forRow:LABELROW];
|
||||
|
||||
if (page)
|
||||
{
|
||||
[gui setColor:[OOColor greenColor] forRow:STARTROW-1];
|
||||
@ -908,6 +1105,15 @@ NSComparisonResult sortCommanders(id cdr1, id cdr2, void *context)
|
||||
[gui setKey:GUI_KEY_OK forRow:STARTROW-1];
|
||||
rangeStart=STARTROW-1;
|
||||
}
|
||||
|
||||
if ([self status] == STATUS_START_GAME)
|
||||
{
|
||||
[gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-loadsave-exit"), @" <----- ", nil] forRow:EXITROW];
|
||||
[gui setColor:[OOColor redColor] forRow:EXITROW];
|
||||
[gui setKey:GUI_KEY_OK forRow:EXITROW];
|
||||
rangeStart = EXITROW;
|
||||
}
|
||||
|
||||
|
||||
if (firstIndex + NUMROWS >= [cdrDetailArray count])
|
||||
{
|
||||
|
@ -273,7 +273,11 @@ static GameController *sSharedController = nil;
|
||||
if (playerFileToLoad != nil)
|
||||
{
|
||||
[self logProgress:DESC(@"loading-player")];
|
||||
[PLAYER loadPlayerFromFile:playerFileToLoad];
|
||||
// fix problem with non-shader lighting when starting skips
|
||||
// the splash screen
|
||||
[UNIVERSE useGUILightSource:YES];
|
||||
[UNIVERSE useGUILightSource:NO];
|
||||
[PLAYER loadPlayerFromFile:playerFileToLoad asNew:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,6 +196,7 @@ typedef OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS];
|
||||
- (void) setKey:(NSString *)str forRow:(OOGUIRow)row;
|
||||
- (void) setText:(NSString *)str forRow:(OOGUIRow)row;
|
||||
- (void) setText:(NSString *)str forRow:(OOGUIRow)row align:(OOGUIAlignment)alignment;
|
||||
- (NSString *) reflowTextForMFD:(NSString *)input;
|
||||
- (OOGUIRow) addLongText:(NSString *)str
|
||||
startingAtRow:(OOGUIRow)row
|
||||
align:(OOGUIAlignment)alignment;
|
||||
|
@ -645,6 +645,39 @@ static BOOL _refreshStarChart = NO;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *) reflowTextForMFD:(NSString *)input
|
||||
{
|
||||
NSMutableString *output = [[NSMutableString alloc] initWithCapacity:512];
|
||||
NSArray *lines = [input componentsSeparatedByString:@"\n"];
|
||||
NSSize chSize = pixel_text_size;
|
||||
NSUInteger limit = chSize.width * 15;
|
||||
NSString *line = nil;
|
||||
foreach (line, lines)
|
||||
{
|
||||
NSMutableArray *words = ScanTokensFromString(line);
|
||||
NSMutableString *accum = [NSMutableString stringWithCapacity:64];
|
||||
while ([words count] > 1)
|
||||
{
|
||||
[accum appendString:[words oo_stringAtIndex:0]];
|
||||
[accum appendString:@" "];
|
||||
if (OORectFromString(accum, 0.0f, 0.0f,chSize).size.width + OORectFromString([words oo_stringAtIndex:1], 0.0f, 0.0f,chSize).size.width > limit)
|
||||
{
|
||||
// can't fit next word on this line
|
||||
[output appendString:[accum stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
|
||||
[output appendString:@"\n"];
|
||||
[accum setString:@""];
|
||||
}
|
||||
[words removeObjectAtIndex:0];
|
||||
}
|
||||
[output appendString:accum];
|
||||
[output appendString:[words oo_stringAtIndex:0]];
|
||||
[output appendString:@"\n"];
|
||||
}
|
||||
|
||||
return [output autorelease];
|
||||
}
|
||||
|
||||
|
||||
- (void) leaveLastLine
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -187,6 +187,7 @@ MA 02110-1301, USA.
|
||||
#define DRAW_SURROUND_KEY @"draw_surround"
|
||||
#define EQUIPMENT_REQUIRED_KEY @"equipment_required"
|
||||
#define ALERT_CONDITIONS_KEY @"alert_conditions"
|
||||
#define DIAL_REQUIRED_KEY @"with_dial"
|
||||
#define LABELLED_KEY @"labelled"
|
||||
#define TEXT_KEY @"text"
|
||||
#define RGB_COLOR_KEY @"rgb_color"
|
||||
@ -248,6 +249,8 @@ MA 02110-1301, USA.
|
||||
BOOL hudHidden;
|
||||
|
||||
int last_transmitter;
|
||||
|
||||
NSMutableSet *_hiddenSelectors;
|
||||
|
||||
// Crosshairs
|
||||
OOCrosshairs *_crosshairs;
|
||||
@ -283,6 +286,11 @@ MA 02110-1301, USA.
|
||||
|
||||
- (BOOL) isHidden;
|
||||
- (void) setHidden:(BOOL)newValue;
|
||||
|
||||
- (BOOL) hasHidden:(NSString *)selectorName;
|
||||
- (void) setHiddenSelector:(NSString *)selectorName hidden:(BOOL)hide;
|
||||
- (void) clearHiddenSelectors;
|
||||
|
||||
- (BOOL) isCompassActive;
|
||||
- (void) setCompassActive:(BOOL)newValue;
|
||||
|
||||
|
@ -58,7 +58,7 @@ MA 02110-1301, USA.
|
||||
#define WIDGET_INFO 0
|
||||
#define WIDGET_CACHE 1
|
||||
#define WIDGET_SELECTOR 2
|
||||
|
||||
#define WIDGET_SELECTOR_NAME 3
|
||||
|
||||
/* Convenience macros to make set-colour-or-default quicker. 'info' must be the NSDictionary and 'alpha' must be the overall alpha or these won't work */
|
||||
#define DO_SET_COLOR(t,d) SetGLColourFromInfo(info,t,d,alpha)
|
||||
@ -262,6 +262,8 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
|
||||
|
||||
hudHidden = NO;
|
||||
|
||||
_hiddenSelectors = [[NSMutableSet alloc] initWithCapacity:16];
|
||||
|
||||
hudUpdating = NO;
|
||||
|
||||
overallAlpha = [hudinfo oo_floatForKey:@"overall_alpha" defaultValue:DEFAULT_OVERALL_ALPHA];
|
||||
@ -308,7 +310,8 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
|
||||
DESTROY(propertiesReticleTargetSensitive);
|
||||
DESTROY(_crosshairOverrides);
|
||||
DESTROY(crosshairDefinition);
|
||||
|
||||
DESTROY(_hiddenSelectors);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@ -523,6 +526,35 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) hasHidden:(NSString *)selectorName
|
||||
{
|
||||
if (selectorName == nil)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
return [_hiddenSelectors containsObject:selectorName];
|
||||
}
|
||||
|
||||
|
||||
- (void) setHiddenSelector:(NSString *)selectorName hidden:(BOOL)hide
|
||||
{
|
||||
if (hide)
|
||||
{
|
||||
[_hiddenSelectors addObject:selectorName];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_hiddenSelectors removeObject:selectorName];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) clearHiddenSelectors
|
||||
{
|
||||
[_hiddenSelectors removeAllObjects];
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isCompassActive
|
||||
{
|
||||
return _compassActive;
|
||||
@ -638,9 +670,9 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
|
||||
// valid dial, now prefetch data
|
||||
struct CachedInfo cache;
|
||||
prefetchData(info, &cache);
|
||||
// add WIDGET_INFO, WIDGET_CACHE, WIDGET_SELECTOR to array
|
||||
// add WIDGET_INFO, WIDGET_CACHE, WIDGET_SELECTOR, WIDGET_SELECTOR_NAME to array
|
||||
[dialArray addObject:[NSArray arrayWithObjects:info, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)],
|
||||
[NSValue valueWithPointer:selector], nil]];
|
||||
[NSValue valueWithPointer:selector], selectorString, nil]];
|
||||
}
|
||||
|
||||
|
||||
@ -902,6 +934,12 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
|
||||
}
|
||||
}
|
||||
|
||||
// check association with hidden dials
|
||||
if ([self hasHidden:[info oo_stringForKey:DIAL_REQUIRED_KEY defaultValue:nil]])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OOTextureSprite *legendSprite = nil;
|
||||
NSString *legendText = nil;
|
||||
float x, y;
|
||||
@ -962,6 +1000,11 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
|
||||
}
|
||||
}
|
||||
|
||||
if (EXPECT_NOT([self hasHidden:[sCurrentDrawItem objectAtIndex:WIDGET_SELECTOR_NAME]]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// use the selector value stored during init.
|
||||
[self performSelector:[(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_SELECTOR] pointerValue] withObject:info];
|
||||
OOCheckOpenGLErrors(@"HeadUpDisplay after drawHUDItem %@", info);
|
||||
@ -1513,6 +1556,8 @@ static void prefetchData(NSDictionary *info, struct CachedInfo *data)
|
||||
[[beacon beaconDrawable] oo_drawHUDBeaconIconAt:NSMakePoint(x, y) size:siz alpha:alpha z:z1];
|
||||
break;
|
||||
}
|
||||
OOGL(GLScaledLineWidth(lineWidth)); // reset
|
||||
|
||||
_compassUpdated = YES;
|
||||
_compassActive = YES;
|
||||
}
|
||||
@ -2860,6 +2905,8 @@ static OOPolygonSprite *IconForMissileRole(NSString *role)
|
||||
}
|
||||
else if (div < 1.0) // insensitive mode (shouldn't happen)
|
||||
GLDrawFilledOval(x, y, z1, siz, 10);
|
||||
|
||||
OOGL(GLScaledLineWidth(lineWidth)); // reset
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,6 +49,7 @@ static JSBool PlayerSetProperty(JSContext *context, JSObject *this, jsid propID,
|
||||
|
||||
static JSBool PlayerCommsMessage(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool PlayerConsoleMessage(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool PlayerEndScenario(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool PlayerIncreaseContractReputation(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool PlayerDecreaseContractReputation(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool PlayerIncreasePassengerReputation(JSContext *context, uintN argc, jsval *vp);
|
||||
@ -142,6 +143,7 @@ static JSFunctionSpec sPlayerMethods[] =
|
||||
{ "decreaseContractReputation", PlayerDecreaseContractReputation, 0 },
|
||||
{ "decreaseParcelReputation", PlayerDecreaseParcelReputation, 0 },
|
||||
{ "decreasePassengerReputation", PlayerDecreasePassengerReputation, 0 },
|
||||
{ "endScenario", PlayerEndScenario, 1 },
|
||||
{ "increaseContractReputation", PlayerIncreaseContractReputation, 0 },
|
||||
{ "increaseParcelReputation", PlayerIncreaseParcelReputation, 0 },
|
||||
{ "increasePassengerReputation", PlayerIncreasePassengerReputation, 0 },
|
||||
@ -402,6 +404,26 @@ static JSBool PlayerConsoleMessage(JSContext *context, uintN argc, jsval *vp)
|
||||
}
|
||||
|
||||
|
||||
// endScenario(scenario : String)
|
||||
static JSBool PlayerEndScenario(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_NATIVE_ENTER(context)
|
||||
|
||||
NSString *scenario = nil;
|
||||
|
||||
if (argc > 0) scenario = OOStringFromJSValue(context, OOJS_ARGV[0]);
|
||||
if (scenario == nil)
|
||||
{
|
||||
OOJSReportBadArguments(context, @"Player", @"endScenario", argc, OOJS_ARGV, nil, @"scenario key");
|
||||
return NO;
|
||||
}
|
||||
|
||||
OOJS_RETURN_BOOL([PLAYER endScenario:scenario]);
|
||||
|
||||
OOJS_NATIVE_EXIT
|
||||
}
|
||||
|
||||
|
||||
// increaseContractReputation()
|
||||
static JSBool PlayerIncreaseContractReputation(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
|
@ -72,7 +72,8 @@ static JSBool PlayerShipBeginHyperspaceCountdown(JSContext *context, uintN argc,
|
||||
static JSBool PlayerShipCancelHyperspaceCountdown(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool PlayerShipSetMultiFunctionDisplay(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool PlayerShipSetMultiFunctionText(JSContext *context, uintN argc, jsval *vp);
|
||||
|
||||
static JSBool PlayerShipHideHUDSelector(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool PlayerShipShowHUDSelector(JSContext *context, uintN argc, jsval *vp);
|
||||
|
||||
static BOOL ValidateContracts(JSContext *context, uintN argc, jsval *vp, BOOL isCargo, OOSystemID *start, OOSystemID *destination, double *eta, double *fee, double *premium, NSString *functionName, unsigned *risk);
|
||||
|
||||
@ -203,6 +204,7 @@ static JSFunctionSpec sPlayerShipMethods[] =
|
||||
{ "cancelHyperspaceCountdown", PlayerShipCancelHyperspaceCountdown, 0 },
|
||||
{ "disengageAutopilot", PlayerShipDisengageAutopilot, 0 },
|
||||
{ "engageAutopilotToStation", PlayerShipEngageAutopilotToStation, 1 },
|
||||
{ "hideHUDSelector", PlayerShipHideHUDSelector, 1 },
|
||||
{ "launch", PlayerShipLaunch, 0 },
|
||||
{ "removeAllCargo", PlayerShipRemoveAllCargo, 0 },
|
||||
{ "removeContract", PlayerShipRemoveContract, 2 },
|
||||
@ -212,6 +214,7 @@ static JSFunctionSpec sPlayerShipMethods[] =
|
||||
{ "setCustomView", PlayerShipSetCustomView, 2 },
|
||||
{ "setMultiFunctionDisplay", PlayerShipSetMultiFunctionDisplay, 1 },
|
||||
{ "setMultiFunctionText", PlayerShipSetMultiFunctionText, 1 },
|
||||
{ "showHUDSelector", PlayerShipShowHUDSelector, 1 },
|
||||
{ "takeInternalDamage", PlayerShipTakeInternalDamage, 0 },
|
||||
{ "useSpecialCargo", PlayerShipUseSpecialCargo, 1 },
|
||||
{ 0 }
|
||||
@ -1191,6 +1194,7 @@ static JSBool PlayerShipSetMultiFunctionText(JSContext *context, uintN argc, jsv
|
||||
NSString *key = nil;
|
||||
NSString *value = nil;
|
||||
PlayerEntity *player = OOPlayerForScripting();
|
||||
JSBool reflow = NO;
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
@ -1205,8 +1209,22 @@ static JSBool PlayerShipSetMultiFunctionText(JSContext *context, uintN argc, jsv
|
||||
{
|
||||
value = OOStringFromJSValue(context, OOJS_ARGV[1]);
|
||||
}
|
||||
if (argc > 2 && EXPECT_NOT(!JS_ValueToBoolean(context, OOJS_ARGV[2], &reflow)))
|
||||
{
|
||||
OOJSReportBadArguments(context, @"setMultiFunctionText", @"reflow", argc, OOJS_ARGV, nil, @"boolean");
|
||||
return NO;
|
||||
}
|
||||
|
||||
[player setMultiFunctionText:value forKey:key];
|
||||
if (!reflow)
|
||||
{
|
||||
[player setMultiFunctionText:value forKey:key];
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
NSString *formatted = [gui reflowTextForMFD:value];
|
||||
[player setMultiFunctionText:formatted forKey:key];
|
||||
}
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
@ -1214,6 +1232,52 @@ static JSBool PlayerShipSetMultiFunctionText(JSContext *context, uintN argc, jsv
|
||||
}
|
||||
|
||||
|
||||
static JSBool PlayerShipHideHUDSelector(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_NATIVE_ENTER(context)
|
||||
|
||||
NSString *key = nil;
|
||||
PlayerEntity *player = OOPlayerForScripting();
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
key = OOStringFromJSValue(context, OOJS_ARGV[0]);
|
||||
}
|
||||
if (key == nil)
|
||||
{
|
||||
OOJSReportBadArguments(context, @"PlayerShip", @"hideHUDSelector", MIN(argc, 1U), OOJS_ARGV, nil, @"string (selector)");
|
||||
return NO;
|
||||
}
|
||||
[[player hud] setHiddenSelector:key hidden:YES];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_NATIVE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool PlayerShipShowHUDSelector(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_NATIVE_ENTER(context)
|
||||
|
||||
NSString *key = nil;
|
||||
PlayerEntity *player = OOPlayerForScripting();
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
key = OOStringFromJSValue(context, OOJS_ARGV[0]);
|
||||
}
|
||||
if (key == nil)
|
||||
{
|
||||
OOJSReportBadArguments(context, @"PlayerShip", @"hideHUDSelector", MIN(argc, 1U), OOJS_ARGV, nil, @"string (selector)");
|
||||
return NO;
|
||||
}
|
||||
[[player hud] setHiddenSelector:key hidden:NO];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_NATIVE_EXIT
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
ENTRY(GUI_SCREEN_MAIN, -1)
|
||||
ENTRY(GUI_SCREEN_INTRO1, -1)
|
||||
ENTRY(GUI_SCREEN_INTRO2, -1)
|
||||
ENTRY(GUI_SCREEN_NEWGAME, -1)
|
||||
ENTRY(GUI_SCREEN_STATUS, -1)
|
||||
ENTRY(GUI_SCREEN_MANIFEST, -1)
|
||||
ENTRY(GUI_SCREEN_EQUIP_SHIP, -1)
|
||||
|
@ -239,6 +239,7 @@ enum
|
||||
NSDictionary *_descriptions; // holds descriptive text for lots of stuff, loaded at initialisation
|
||||
NSDictionary *customSounds; // holds descriptive audio for lots of stuff, loaded at initialisation
|
||||
NSDictionary *characters; // holds descriptons of characters
|
||||
NSArray *_scenarios; // game start scenarios
|
||||
NSDictionary *planetInfo; // holds overrides for individual planets, keyed by "g# p#" where g# is the galaxy number 0..7 and p# the planet number 0..255
|
||||
NSDictionary *missiontext; // holds descriptive text for missions, loaded at initialisation
|
||||
NSArray *equipmentData; // holds data on available equipment, loaded at initialisation
|
||||
@ -477,6 +478,8 @@ enum
|
||||
- (GameController *) gameController;
|
||||
- (NSDictionary *) gameSettings;
|
||||
|
||||
- (void) useGUILightSource:(BOOL)GUILight;
|
||||
|
||||
- (void) drawUniverse;
|
||||
|
||||
- (void) defineFrustum;
|
||||
@ -595,6 +598,7 @@ enum
|
||||
- (NSDictionary *) descriptions;
|
||||
- (NSDictionary *) characters;
|
||||
- (NSDictionary *) missiontext;
|
||||
- (NSArray *) scenarios;
|
||||
|
||||
- (NSString *)descriptionForKey:(NSString *)key; // String, or random item from array
|
||||
- (NSString *)descriptionForArrayKey:(NSString *)key index:(unsigned)index; // Indexed item from array
|
||||
|
@ -209,6 +209,7 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
|
||||
|
||||
- (void) verifyDescriptions;
|
||||
- (void) loadDescriptions;
|
||||
- (void) loadScenarios;
|
||||
|
||||
- (void) verifyEntitySessionIDs;
|
||||
- (float) randomDistanceWithinScanner;
|
||||
@ -225,7 +226,7 @@ static int JSResetFlags = 0;
|
||||
|
||||
// track the position and status of the lights
|
||||
static BOOL object_light_on = NO;
|
||||
static BOOL demo_light_on = YES;
|
||||
static BOOL demo_light_on = NO;
|
||||
static GLfloat sun_off[4] = {0.0, 0.0, 0.0, 1.0};
|
||||
static GLfloat demo_light_position[4] = { DEMO_LIGHT_POSITION, 1.0 };
|
||||
|
||||
@ -260,7 +261,9 @@ static GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEV
|
||||
|
||||
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
strict = [prefs oo_boolForKey:@"strict-gameplay" defaultValue:NO];
|
||||
// prefs value no longer used - per save game but startup needs to
|
||||
// be non-strict
|
||||
strict = NO;
|
||||
|
||||
[self setGameView:inGameView];
|
||||
gSharedUniverse = self;
|
||||
@ -293,6 +296,9 @@ static GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEV
|
||||
[self loadDescriptions];
|
||||
// DESC expansion is now possible!
|
||||
|
||||
// load starting saves
|
||||
[self loadScenarios];
|
||||
|
||||
reducedDetail = [prefs oo_boolForKey:@"reduced-detail-graphics" defaultValue:NO];
|
||||
autoSave = [prefs oo_boolForKey:@"autosave" defaultValue:NO];
|
||||
wireframeGraphics = [prefs oo_boolForKey:@"wireframe-graphics" defaultValue:NO];
|
||||
@ -506,14 +512,21 @@ static GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEV
|
||||
if (strict == value) return YES;
|
||||
|
||||
strict = !!value;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:strict forKey:@"strict-gameplay"];
|
||||
return [self reinitAndShowDemo:!saveGame strictChanged:YES];
|
||||
}
|
||||
|
||||
|
||||
- (void) reinitAndShowDemo:(BOOL) showDemo
|
||||
{
|
||||
[self reinitAndShowDemo:showDemo strictChanged:NO];
|
||||
if (strict && showDemo)
|
||||
{
|
||||
[self setStrict:NO];
|
||||
[self reinitAndShowDemo:showDemo strictChanged:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self reinitAndShowDemo:showDemo strictChanged:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2671,13 +2684,13 @@ static GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEV
|
||||
|
||||
- (void) handleGameOver
|
||||
{
|
||||
if ([[self gameController] playerFileToLoad])
|
||||
if ([[self gameController] playerFileToLoad])
|
||||
{
|
||||
[[self gameController] loadPlayerIfRequired];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self reinitAndShowDemo:NO];
|
||||
[self reinitAndShowDemo:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@ -4352,8 +4365,13 @@ static const OOMatrix starboard_matrix =
|
||||
sPrevHudAlpha = -1.0f;
|
||||
}
|
||||
|
||||
if (v_status != STATUS_DEAD && v_status != STATUS_ESCAPE_SEQUENCE)
|
||||
{
|
||||
switch (v_status) {
|
||||
case STATUS_DEAD:
|
||||
case STATUS_ESCAPE_SEQUENCE:
|
||||
case STATUS_START_GAME:
|
||||
// no HUD rendering in these modes
|
||||
break;
|
||||
default:
|
||||
[theHUD setLineWidth:lineWidth];
|
||||
[theHUD renderHUD];
|
||||
}
|
||||
@ -6058,6 +6076,10 @@ OOINLINE BOOL EntityInRange(HPVector p1, Entity *e2, float range)
|
||||
|
||||
- (void) repopulateSystem
|
||||
{
|
||||
if (EXPECT_NOT([PLAYER status] == STATUS_START_GAME))
|
||||
{
|
||||
return; // no need to be adding ships as this is not a "real" game
|
||||
}
|
||||
JSContext *context = OOJSAcquireContext();
|
||||
[PLAYER doWorldScriptEvent:OOJSIDFromString(system_repopulator) inContext:context withArguments:NULL count:0 timeLimit:kOOJSLongTimeLimit];
|
||||
OOJSRelinquishContext(context);
|
||||
@ -7085,6 +7107,20 @@ static void VerifyDesc(NSString *key, id desc)
|
||||
}
|
||||
|
||||
|
||||
- (NSArray *) scenarios
|
||||
{
|
||||
return _scenarios;
|
||||
}
|
||||
|
||||
|
||||
- (void) loadScenarios
|
||||
{
|
||||
[_scenarios autorelease];
|
||||
_scenarios = [[ResourceManager arrayFromFilesNamed:@"scenarios.plist" inFolder:@"Config" andMerge:YES] retain];
|
||||
[self verifyDescriptions];
|
||||
}
|
||||
|
||||
|
||||
- (NSDictionary *) characters
|
||||
{
|
||||
return characters;
|
||||
@ -9835,7 +9871,6 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void *context)
|
||||
|
||||
if(showDemo)
|
||||
{
|
||||
[player setGuiToIntroFirstGo:NO];
|
||||
[player setStatus:STATUS_START_GAME];
|
||||
}
|
||||
else
|
||||
@ -9844,9 +9879,18 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void *context)
|
||||
}
|
||||
|
||||
[player completeSetUp];
|
||||
[self populateNormalSpace];
|
||||
if(showDemo)
|
||||
{
|
||||
[player setGuiToIntroFirstGo:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
// no need to do these if showing the demo as the only way out
|
||||
// now is to load a game
|
||||
[self populateNormalSpace];
|
||||
|
||||
[player startUpComplete];
|
||||
[player startUpComplete];
|
||||
}
|
||||
|
||||
if(!showDemo)
|
||||
{
|
||||
|
@ -37,6 +37,7 @@ function perform_copy_binary {
|
||||
perform_copy AIs .plist
|
||||
perform_copy AIs .js
|
||||
perform_copy Config .plist
|
||||
perform_copy Scenarios .oolite-save
|
||||
perform_copy Scripts .js
|
||||
perform_copy Shaders .vertex
|
||||
perform_copy Shaders .fragment
|
||||
|
Loading…
x
Reference in New Issue
Block a user