diff --git a/programs/games/StarTrek/trunk/Bin/MsgTable.txt b/programs/games/StarTrek/trunk/Bin/MsgTable.txt deleted file mode 100644 index 195cf447d8..0000000000 Binary files a/programs/games/StarTrek/trunk/Bin/MsgTable.txt and /dev/null differ diff --git a/programs/games/StarTrek/trunk/Bin/ReadMe.txt b/programs/games/StarTrek/trunk/Bin/ReadMe.txt deleted file mode 100644 index e4a3077285..0000000000 --- a/programs/games/StarTrek/trunk/Bin/ReadMe.txt +++ /dev/null @@ -1,257 +0,0 @@ - - * ----------------------------------------------- * - * THIS DOCUMENT IS LOOKING BEST WITH COURIER FONT * - * ----------------------------------------------- * - - - CONTENTS OF THIS FOLDER: - - README.TXT - THIS FILE - - STARTREK32.EXE - GAME EXECUTABLE FILE - - STARTREK.DOC - ORIGINAL GAME INSTRUCTIONS - - MSGTABLE.TXT - GAME MESSAGES (ENCRYPTED) - - DO NOT EDIT MSG TABLE - REMINDER NOT TO OPEN IT IN EDITOR - - - 1. MODIFICATIONS TO ORIGINAL VERSION OF THIS GAME - =================================================== - - - WHEN I STARTED TESTING THE GAME, I NOTICED THAT NO MATTER HOW HARD - I AM TRYING TO BEAT THE 'EMERITUS' LEVEL - THERE IS SIMPLY NOT MUCH - LUCK ON MY SIDE. WELL, I DECIDED TO ADD SOME POWER-UPS TO REMEDY - THIS SITUATION. - - - 1.1 WHEN 'DOCK' COMMAND IS EXECUTED SOMETIMES MORE PHOTON - LAUNCHERS ARE ADDED, SO SHIP CAN FIRE MORE PHOTON TORPEDOES IN ONE - BURST. THIS EVENT HAPPENS ONLY ONCE PER GAME (FOR NOW). - - THE NUMBER OF TORPEDOES PER BURST IS INDICATED ON 'TORPEDOES' LINE - IN SHORT RANGE SCAN REPORT. MAXIMUM NUMBER OF ADDED LAUNCHERS IS - THREE, SO IN ALL SHIP CAN HAVE UP TO SIX TORPEDOES FIRED PER BURST! - - - 1.2 WHEN 'DOCK' COMMAND IS EXECUTED IT IS POSSIBLE SOMETIMES TO - RECEIVE QUANTUM TORPEDOES INSTEAD OF NORMAL ONES. THESE ARE NEW - WARHEADS DESIGNED BY STARFLEET ENGINEER CORPS. THE QUANTUM CHARGES - DO NOT SUFFER THE LOSS OF TARGETING WHEN PASSING THROUGH SHIELDS AS - MUCH AS NORMAL TORPEDOES. AND OF COURSE, THEY PACK QUITE A PUNCH! - - "ENTERPRISE" WILL RECEIVE SIXTEEN QUANTUM CHARGES AND "FAERIE - QUEENE" WILL GET EIGHT. THESE CHARGES MUST BE EXPENDED BEFORE THE - NEXT DOCKING PROCEDURE, OTHERWISE THE TORPEDOES WILL NOT BE - REFILLED BY THE BASE. SO, DO NOT SAVE YOUR QUANTUM TORPEDOERS! GET - INTO SOME QUADRANT AND MAKE A SHOOTING GALLERY OUT OF POOR SUCKERS! - ESPECIALLY IF YOU HAVE SIX PHOTON TUBES. - - - I WAS THINKING TO ADD SOME NEW WAYS TO GATHER ENERGY IN GALAXY, BUT - SO FAR NOTHING COMES TO MIND. IF YOU HAVE ANY IDEAS ON THAT I WILL - BE GLAD TO HEAR IT. - - - 1.3 ANOTHER NICE TO HAVE MODIFICATION IS THAT OUTPUT HAS TRUE - COLOURS. THESE COLOURS ARE NOT STANDARD WIN32 CONSOLE COLOURS, - BUT IN FACT, MY CONSOLE WINDOW IS A REAL WIN32 WINDOW, SIMULATING A - CONSOLE I/O. - - - 1.4 SOME DELAY ADDED WHEN OUTPUTTING LARGE AMOUNTS OF DATA - IT - IMPROVES READABILITY, SINCE I HAVE NOT IMPLEMENTED THE SCROLLING OF - MY CONSOLE WINDOW (FOR NOW). - - - 1.5. NEW 'LOG' COMMAND ADDED INTO THE GAME. IT ALLOWS SAVING ALL - GAME I/O INTO THE FILE CALLED 'STARTREK.LOG'. THIS FILE IS RE- - CREATED EACH GAME, SO IF YOU NEED TO ANALYSE ANY PREVIOUS GAMES YOU - HAVE TO RENAME THAT FILE AFTER THE GAME. - - - 1.6 SINCE I HAVE TRUE COLOURS IN THE GAME I DECIDED TO IMPROVE - THE GALAXY CHART. ALL QUADRANTS WHERE 'SRSCAN' COMMAND WAS GIVEN - WILL BE HIGHLIGHTED WITH DIFFERENT COLOUR. IT MAY BE USEFUL IN - LOCATING A PLANET. ALSO, THE SHIP'S QUADRANT IS HIGHLIGHTED TOO. - - - - 2. SOME STRATEGY HINTS - ====================== - - - "STAR TREK" IS A GAME OF STRATEGY. I GOT THAT WHILE PLAYING - IT DURING MY TESTING PHASE - I WAS PLAYING FOR HOURS EVERY DAY! - - I GOT A LOT OF BUGS FIXED, AND AT THE SAME TIME I GOT SOME INSIGHTS - INTO THE GAME. MOST OF THESE CAME WITH A KNOWLEDGE OF READING THE - SOURCE CODE FROM PDP-11. HOWEVER, I CAN ADD SOME OF MY OWN. AND, - OF COURSE, SOME LUCK IS MUCH NEEDED, ESPECIALLY ON THE "EMERITUS"! - - SO, LET'S BEGIN!.. - - - 2.1 IMAGINE THAT YOU HEAR ON SUBSPACE, THAT A BASE IS UNDER - ATTACK AND YOU REALISE THAT TO GET THERE AT WARP 5 OR EVEN AT WARP - 6 IS NOT POSSIBLE. YOU HAVE THE ENERGY, BUT THE MOVE WITH WARPS - OVER 6 WILL DAMAGE THE ENGINES AND YOU'LL GET STRANDED OR YOU'LL - HAVE TO DRAG AT WARP 4. IN SUCH A CASE I USE WARP 8, BUT I MAKE - SHORT TRIPS - EACH TRIP IS NO LONGER THAN 5 SECTORS. THERE IS A - PROBABILITY OF DAMAGING THE ENGINES, BUT THAT PROBABILITY IS MUCH - LOWER FOR SHORT JUMPS. ALSO, GO WITH SHIELDS DOWN TO SAVE ENERGY. - IF YOU GET TRACTORED - YOU'LL HAVE A CHANCE TO RAISE SHIELDS FOR - BATTLE. IN FACT, ALWAYS LOWER SHIELDS, WHEN BATTLE IS OVER. - - - 2.2 IF YOU REALISE THAT BASE WILL BE DESTROYED AND YOU STILL IN - A NEIGHBOURING QUADRANT AND NOT ENOUGH TIME TO GET TO BASE - 'HELP' - COMMAND CAN BE USED TO JUMP STRAIGHT INTO DOCK. HOWEVER, THIS MAY - END BADLY, BECAUSE 'HELP' COMMAND IS PRONE TO RE-MATERIALIZATION - FAILURE AND YOU'LL LOSE THE GAME. ON THE OTHER HAND, JAMES T. KIRK - LOVES TO RISK! AND YOU ARE BECOME HIM, REMEMBER?.. - - - 2.3 WHEN YOU ENTER THE QUADRANT WITH ENEMIES - THEY ATTACK - RIGHT AWAY. YOU CAN ATTACK WHEN THEIR ATTACK IS OVER, HOWEVER, YOU - HAVE ONE CHANCE TO MOVE BEFORE ATTACKING, SO USE IT WISELY. FOR - EXAMPLE, YOU CAN FLY INTO THE MIDDLE OF ENEMIES, SO YOUR WEAPONS - WOULD BE MORE EFFECTIVE ON THE SHORT DISTANCE. IT WORKS FOR BOTH - PHASERS (LESS ENERGY SPENT ON A BURST) AND TORPEDOES (PRECISION AND - HIT ENERGY WILL BE INTENSIFIED). - - - 2.4 SIMPLE FACT: WHEN STAR IS HIT BY A TORPEDO - IT BECOMES A - NOVA. NOVA DESTROYS (OR HEAVILY DAMAGES) ALL OBJECTS IN 8 ADJACENT - SECTORS. YOU CAN USE IT IN BATTLE. IF YOU HAVE ONLY 2 TORPEDOES - LEFT, BUT THERE ARE 5 KLINGONS IN THE QUADRANT, HOWEVER, THESE - ENEMIES ARE ADJACENT TO TWO STARS. THEY ARE UNLUCKY ONES! FLY INTO - A POSITION, WHERE YOUR TORPEDOES WILL SURELY HIT THOSE STARS AND - FIRE! ENEMIES WILL BE DESTROYED (MOST LIKELY). THERE IS A SMALL - PROBABILITY THAT NOVA CAN BECOME A SUPERNOVA - THAT WOULD BE BAD. I - ONCE EXPERIENCED THAT IN MY TESTING. - - - 2.5 BEWARE OF ROMULANS! - THEY HAVE MORE POWER THAN MOST - KLINGONS. ALSO, THEY USUALLY FIRE TORPEDOES - NOT A GOOD PROSPECT. - TRY TO KILL OFF ROMULANS (AND COMMANDERS) FIRST WHEN IN BATTLE. - - - 2.6 ALWAYS TRY TO ENTER THE CORNER SECTOR OF A QUADRANT WITH - ENEMIES OR CLOSE TO CORNER SECTOR. IT MINIMIZES THE ENEMY POWER - AND THEY CANNOT INFLICT AS MUCH DAMAGE AS IF YOU ENTER THE SECTOR - 5-5. ALSO, IF YOU AT CORNER SECTOR - IT KEEPS THE THOLIAN FROM - MOVING AND WEAVING ITS WEB. - - - 2.7 SOMETIMES YOU NEED A QUICK SCAN OF THE GALAXY. IT CAN BE - DONE WITHOUT TOO MUCH ENERGY SPENT ON FLIGHT. SIMPLY FLY INTO ANY - CORNER OF THE QUADRANT AND THEN MOVE JUST ONE SECTOR TO GET TO THE - ADJACENT QUADRANT AND GIVE BOTH 'SRSCAN' AND 'LRSCAN' COMMANDS. BY - DOING IT ONLY THREE TIMES (3 SECTORS TRAVELLED) YOU CAN SCAN FOUR - QUADRANTS ON SHORT RANGE AND TWELVE ON LONG RANGE. - - - 2.8 AFTER THE BATTLE ALWAYS KEEP YOUR SHIELDS ON FULL OR CLOSE - TO FULL. YOU CAN BE TRACTORED BY A COMMANDER AT ANY TIME AND YOU - WILL NOT BE ABLE TO TRANSFER THE ENERGY - ONLY TO RAISE SHIELDS. - - - 2.9 HOW TO FIGHT A LOT OF KLINGONS? IMAGINE THAT YOU ENTER A - QUADRANT AND IT HAS SEVEN KLINGONS OR MORE. EXPERIENCE SHOWS THAT - TO KILL ALL ENEMIES WITH PHASER IS NOT FEASIBLE WITHOUT OVERHEATING - PHASERS. IN THIS CASE THE MANUAL PHASER FIRE WILL HELP. USING - THIS METHOD YOU CAN SEE HOW MUCH ENERGY IS NEEDED TO KILL EACH - ENEMY. SIMPLY ENTER FOR EACH ENEMY SOME AMOUNT OF FIRE KEEPING IN - MIND THAT PHASERS BEGIN OVERHEATING AT MORE THAN 1500 UNITS IN - TOTAL. THE OVERHEATING IS HIGHLY RANDOM - I ONCE FIRED 2500 AT - SUPER-COMMANDER IN A FAR DISTANCE (COULD NOT MOVE CLOSER) AND MY - PHASERS WERE NOT OVERHEATED! SO, WHEN YOU ENTER THE MANUAL AMOUNTS - FOR EACH ENEMY AND FIRE - IT WILL WEAKEN THE ENEMIES, SO THEY WILL - NOT BE ABLE TO FIRE AS MUCH IN THEIR NEXT WAVE OF ATTACK. USUALLY, - YOUR SECOND PHASER SHOT WILL KILL ALL SEVEN KLINGONS. YOUR RESULTS - MAY VARY, HOWEVER! THAT'S WHY THIS GAME IS SO ADDICTIVE! ANYTHING - CAN HAPPEN DURING BATTLE! - - - 2.10 IF THE ENEMY IS CLOSE TO BLACK HOLE (PREFERABLY 1 SECTOR - DISTANCE) - IT IS POSSIBLE TO DISPLACE THAT ENEMY INTO A BLACK HOLE - WITH A TORPEDO FIRED ON THE SAME VECTOR. I ONCE WAS IN A SITUATION - DEPICTED BELOW AND WAS ABLE TO KILL SUPER-COMMANDER WITH JUST ONE - NORMAL TORPEDO! - - - . E . . S @ . . . - - - - 3. NEED FOR IMPROVEMENT - ======================= - - - 3.1 I WOULD BE HAPPY TO HEAR SOME NEW IDEAS ABOUT THE GAME. YOU - CAN E-MAIL ME (asmguru62@hotmail.com) TO GIVE AN INSIGHT OR ADVICE. - - - 3.2 I WAS NOT HAPPY TO DISCOVER (READING THE SOURCE CODE) THAT - COMMANDER'S TRACTOR BEAM WORKS ON A GREAT DISTANCES. BASICALLY, - THE SHIP CAN BE PULLED FROM ONE CORNER OF THE GALAXY TO THE OTHER!! - THAT DOES NOT SEEM LOGICAL TO ME. I WANTED TO ADJUST THE GAME, SO - THE DISTANCE WILL BE A FACTOR, BUT I LEFT THAT AS IS - TO PRESERVE - THE ORIGINAL IDEA FOR NOW. - - - 3.3 BUGS!! OF COURSE, I AM GLAD TO HEAR SOME BUG REPORTS. LET'S - MAKE IT A NICE GAMING EXPERIENCE - 70s STYLE!.. DURING TESTING I - HAVE SEEN SOME STRANGE ISSUES, HOWEVER, I WAS NOT ABLE TO REPRODUCE - THESE IN A CONSISTENT MANNER. - - - 3.4 TAKE A LOOK AT POSITION BELOW: - - 1 2 3 4 5 - 1 E * . . . - 2 . . . . . - - TO MOVE TO SECTOR 2-2 THE SHIP NEEDS TO TRAVEL AT 45 DEGREE ANGLE - DOWN AND TO THE RIGHT AND IT SEEMS LIKE NOTHING IN THE WAY. BEWARE - OF SUCH CONDITION - IN MOST CASES THE SHIP WILL BE BLOCKED BY STAR - AT SECTOR 1-2. I ANALYSED THE CODE AND IT SEEMS, WHEN SHIP MOVES, - IT WILL APPROXIMATE ITS LOCATION TO THE NEAREST SECTOR WITH HALF - SECTOR PRECISION. FOR EXAMPLE: SECTOR 1-1.5 WILL BE ROUNDED TO - SECTOR 1-2 AND THIS WILL CAUSE COLLISION WITH OBJECT AT THAT SECTOR - IF ANY. THAT SEEMS ILLOGICAL, AS SPOCK WOULD SAY. HALF OF THE - SECTOR CANNOT BE COMPARED WITH THE SHIP'S LENGTH TO BE ABLE TO - COLLIDE WITH ANYTHING. I ALSO, LEFT THAT FACT INTACT FROM ORIGINAL - CODE. SIMPLY DO NOT PLOT YOUR COURSE TOO CLOSE TO OTHER OBJECTS. - - THE SAME CONDITION EXISTS FOR TORPEDOES TOO, BECAUSE THE SAME CODE - IS USED TO MOVE A TORPEDO. - - - - 4. FASM SOURCE CODE - =================== - - - I HAVE INSERTED THE ORIGINAL COPYRIGHT NOTE FROM PDP-11 FORTRAN - SOURCE. YOU CAN MODIFY THE CODE, BIT ONLY FOR FUN - NOT FOR PROFIT. - - THE SOURCE CODE WAS NOT WRITTEN TO BE FAST. IT WAS WRITTEN TO MIMIC - EXACTLY THE LOGIC OF FORTRAN SOURCE. PLEASE DO NOT ASK ME TO MAKE - OPTIMIZATIONS IN THE CODE - IT WILL NEVER BE DONE. I USED MY OWN - IDE FOR FASM TO CREATE THAT CODE. YOU CAN LOOK AT THE DATES IN - FILES AND FIGURE OUT HOW MUCH TIME IT TOOK TO WRITE THAT CODE. THIS - WAS MY THIRD (!) ATTEMPT TO RE-CREATE ONE OF MY FAVOURITE GAMES. - - IN THE FIRST ATTEMPT I TRIED TO RE-DESIGN THE ORIGINAL SOURCE TO BE - MORE STRUCTURED. NO NEED TO SAY - IT FAILED MISERABLY! THE LOGIC - IN SOME CASES WAS LOST. - - IN THE SECOND ATTEMPT I WROTE THE FASM CODE TO MIMIC FORTRAN CODE - EXACTLY. HOWEVER, I FAILED TO SEE THAT THERE SHOULD BE TWO THREADS. - ONE THREAD SHOULD RUN THE CONSOLE WINDOW AND THE OTHER ONE SHOULD - DEAL WITH GAME LOGIC: QUESTIONS AND ANSWERS FROM CONSOLE. - - WELL, THIRD TIME'S A CHARM! - - - AsmGuru62 - August 23, 2009 diff --git a/programs/games/StarTrek/trunk/Bin/do not edit msg table b/programs/games/StarTrek/trunk/Bin/do not edit msg table deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/programs/games/StarTrek/trunk/Bin/startrek.doc b/programs/games/StarTrek/trunk/Bin/startrek.doc deleted file mode 100644 index e412c6ffdb..0000000000 --- a/programs/games/StarTrek/trunk/Bin/startrek.doc +++ /dev/null @@ -1,1436 +0,0 @@ - - - - - - - - - - - - SSSSSSS TTTTTTTT A RRRRRRR - SSSSSSSS TTTTTTTT AAA RRRRRRRR - SS TT AAA RR RR - SSSSSSS TT AA AA RR RR - SSSSSSS TT AA AA RRRRRRRR - SS TT AAAAAAA RRRRRRR - SS TT AAAAAAA RR RR - SSSSSSSS TT AA AA RR RR - SSSSSSS TT AA AA RR RR - - - - TTTTTTTT RRRRRRR EEEEEEEEE KK KK - TTTTTTTT RRRRRRRR EEEEEEEEE KK KK - TT RR RR EE KK KK - TT RR RR EEEEEE KKKKKK - TT RRRRRRRR EEEEEE KKKKK - TT RRRRRRR EE KK KK - TT RR RR EE KK KK - TT RR RR EEEEEEEEE KK KK - TT RR RR EEEEEEEEE KK KK - - - - PRODUCED FOR YOUR ENJOYMENT - - BY - - DAVID MATUSZEK - AND - PAUL REYNOLDS - - WITH MODIFICATIONS BY - DON SMITH - AND - M. KELLOGG - - - - - PERMISSION IS HEREBY GRANTED FOR THE COPYING, DISTRIBUTION, - MODIFICATION AND USE OF THIS PROGRAM AND ASSOCIATED DOCUMENTATION - FOR RECREATIONAL PURPOSES, PROVIDED THAT ALL REFERENCES TO THE - AUTHORS ARE RETAINED. HOWEVER, PERMISSION IS NOT AND WILL NOT BE - GRANTED FOR THE SALE OR PROMOTIONAL USE OF THIS PROGRAM OR PROGRAM - DOCUMENTATION, OR FOR USE IN ANY SITUATION IN WHICH PROFIT MAY BE - CONSIDERED AN OBJECTIVE, SINCE IT IS THE DESIRE OF THE AUTHORS TO - RESPECT THE COPYRIGHTS OF THE ORIGINATORS OF STAR TREK. - - - ----------TABLE OF CONTENTS---------- - - - - SECTION PAGE - - - INTRODUCTION TO THE GAME . . . . . . . . . . . . . . 1 - - HOW TO ISSUE COMMANDS. . . . . . . . . . . . . . . . 4 - - DESCRIPTIONS OF COMMANDS . . . . . . . . . . . . . . 5 - - SHORT-RANGE SCAN. . . . . . . . . . . . . . . . 5 - STATUS REPORT . . . . . . . . . . . . . . . . . 6 - LONG-RANGE SCAN . . . . . . . . . . . . . . . . 7 - STAR CHART. . . . . . . . . . . . . . . . . . . 8 - DAMAGE REPORT . . . . . . . . . . . . . . . . . 8 - MOVE UNDER WARP DRIVE . . . . . . . . . . . . . 8 - WARP FACTOR . . . . . . . . . . . . . . . . . . 10 - IMPULSE ENGINES . . . . . . . . . . . . . . . . 10 - DEFLECTOR SHIELDS . . . . . . . . . . . . . . . 11 - PHASERS . . . . . . . . . . . . . . . . . . . . 12 - PHOTON TORPEDOES. . . . . . . . . . . . . . . . 13 - DOCK AT STARBASE. . . . . . . . . . . . . . . . 14 - REST. . . . . . . . . . . . . . . . . . . . . . 14 - CALL STARBASE FOR HELP. . . . . . . . . . . . . 14 - ABANDON SHIP. . . . . . . . . . . . . . . . . . 15 - SELF-DESTRUCT . . . . . . . . . . . . . . . . . 15 - TERMINATE THE CURRENT GAME. . . . . . . . . . . 15 - SENSOR-SCAN . . . . . . . . . . . . . . . . . . 16 - ENTER STANDARD ORBIT. . . . . . . . . . . . . . 16 - TRANSPORTER-TRAVEL. . . . . . . . . . . . . . . 16 - SHUTTLE CRAFT . . . . . . . . . . . . . . . . . 17 - MINE DILITHIUM CRYSTALS . . . . . . . . . . . . 17 - LOAD DILITHIUM CRYSTALS . . . . . . . . . . . . 17 - PLANET REPORT . . . . . . . . . . . . . . . . . 18 - FREEZE. . . . . . . . . . . . . . . . . . . . . 18 - REQUEST . . . . . . . . . . . . . . . . . . . . 19 - EXPERIMENTAL DEATH RAY. . . . . . . . . . . . . 19 - EMERGENCY EXIT. . . . . . . . . . . . . . . . . 20 - GAME REPORT . . . . . . . . . . . . . . . . . . 20 - - MISCELLANEOUS NOTES. . . . . . . . . . . . . . . . . 21 - - SCORING. . . . . . . . . . . . . . . . . . . . . . . 22 - - MODIFICATIONS. . . . . . . . . . . . . . . . . . . . 23 - - HANDY REFERENCE PAGE . . . . . . . . . . . . . . . . 24 - - ACKNOWLEDGMENTS. . . . . . . . . . . . . . . . . . . 25 - - REFERENCES . . . . . . . . . . . . . . . . . . . . . 25 - - 1 - ----------INTRODUCTION TO THE GAME---------- - - - THE ORGANIAN PEACE TREATY HAS COLLAPSED, AND THE FEDERATION - IS AT WAR WITH THE KLINGON EMPIRE. JOINING THE KLINGONS AGAINST - THE FEDERATION ARE THE MEMBERS OF THE "ROMULAN STAR EMPIRE". AS - COMMANDER OF THE STARSHIP U. S. S. ENTERPRISE, YOUR JOB IS TO WIPE - OUT THE KLINGON INVASION FLEET AND MAKE THE GALAXY SAFE FOR - DEMOCRACY. - - YOUR BATTLEGROUND IS THE ENTIRE GALAXY, WHICH FOR CONVENIENCE - IS DIVIDED UP INTO EIGHT ROWS OF EIGHT QUADRANTS EACH, LIKE A - CHECKERBOARD. ROWS ARE NUMBERED FROM TOP TO BOTTOM, AND COLUMNS - ARE NUMBERED LEFT TO RIGHT, SO QUADRANT 1 - 8 WOULD BE IN THE - UPPER RIGHT HAND CORNER OF THE GALAXY. - - DURING BATTLE YOU WILL BE CONCERNED ONLY WITH THOSE ENEMIES - THAT OCCUPY THE SAME QUADRANT AS YOURSELF. QUADRANTS ARE DIVIDED - UP INTO SECTORS: TEN ROWS OF TEN SECTORS EACH. SECTORS ARE - NUMBERED IN THE SAME WAY AS QUADRANTS, SO THE SECTOR IN THE UPPER - RIGHT CORNER IS SECTOR 1 - 10. YOU HAVE A SHORT-RANGE SCANNER - WHICH ALLOWS YOU TO LOOK AT THE ENTIRE QUADRANT IN A SINGLE - DISPLAY. - - ENEMIES RECHARGE DURING YOUR ABSENCE. IF YOU LEAVE A QUADRANT - CONTAINING A WEAKENED ENEMY, WHEN YOU RETURN TO THAT QUADRANT HE - WILL BE STRONG AGAIN. ALSO, EACH TIME YOU ENTER A QUADRANT, THE - POSITIONS OF EVERYTHING IN THE QUADRANT (EXCEPT YOUR SHIP) ARE - RANDOMIZED, TO SAVE YOU THE TROUBLE OF TRYING TO REMEMBER WHERE - EVERYTHING IN THE QUADRANT IS. NOTICE THAT THIS REFERS ONLY TO - THE POSITIONS OF THINGS IN THE QUADRANT--THE NUMBERS OF EACH KIND - OF THING ARE NOT CHANGED. IF YOU KILL SOMETHING, IT STAYS DEAD. - - THE ROMULANS ARE NOT AS SERIOUS A THREAT TO THE FEDERATION - AS THE KLINGONS. FOR ONE THING, THERE ARE NOT AS MANY OF THEM. - FOR ANOTHER, THE ROMULANS ARE NOT AS TREACHEROUS. HOWEVER, ROMULANS - ARE NOT TO BE TRIFLED WITH, ESPECIALLY WHEN YOU ARE IN VIOLATION - OF THE "ROMULAN NEUTRAL ZONE". - - THERE ARE TWO KINDS OF KLINGONS: ORDINARY KLINGONS, WHICH - ARE BAD ENOUGH, AND KLINGON COMMANDERS, WHICH ARE EVEN WORSE. - COMMANDERS ARE ABOUT THREE TIMES STRONGER THAN ORDINARY KLINGONS. - COMMANDERS ARE MORE RESISTANT TO YOUR WEAPONS. COMMANDERS CAN - MOVE ABOUT DURING BATTLE, WHILE ORDINARY KLINGONS STAY PUT. AND - FINALLY, COMMANDERS HAVE A THING CALLED A "LONG-RANGE TRACTOR - BEAM" WHICH THEY CAN USE, AT RANDOM INTERVALS, TO YANK YOU AWAY - FROM WHAT YOU ARE DOING AND INTO THEIR QUADRANT, TO DO BATTLE WITH - THEM. THERE IS ALSO A SPECIAL COMMANDER, CALLED THE "SUPER-COMMANDER". - THIS CHARACTER IS SO BAD, HE IS RESERVED FOR THE GOOD, EXPERT AND - EMERITUS GAMES. FORTUNATELY, THERE IS JUST ONE "SUPER-COMMANDER" - IN A GAME. IN ADDITION TO THE UNDESIRABLE TRAITS OF COMMANDERS, HE - CAN MOVE FROM QUADRANT TO QUADRANT AT WILL, SEEKING OUT AND DESTROYING - YOUR STARBASES, AND ANY HELPFUL PLANETS HE RUNS ACROSS. HE ALSO HAS - A SPY PLANTED ABOARD YOUR SHIP, GIVING HIM VALUABLE INFORMATION - ABOUT YOUR CONDITION. USING THIS INFORMATION, HE CAN DO DASTARDLY - THINGS LIKE TRACTOR BEAM YOUR SHIP WHEN YOU ARE IN BAD SHAPE. AND - ONCE YOU'VE BEEN TRACTOR BEAMED BY THE "SUPER-COMMANDER" - - - - - 2 - BUT THE ADVANTAGES ARE NOT ALL ON THE SIDE OF THE ENEMY. - YOUR SHIP IS MORE POWERFUL, AND HAS BETTER WEAPONS. BESIDES, - IN THIS GALAXY THERE ARE FROM TWO TO FIVE STARBASES, AT WHICH - YOU CAN STOP TO REFUEL AND LICK YOUR WOUNDS, SAFE FROM ATTACK - OR TRACTOR BEAMS. BUT YOU HAD BEST NOT DALLY THERE TOO LONG, - SINCE TIME IS NOT ON YOUR SIDE. THE KLINGONS ARE NOT JUST AFTER - YOU; THEY ARE ATTACKING THE ENTIRE FEDERATION. THERE IS ALWAYS - A FINITE "TIME LEFT", WHICH IS HOW MUCH LONGER THE FEDERATION CAN - HOLD OUT IF YOU JUST SIT ON YOUR FAT BEHIND AND DO NOTHING. AS - YOU WIPE OUT KLINGONS, YOU REDUCE THE RATE AT WHICH THE INVASION - FLEET WEAKENS THE FEDERATION, AND SO THE "TIME LEFT" UNTIL - THE FEDERATION COLLAPSES MAY ACTUALLY INCREASE. SINCE KLINGONS - ARE THE MAIN THREAT TO THE FEDERATION, THE ROMULANS DO NOT FIGURE - INTO THE "TIME LEFT". IN FACT, YOU NEED NOT KILL ALL THE ROMULANS - TO WIN. IF YOU CAN GET ALL THE KLINGONS, THE FEDERATION WILL - ABIDE FOREVER, AND YOU HAVE WON THE GAME. - - SPACE IS VAST, AND IT TAKES PRECIOUS TIME TO MOVE FROM ONE - PLACE TO ANOTHER. IN COMPARISON, OTHER THINGS HAPPEN SO QUICKLY - THAT WE ASSUME THEY TAKE NO TIME AT ALL. TWO WAYS THAT TIME - CAN PASS ARE WHEN YOU MOVE, OR WHEN YOU ISSUE A COMMAND TO SIT - STILL AND REST FOR A PERIOD OF TIME. YOU WILL SOMETIMES WANT - TO DO THE LATTER, SINCE THE VARIOUS DEVICES ABOARD YOUR STARSHIP - MAY BE DAMAGED AND REQUIRE TIME TO REPAIR. OF COURSE, REPAIRS - CAN BE MADE MORE QUICKLY AT A STARBASE THAN THEY CAN IN FLIGHT. - - IN ADDITION TO KLINGONS, ROMULANS AND STARBASES, THE GALAXY - CONTAINS (SURPRISE) STARS. MOSTLY, STARS ARE A NUISANCE AND - JUST GET IN YOUR WAY. YOU CAN TRIGGER A STAR INTO GOING NOVA - BY SHOOTING ONE OF YOUR PHOTON TORPEDOES AT IT. WHEN A STAR - NOVAS, IT DOES A LOT OF DAMAGE TO ANYTHING IMMEDIATELY ADJACENT - TO IT. IF ANOTHER STAR IS ADJACENT TO A NOVA, IT TOO WILL GO - NOVA. STARS MAY ALSO OCCASIONALLY GO SUPERNOVA; A SUPERNOVA - IN A QUADRANT DESTROYS EVERYTHING IN THE QUADRANT AND MAKES - THE QUADRANT PERMANENTLY UNINHABITABLE. YOU MAY "JUMP OVER" A - QUADRANT CONTAINING A SUPERNOVA WHEN YOU MOVE, BUT YOU SHOULD - NOT STOP THERE. - - SUPERNOVAS MAY HAPPEN SPONTANEOUSLY, WITHOUT PROVOCATION. IF - A SUPERNOVA OCCURS IN THE SAME QUADRANT YOU ARE IN, YOUR STARSHIP - HAS AN "EMERGENCY AUTOMATIC OVERRIDE" WHICH PICKS SOME RANDOM - DIRECTION AND SOME RANDOM WARP FACTOR, AND TRIES TO THROW YOU - CLEAR OF THE SUPERNOVA. IF THE SUPERNOVA OCCURS IN SOME OTHER - QUADRANT, YOU JUST GET A WARNING MESSAGE FROM STARFLEET ABOUT IT - (PROVIDED, OF COURSE, THAT YOUR SUBSPACE RADIO IS WORKING). - - ALSO A FEW PLANETS ARE SCATTERED THROUGH THE GALAXY. THESE - CAN SOMETIMES BE A GREAT HELP SINCE SOME OF THEM WILL HAVE - "DILITHIUM CRYSTALS", WHICH ARE CAPABLE OF REPLENISHING THE - SHIP'S ENERGY SUPPLY. YOU CAN EITHER BEAM DOWN TO THE PLANET - SURFACE USING THE TRANSPORTER, OR TAKE THE SHUTTLE CRAFT "GALILEO". - - 3 - STAR TREK IS A RICH GAME, FULL OF DETAIL. THESE INSTRUCTIONS - ARE WRITTEN AT A MODERATE LEVEL--NO ATTEMPT HAS BEEN MADE FULLY - TO DESCRIBE EVERYTHING ABOUT THE GAME, BUT THERE IS QUITE A BIT - MORE HERE THAN YOU NEED TO GET STARTED. IF YOU ARE NEW TO THE - GAME, JUST GET A ROUGH IDEA OF THE KINDS OF COMMANDS AVAILABLE, - AND START PLAYING. AFTER A GAME OR TWO YOU WILL HAVE LEARNED - EVERYTHING IMPORTANT, AND THE DETAILED COMMAND DESCRIPTIONS WHICH - FOLLOW WILL BE A LOT MORE MEANINGFUL TO YOU. - - YOU HAVE WEAPONS: PHASERS AND PHOTON TORPEDOES. YOU HAVE - A DEFENSE: DEFLECTOR SHIELDS. YOU CAN LOOK AT THINGS: LONG- - RANGE SCANNERS, SHORT-RANGE SCANNERS, AND A STAR CHART. YOU CAN - MOVE ABOUT, UNDER WARP DRIVE OR IMPULSE POWER. YOU CAN ALSO - DOCK AT A STARBASE, REST WHILE REPAIRS ARE BEING MADE, ABANDON - SHIP, SELF DESTRUCT, OR GIVE UP AND START A NEW GAME. - - THE KLINGONS ARE WAITING. - - 4 - - ----------HOW TO ISSUE COMMANDS---------- - - - WHEN THE GAME IS WAITING FOR YOU TO ENTER A COMMAND, IT WILL - PRINT OUT - COMMAND: - YOU MAY THEN TYPE IN YOUR COMMAND. ALL YOU HAVE TO REMEMBER FOR - EACH COMMAND IS THE MNEMONIC. FOR EXAMPLE, IF YOU WANT TO MOVE - STRAIGHT UP FOR ONE QUADRANT, YOU CAN TYPE IN THE MNEMONIC - MOVE - AND THE COMPUTER WILL PROMPT YOU WITH - MANUAL OR AUTOMATIC? - SAY YOU TYPE IN "MANUAL". THE COMPUTER THEN RESPONDS - X AND Y DISPLACEMENTS: - NOW YOU TYPE IN 0 1 WHICH SPECIFIES AN X MOVEMENT OF ZERO AND - A Y MOVEMENT OF 1. - - WHEN YOU HAVE LEARNED THE COMMANDS, YOU CAN AVOID BEING - PROMPTED BY SIMPLY TYPING IN THE INFORMATION WITHOUT WAITING - TO BE ASKED FOR IT. FOR EXAMPLE, IN THE ABOVE EXAMPLE, YOU - COULD SIMPLY TYPE IN - MOVE MANUAL 0 1 - AND IT WILL BE DONE. OR YOU COULD TYPE IN - MOVE MANUAL - AND WHEN THE COMPUTER RESPONDS WITH - X AND Y DISPLACEMENTS: - YOU CAN TYPE IN - 0 1 - AND IT WILL UNDERSTAND. - - YOU CAN ABBREVIATE MOST MNEMONICS. FOR "MOVE", YOU CAN USE - ANY OF - MOVE MOV MO M - SUCCESSFULLY. FOR YOUR SAFETY, CERTAIN CRITICAL COMMANDS (SUCH - AS TO ABANDON SHIP) MUST BE WRITTEN OUT IN FULL. ALSO, IN A - FEW CASES TWO OR MORE COMMANDS BEGIN WITH THE SAME LETTER, AND - IN THIS CASE THAT LETTER REFERS TO A PARTICULAR ONE OF THE - COMMANDS; TO GET THE OTHER, YOUR ABBREVIATION MUST BE TWO OR - MORE LETTERS LONG. THIS SOUNDS COMPLICATED, BUT YOU WILL LEARN - THE ABBREVIATIONS QUICKLY ENOUGH. - - WHAT THIS ALL BOILS DOWN TO IS: - (1) YOU CAN ABBREVIATE PRACTICALLY ANYTHING, - (2) IF YOU FORGET, THE COMPUTER WILL PROMPT YOU, - (3) IF YOU REMEMBER, YOU CAN TYPE IT ALL ON ONE LINE. - - IF YOU ARE PART WAY THROUGH ENTERING A COMMAND AND YOU CHANGE - YOUR MIND, YOU CAN CANCEL THE COMMAND BY TYPING A -1 AS ONE OF THE - PARAMETERS. - - IF ANYTHING IS NOT CLEAR TO YOU, EXPERIMENT. THE WORST YOU CAN - DO IS LOSE A GAME OR TWO. - - 5 - ----------DESCRIPTIONS OF COMMANDS---------- - - - - ******************** - * SHORT-RANGE SCAN * - ******************** - - MNEMONIC: SRSCAN - SHORTEST ABBREVIATION: S - FULL COMMANDS: SRSCAN - SRSCAN NO - - THE SHORT-RANGE SCAN GIVES YOU A CONSIDERABLE AMOUNT OF - INFORMATION ABOUT THE QUADRANT YOUR STARSHIP IS IN. A SHORT- - RANGE SCAN IS BEST DESCRIBED BY AN EXAMPLE. - - 1 2 3 4 5 6 7 8 9 10 - 1 * . . . . R . . . . STARDATE 2516.3 - 2 . . . E . . . . . . CONDITION RED - 3 . . . . . * . B . . POSITION 5 - 1, 2 - 4 - 4 . . . S . . . . . . LIFE SUPPORT DAMAGED, RESERVES=2.3 - 5 . . . . . . . K . . WARP FACTOR 5.0 - 6 . K . @ . . . . * . ENERGY 2176.25 - 7 . . . . . P . . . . TORPEDOES 3 - 8 . . . . * . . . . . SHIELDS UP, 42 PERCENT 1050 UNITS - 9 . * . . * . . . C . KLINGONS LEFT 12 - 10 . . . . . . . . . . TIME LEFT 3.72 - - THE LEFT PART IS A PICTURE OF THE QUADRANT. THE E AT SECTOR - 2 - 4 REPRESENTS THE ENTERPRISE; THE B AT SECTOR 3 - 8 IS A STARBASE. - THERE ARE ORDINARY KLINGONS (K) AT SECTORS 5 - 8 AND 6 - 2, AND A - KLINGON COMMANDER (C) AT 9 - 9. THE (GULP) "SUPER-COMMANDER" (S) - OCCUPIES SECTOR 4 - 4, AND A ROMULAN (R) IS AT 1 - 6. A PLANET (P) - IS AT SECTOR 7 - 6. THERE ARE ALSO A LARGE NUMBER OF STARS (*). - THE PERIODS (.) ARE JUST EMPTY SPACE--THEY ARE PRINTED TO HELP - YOU GET YOUR BEARINGS. SECTOR 6 - 4 CONTAINS A BLACK HOLE (@). - - THE INFORMATION ON THE RIGHT IS ASSORTED STATUS INFORMATION. - THE STATUS INFORMATION WILL BE ABSENT IF YOU TYPE AFTER - SRSCAN. OTHERWISE, STATUS INFORMATION WILL BE PRESENTED. - - SHORT-RANGE SCANS ARE FREE. THAT IS, THEY USE UP NO ENERGY - AND NO TIME. IF YOU ARE IN BATTLE, DOING A SHORT-RANGE SCAN DOES - NOT GIVE THE ENEMIES ANOTHER CHANCE TO HIT YOU. YOU CAN SAFELY - DO A SHORT-RANGE SCAN ANYTIME YOU LIKE. - - STARBASES ALSO HAVE SHORT RANGE SENSORS. IF YOU ARE DOCKED - AT A STARBASE AND YOUR SHORT RANGE SENSORS ARE DAMAGED, YOU - MAY USE THE ONES AT THE STARBASE BY USING THE COMMAND. - - - 6 - - ***************** - * STATUS REPORT * - ***************** - - MNEMONIC: STATUS - SHORTEST ABBREVIATION: ST - - THIS COMMAND GIVES YOU INFORMATION ABOUT THE CURRENT STATE OF - YOUR STARSHIP, AS FOLLOWS: - - STARDATE - THE CURRENT DATE. A STARDATE IS THE SAME AS A DAY. - - CONDITION - THERE ARE FOUR POSSIBLE CONDITIONS: - DOCKED - DOCKED AT STARBASE. - RED - IN BATTLE. - YELLOW - LOW ON ENERGY ( < 1000 UNITS). - GREEN - NONE OF THE ABOVE. - - POSITION - QUADRANT IS GIVEN FIRST, THEN SECTOR. - - LIFE SUPPORT - IF "ACTIVE", LIFE SUPPORT SYSTEMS ARE - FUNCTIONING NORMALLY. IF ON "RESERVES", THE NUMBER - IS HOW MANY STARDATES YOUR RESERVE FOOD, AIR, ETC. WILL - LAST--YOU MUST GET REPAIRS MADE OR GET TO STARBASE - BEFORE YOUR RESERVES RUN OUT. - - WARP FACTOR - WHAT YOUR WARP FACTOR IS CURRENTLY SET TO. - - ENERGY - THE AMOUNT OF ENERGY YOU HAVE LEFT. IF IT DROPS TO - ZERO, YOU DIE. - - TORPEDOES - HOW MANY PHOTON TORPEDOES YOU HAVE LEFT. - - SHIELDS - WHETHER YOUR SHIELDS ARE UP OR DOWN, HOW STRONG - THEY ARE (WHAT PERCENT OF A HIT THEY CAN DEFLECT), AND - SHIELD ENERGY. - - KLINGONS LEFT - HOW MANY OF THE KLINGONS ARE STILL OUT THERE. - - TIME LEFT - HOW LONG THE FEDERATION CAN HOLD OUT AGAINST THE - PRESENT NUMBER OF KLINGONS; THAT IS, HOW LONG UNTIL THE - END IF YOU DO NOTHING IN THE MEANTIME. IF YOU KILL KLINGONS - QUICKLY, THIS NUMBER WILL GO UP--IF NOT, IT WILL GO DOWN. - IF IT REACHES ZERO, THE FEDERATION IS CONQUERED, AND YOU - LOSE. - - STATUS INFORMATION IS FREE--IT USES NO TIME OR ENERGY, AND IF - YOU ARE IN BATTLE, THE KLINGONS ARE NOT GIVEN ANOTHER CHANCE TO HIT - YOU. - - STATUS INFORMATION CAN ALSO BE OBTAINED BY DOING A SHORT-RANGE - SCAN. SEE THE COMMAND FOR DETAILS. - - EACH ITEM OF INFORMATION CAN BE OBTAINED SINGLY BY REQUESTING - IT. SEE COMMAND FOR DETAILS. - - 7 - - - ******************* - * LONG-RANGE SCAN * - ******************* - - MNEMONIC: LRSCAN - SHORTEST ABBREVIATION: L - - A LONG-RANGE SCAN GIVES YOU GENERAL INFORMATION ABOUT WHERE YOU - ARE AND WHAT IS AROUND YOU. HERE IS AN EXAMPLE OUTPUT. - - L. R. SCAN FOR QUADRANT 5 - 1 - -1 107 103 - -1 316 5 - -1 105 1000 - - THIS SCAN SAYS THAT YOU ARE IN ROW 5, COLUMN 1 OF THE 8 BY 8 - GALAXY. THE NUMBERS IN THE SCAN INDICATE HOW MANY OF EACH - KIND OF THING THERE IS IN YOUR QUADRANT AND ALL ADJACENT - QUADRANTS. THE DIGITS ARE INTERPRETED AS FOLLOWS. - - THOUSANDS DIGIT: 1000 INDICATES A SUPERNOVA (ONLY) - HUNDREDS DIGIT: NUMBER OF KLINGONS PRESENT - TENS DIGIT: NUMBER OF STARBASES PRESENT - ONES DIGIT: NUMBER OF STARS PRESENT - - FOR EXAMPLE, IN YOUR QUADRANT (5 - 1) THE NUMBER IS 316, WHICH - INDICATES 3 KLINGONS, 1 STARBASE AND 6 STARS. (THE LONG-RANGE - SCANNER DOES NOT DISTINGUISH BETWEEN ORDINARY KLINGONS AND - KLINGON COMMAND SHIPS.) IF THERE IS A SUPERNOVA, AS IN THE - QUADRANT BELOW AND TO YOUR RIGHT (QUADRANT 6 - 2), THERE IS - NOTHING ELSE IN THE QUADRANT. - - ROMULANS POSSESS A "CLOAKING DEVICE" WHICH PREVENTS THEIR - DETECTION BY LONG-RANGE SCAN. BECAUSE OF THIS FACT, STARFLEET - COMMAND IS NEVER SURE HOW MANY ROMULANS ARE "OUT THERE". - WHEN YOU KILL THE LAST KLINGON, THE REMAINING ROMULANS SURRENDER - TO THE FEDERATION. - - PLANETS ARE ALSO UNDETECTABLE BY LONG-RANGE SCAN. THE - ONLY WAY TO DETECT A PLANET IS TO FIND IT IN YOUR CURRENT - QUADRANT WITH SHORT-RANGE SENSORS. - - SINCE YOU ARE IN COLUMN 1, THERE ARE NO QUADRANTS TO YOUR - LEFT. THE MINUS ONES INDICATE THE NEGATIVE ENERGY BARRIER AT - THE EDGE OF THE GALAXY, WHICH YOU ARE NOT PERMITTED TO CROSS. - - LONG-RANGE SCANS ARE FREE. THEY USE UP NO ENERGY OR TIME, - AND CAN BE DONE SAFELY REGARDLESS OF BATTLE CONDITIONS. - - STARBASES ALSO HAVE L.R. SENSORS. IF YOU ARE DOCKED AND YOUR - LONG-RANGE SENSORS ARE DAMAGED, YOU MAY USE THE ONES AT STARBASE - BY USING THE COMMAND. - - 8 - ************** - * STAR CHART * - ************** - - MNEMONIC: CHART - SHORTEST ABBREVIATION: C - - AS YOU PROCEED IN THE GAME, YOU LEARN MORE AND MORE ABOUT - WHAT THINGS ARE WHERE IN THE GALAXY. THIS INFORMATION IS - AUTOMATICALLY RECORDED FOR YOU (BY SPOCK) IN YOUR STAR CHART. - - THE CHART LOOKS LIKE AN 8 BY 8 ARRAY OF NUMBERS. THESE - NUMBERS ARE INTERPRETED EXACTLY AS THEY ARE ON A LONG-RANGE - SCAN. A PERIOD (.) IN PLACE OF A DIGIT MEANS YOU DO NOT KNOW - THAT INFORMATION YET. FOR EXAMPLE, ... MEANS YOU KNOW NOTHING - ABOUT THE QUADRANT, WHILE .1. MEANS YOU KNOW THAT IT CONTAINS - A BASE, BUT AN UNKNOWN NUMBER OF KLINGONS AND STARS. - - LOOKING AT THE STAR CHART IS A FREE OPERATION. IT COSTS - YOU NEITHER TIME NOR ENERGY, AND CAN BE DONE SAFELY WHETHER - IN OR OUT OF BATTLE. - - - ***************** - * DAMAGE REPORT * - ***************** - - MNEMONIC: DAMAGES - SHORTEST ABBREVIATION: DA - - AT ANY TIME YOU MAY ASK FOR A DAMAGE REPORT TO FIND OUT WHAT - DEVICES ARE DAMAGED AND HOW LONG IT WILL TAKE TO REPAIR THEM. - NATURALLY, REPAIRS PROCEED FASTER AT A STARBASE. - - IF YOU SUFFER DAMAGES WHILE MOVING, IT IS POSSIBLE THAT A - SUBSEQUENT DAMAGE REPORT WILL NOT SHOW ANY DAMAGE. THIS HAPPENS - IF THE TIME SPENT ON THE MOVE EXCEEDS THE REPAIR TIME, SINCE IN - THIS CASE THE DAMAGED DEVICES WERE FIXED EN ROUTE. - - DAMAGE REPORTS ARE FREE. THEY USE NO ENERGY OR TIME, AND CAN - BE DONE SAFELY EVEN IN THE MIDST OF BATTLE. - - - ************************* - * MOVE UNDER WARP DRIVE * - ************************* - - MNEMONIC: MOVE - SHORTEST ABBREVIATION: M - FULL COMMAND: MOVE - MOVE - - THIS COMMAND IS THE USUAL WAY TO MOVE FROM ONE PLACE TO - ANOTHER WITHIN THE GALAXY. YOU MOVE UNDER WARP DRIVE, ACCORDING - TO THE CURRENT WARP FACTOR (SEE "WARP FACTOR"). - - 9 - THERE ARE TWO COMMAND MODES FOR MOVEMENT; MANUAL AND AUTOMATIC. - THE MANUAL MODE IS DEFAULT, AND REQUIRES THE FOLLOWING FORMAT: - - MOVE - - IS OPTIONAL. IF OMITTED, MANUAL MOVEMENT IS ASSUMED. - AND ARE THE HORIZONTAL AND VERTICAL DISPLACEMENTS FOR - YOUR STARSHIP, IN QUADRANTS; A DISPLACEMENT OF ONE SECTOR IS 0.1 - QUADRANTS. SPECIFYING AND CAUSES YOUR SHIP TO MOVE - IN A STRAIGHT LINE TO THE SPECIFIED DESTINATION. FOR EXAMPLE, - THE SHORTEST POSSIBLE COMMAND TO MOVE 1 SECTOR TO THE RIGHT WOULD BE - - M .1 0 - - THE FOLLOWING EXAMPLES OF MANUAL MOVEMENT REFER TO THE - SHORT-RANGE SCAN ON PAGE 5. - - DESTINATION SECTOR MANUAL MOVEMENT COMMAND - - 3 - 1 M -.3 -.1 - 2 - 1 M -.3 0 - 1 - 2 M -.2 .1 - 1 - 4 M 0 .1 - (LEAVING QUADRANT) M 0 .2 - 1 - 5 M .1 .1 - 2 - 10 M .6 0 - 5 - 6 M .2 -.3 - 3 - 4 M 0 -.1 - - THE AUTOMATIC MODE IS AS FOLLOWS: - - MOVE - - WHERE AND ARE THE ROW AND COLUMN NUMBERS OF THE - DESTINATION QUADRANT, AND AND ARE THE ROW AND - COLUMN NUMBERS OF THE DESTINATION SECTOR WITHIN THAT QUADRANT. - THIS COMMAND ALSO MOVES YOUR SHIP IN A STRAIGHT LINE PATH TO - THE DESTINATION. (A IS SUFFICIENT) MUST BE PRESENT. - FOR MOVING WITHIN A QUADRANT, AND MAY BE OMITTED. - FOR EXAMPLE, TO MOVE TO SECTOR 2 - 9 WITHIN THE CURRENT QUADRANT, - THE SHORTEST COMMAND WOULD BE - - M A 2 9 - - TO MOVE TO QUADRANT 3 - 7, SECTOR 5 - 8, TYPE - - M A 3 7 5 8 - - AND IT WILL BE DONE. IN AUTOMATIC MODE, EITHER TWO OR FOUR NUMBERS - MUST BE SUPPLIED. - - AUTOMATIC MODE UTILIZES THE SHIP'S "BATTLE COMPUTER". IF - THE COMPUTER IS DAMAGED, MANUAL MOVEMENT MUST BE USED. - - 10 - IT USES TIME AND ENERGY TO MOVE. HOW MUCH TIME AND HOW MUCH - ENERGY DEPENDS ON YOUR CURRENT WARP FACTOR, THE DISTANCE YOU MOVE, - AND WHETHER YOUR SHIELDS ARE UP. THE HIGHER THE WARP FACTOR, THE - FASTER YOU MOVE, BUT HIGHER WARP FACTORS REQUIRE MORE ENERGY. - YOU MAY MOVE WITH YOUR SHIELDS UP, BUT THIS DOUBLES THE ENERGY - REQUIRED. - - EACH TIME YOU MOVE IN A QUADRANT CONTAINING KLINGONS, THEY - HAVE A CHANCE TO ATTACK YOU. IN THIS CASE, THE "ENERGY LEFT" - MESSAGE YOU GET REFERS TO YOUR ENERGY AFTER THE ATTACK BUT BEFORE - THE MOVE. AS YOU MOVE, THE AMOUNT THAT THE KLINGONS HIT YOU WITH - IS DEPENDENT ON YOUR AVERAGE DISTANCE FROM THEM. - - *************** - * WARP FACTOR * - *************** - - MNEMONIC: WARP - SHORTEST ABBREVIATION: W - FULL COMMAND: WARP - - YOUR WARP FACTOR CONTROLS THE SPEED OF YOUR STARSHIP. THE - LARGER THE WARP FACTOR, THE FASTER YOU GO AND THE MORE ENERGY - YOU USE. - - YOUR MINIMUM WARP FACTOR IS 1.0 AND YOUR MAXIMUM WARP FACTOR - IS 10.0 (WHICH IS 100 TIMES AS FAST AND USES 1000 TIMES AS MUCH - ENERGY). AT SPEEDS ABOVE WARP 6 THERE IS SOME DANGER OF CAUSING - DAMAGE TO YOUR WARP ENGINES; THIS DAMAGE IS LARGER AT HIGHER - WARP FACTORS AND ALSO DEPENDS ON HOW FAR YOU GO AT THAT WARP - FACTOR. - - AT EXACTLY WARP 10 THERE IS SOME PROBABILITY OF ENTERING A - SO-CALLED "TIME WARP" AND BEING THROWN FORWARD OR BACKWARD IN - TIME. THE FARTHER YOU GO AT WARP 10, THE GREATER IS THE PROBABILITY - OF ENTERING THE TIME WARP. - - ******************* - * IMPULSE ENGINES * - ******************* - - MNEMONIC: IMPULSE - SHORTEST ABBREVIATION: I - FULL COMMAND: IMPULSE - - THE IMPULSE ENGINES GIVE YOU A WAY TO MOVE WHEN YOUR WARP - ENGINES ARE DAMAGED. THEY MOVE YOU AT A SPEED OF 0.95 SECTORS - PER STARDATE, WHICH IS THE EQUIVALENT OF A WARP FACTOR OF ABOUT - 0.975, SO THEY ARE MUCH TOO SLOW TO USE EXCEPT IN EMERGENCIES. - - MOVEMENT COMMANDS ARE INDICATED JUST AS IN THE "MOVE" COMMAND. - - THE IMPULSE ENGINES REQUIRE 20 UNITS OF ENERGY TO ENGAGE, - PLUS 10 UNITS PER SECTOR (100 UNITS PER QUADRANT) TRAVELLED. - IT DOES NOT COST EXTRA TO MOVE WITH THE SHIELDS UP. - - 11 - ********************* - * DEFLECTOR SHIELDS * - ********************* - - MNEMONIC: SHIELDS - SHORTEST ABBREVIATION: SH - FULL COMMANDS: SHIELDS UP - SHIELDS DOWN - SHIELDS TRANSFER - - YOUR DEFLECTOR SHIELDS ARE A DEFENSIVE DEVICE TO PROTECT YOU - FROM KLINGON ATTACKS (AND NEARBY NOVAS). AS THE SHIELDS PROTECT - YOU, THEY GRADUALLY WEAKEN. A SHIELD STRENGTH OF 75 PERCENT, FOR - EXAMPLE, MEANS THAT THE NEXT TIME A KLINGON HITS YOU, YOUR SHIELDS - WILL DEFLECT 75 PERCENT OF THE HIT, AND LET 25 PERCENT GET THROUGH - TO HURT YOU. - - IT COSTS 50 UNITS OF ENERGY TO RAISE SHIELDS, NOTHING TO LOWER - THEM. YOU MAY MOVE WITH YOUR SHIELDS UP; THIS COSTS NOTHING EXTRA - UNDER IMPULSE POWER, BUT DOUBLES THE ENERGY REQUIRED FOR WARP DRIVE. - - EACH TIME YOU RAISE OR LOWER YOUR SHIELDS, THE KLINGONS HAVE - ANOTHER CHANCE TO ATTACK. SINCE SHIELDS DO NOT RAISE AND LOWER - INSTANTANEOUSLY, THE HITS YOU RECEIVE WILL BE INTERMEDIATE BETWEEN - WHAT THEY WOULD BE IF THE SHIELDS WERE COMPLETELY UP OR COMPLETELY DOWN. - - YOU MAY NOT FIRE PHASERS THROUGH YOUR SHIELDS. HOWEVER, - YOU MAY USE THE "HIGH-SPEED SHIELD CONTROL" TO LOWER SHIELDS, - FIRE PHASERS, AND RAISE THE SHIELDS AGAIN BEFORE THE KLINGONS CAN - REACT. SINCE RAPID LOWERING AND RAISING OF THE SHIELDS REQUIRES - MORE ENERGY THAN NORMAL SPEED OPERATION, IT COSTS YOU 200 UNITS OF - ENERGY TO ACTIVATE THIS CONTROL. IT IS AUTOMATICALLY ACTIVATED WHEN - YOU FIRE PHASERS WHILE SHIELDS ARE UP. YOU MAY FIRE PHOTON TORPEDOES, - BUT THEY MAY BE DEFLECTED CONSIDERABLY FROM THEIR INTENDED COURSE - AS THEY PASS THROUGH THE SHIELDS (DEPENDING ON SHIELD STRENGTH). - - YOU MAY TRANSFER ENERGY BETWEEN THE SHIP'S ENERGY (GIVEN AS - IN STATUS) AND THE SHIELDS. MAY BE ABBREVIATED - . IS THE NUMBER OF UNITS OF - ENERGY YOU WISH TO TAKE FROM THE SHIP'S ENERGY AND PUT INTO THE - SHIELDS. IF YOU SPECIFY A NEGATIVE NUMBER, ENERGY IS DRAINED - FROM THE SHIELDS TO THE SHIP. TRANSFERRING ENERGY CONSTITUTES A - TURN. IF YOU TRANSFER ENERGY TO THE SHIELDS WHILE UNDER ATTACK, - THEY WILL BE AT THE NEW ENERGY LEVEL WHEN YOU ARE NEXT HIT. - - 12 - *********** - * PHASERS * - *********** - - MNEMONIC: PHASERS - SHORTEST ABBREVIATION: P - FULL COMMANDS: PHASERS AUTOMATIC - PHASERS - PHASERS MANUAL ... - - PHASERS ARE ENERGY WEAPONS. AS YOU FIRE PHASERS AT KLINGONS, - YOU SPECIFY AN WHICH IS DRAWN FROM YOUR ENERGY - RESERVES. THE AMOUNT OF TOTAL HIT REQUIRED TO KILL AN ENEMY IS - PARTLY RANDOM, BUT ALSO DEPENDS ON SKILL LEVEL. - - THE AVERAGE HIT REQUIRED TO KILL AN ORDINARY KLINGON VARIES - FROM 200 UNITS IN THE NOVICE GAME TO 250 UNITS IN THE EMERITUS - GAME. COMMANDERS NORMALLY REQUIRE FROM 600 (NOVICE) TO 700 - (EMERITUS). THE "SUPER-COMMANDER" REQUIRES FROM 875 (GOOD) - TO 1000 (EMERITUS). ROMULANS REQUIRE AN AVERAGE OF 350 (NOVICE) - TO 450 (EMERITUS). - - HITS ON ENEMIES ARE CUMULATIVE, AS LONG AS YOU DO NOT LEAVE - THE QUADRANT. - - IN GENERAL, NOT ALL THAT YOU FIRE WILL REACH THE KLINGONS. - THE FARTHER AWAY THEY ARE, THE LESS PHASER ENERGY WILL REACH THEM. - IF A KLINGON IS ADJACENT TO YOU, HE WILL RECEIVE ABOUT 90 PERCENT - OF THE PHASER ENERGY DIRECTED AT HIM; A KLINGON 5 SECTORS AWAY - WILL RECEIVE ABOUT 60 PERCENT, AND A KLINGON 10 SECTORS AWAY WILL - RECEIVE ABOUT 35 PERCENT. THERE IS SOME RANDOMNESS INVOLVED, SO - THESE FIGURES ARE NOT EXACT. PHASERS HAVE NO EFFECT BEYOND THE - BOUNDARIES OF THE QUADRANT YOU ARE IN. - - PHASERS MAY OVERHEAT (AND BE DAMAGED) IF YOU FIRE TOO LARGE - A BURST AT ONCE. FIRING UP TO 1500 UNITS IS SAFE. FROM 1500 - ON UP, THE PROBABILITY OF OVERHEAT INCREASES WITH THE AMOUNT FIRED. - - IF PHASER FIRING IS AUTOMATIC, THE COMPUTER DECIDES HOW TO - DIVIDE UP YOUR AMONG THE KLINGONS PRESENT. IF - PHASER FIRING IS MANUAL, YOU SPECIFY HOW MUCH ENERGY TO FIRE AT - EACH KLINGON PRESENT (NEAREST FIRST), RATHER THAN JUST SPECIFYING - A TOTAL AMOUNT. YOU CAN ABBREVIATE "MANUAL" AND "AUTOMATIC" TO - ONE OR MORE LETTERS; IF YOU MENTION NEITHER, AUTOMATIC FIRING IS - USUALLY ASSUMED. - - A SAFETY INTERLOCK PREVENTS PHASERS FROM BEING FIRED THROUGH - THE SHIELDS. IF THIS WERE NOT SO, THE SHIELDS WOULD CONTAIN - YOUR FIRE AND YOU WOULD FRY YOURSELF. HOWEVER, YOU MAY UTILIZE - THE "HIGH-SPEED SHIELD CONTROL" TO DROP SHIELDS, FIRE PHASERS, - AND RAISE SHIELDS BEFORE THE ENEMY CAN REACT. SINCE IT TAKES - MORE ENERGY TO RAISE THE SHIELDS RAPIDLY AFTER A SHOT, IT COSTS - YOU 200 UNITS OF ENERGY EACH TIME YOU ACTIVATE THIS CONTROL. IT - IS AUTOMATICALLY ACTIVATED WHEN YOU FIRE PHASERS WHILE SHIELDS ARE UP. - BY SPECIFYING THE OPTION, SHIELDS ARE NOT RAISED AFTER FIRING. - - PHASERS HAVE NO EFFECT ON STARBASES (WHICH ARE SHIELDED) OR - ON STARS. - - 13 - ******************** - * PHOTON TORPEDOES * - ******************** - - MNEMONIC: PHOTONS - SHORTEST ABBREVIATION: PHO - FULL COMMANDS: PHOTONS - - PHOTON TORPEDOES ARE PROJECTILE WEAPONS--YOU EITHER HIT WHAT - YOU AIM AT, OR YOU DON'T. THERE ARE NO "PARTIAL HITS". - - ONE PHOTON TORPEDO WILL USUALLY KILL ONE ORDINARY KLINGON, - BUT IT USUALLY TAKES ABOUT TWO FOR A KLINGON COMMANDER. PHOTON - TORPEDOES CAN ALSO BLOW UP STARS AND STARBASES, IF YOU AREN'T - CAREFUL. - - YOU MAY FIRE PHOTON TORPEDOES SINGLY, OR IN BURSTS OF TWO - OR THREE. EACH TORPEDO IS INDIVIDUALLY TARGETABLE. THE COMPUTER - WILL PROMPT YOU, ASKING FOR THE TARGET SECTOR FOR EACH TORPEDO. - ALTERNATELY, YOU MAY SPECIFY EACH TARGET IN THE COMMAND LINE. - - PHOTON TORPEDOES CANNOT BE AIMED PRECISELY--THERE IS ALWAYS - SOME RANDOMNESS INVOLVED IN THE DIRECTION THEY GO. PHOTON - TORPEDOES MAY BE FIRED WITH YOUR SHIELDS UP, BUT AS THEY PASS - THROUGH THE SHIELDS THEY ARE RANDOMLY DEFLECTED FROM THEIR - INTENDED COURSE EVEN MORE. - - PHOTON TORPEDOES ARE PROXIMITY-FUSED. THE CLOSER THEY - EXPLODE TO THE ENEMY, THE MORE DAMAGE THEY DO. THERE IS A HIT - "WINDOW" ABOUT 1 SECTOR WIDE. IF THE TORPEDO MISSES THE HIT - WINDOW, IT DOES NOT EXPLODE AND THE ENEMY IS UNAFFECTED. - PHOTON TORPEDOES ARE ONLY EFFECTIVE WITHIN THE QUADRANT. THEY - HAVE NO EFFECT ON THINGS IN ADJACENT QUADRANTS. - - IF MORE THAN ONE TORPEDO IS FIRED AND ONLY ONE TARGET - SECTOR IS SPECIFIED, ALL TORPEDOES ARE FIRED AT THAT SECTOR. - FOR EXAMPLE, TO FIRE TWO TORPEDOES AT SECTOR 3 - 4, YOU TYPE - - PHO 2 3 4 (OR) PHO 2 3 4 3 4 - - TO FIRE TORPEDOES AT, CONSECUTIVELY, SECTORS 2 - 6, 1 - 10, - AND 4 - 7, TYPE - - PHO 3 2 6 1 10 4 7 - - THERE IS NO RESTRICTION TO FIRE DIRECTLY AT A SECTOR. FOR - EXAMPLE, YOU CAN ENTER - - PHO 1 3 2.5 - - TO AIM BETWEEN TWO SECTORS. HOWEVER, SECTOR NUMBERS MUST BE - 1 TO 10 INCLUSIVE. - - 14 - ******************** - * DOCK AT STARBASE * - ******************** - - MNEMONIC: DOCK - SHORTEST ABBREVIATION: D - - YOU MAY DOCK YOUR STARSHIP WHENEVER YOU ARE IN ONE OF THE - EIGHT SECTOR POSITIONS IMMEDIATELY ADJACENT TO A STARBASE. WHEN - YOU DOCK, YOUR STARSHIP IS RESUPPLIED WITH ENERGY, SHIELD ENERGY - PHOTON TORPEDOES, AND LIFE SUPPORT RESERVES. REPAIRS ALSO PROCEED - FASTER AT STARBASE, SO IF SOME OF YOUR DEVICES ARE DAMAGED, - YOU MAY WISH TO STAY AT BASE (BY USING THE "REST" COMMAND) - UNTIL THEY ARE FIXED. IF YOUR SHIP HAS MORE THAN ITS NORMAL - MAXIMUM ENERGY (WHICH CAN HAPPEN IF YOU'VE LOADED CRYSTALS) - THE SHIP'S ENERGY IS NOT CHANGED. - - YOU MAY NOT DOCK WHILE IN STANDARD ORBIT AROUND A PLANET. - - STARBASES HAVE THEIR OWN DEFLECTOR SHIELDS, SO YOU ARE - COMPLETELY SAFE FROM ATTACK WHILE DOCKED. YOU ARE ALSO SAFE - FROM LONG-RANGE TRACTOR BEAMS. - - ******** - * REST * - ******** - - MNEMONIC: REST - SHORTEST ABBREVIATION: R - FULL COMMAND: REST - - THIS COMMAND SIMPLY ALLOWS THE SPECIFIED NUMBER OF STARDATES - TO GO BY. THIS IS USEFUL IF YOU HAVE SUFFERED DAMAGES AND WISH - TO WAIT UNTIL REPAIRS ARE MADE BEFORE YOU GO BACK INTO BATTLE. - - IT IS NOT GENERALLY ADVISABLE TO REST WHILE YOU ARE UNDER - ATTACK BY KLINGONS. - - ************************** - * CALL STARBASE FOR HELP * - ************************** - - MNEMONIC: HELP - (NO ABBREVIATION) - - WHEN YOU GET INTO SERIOUS TROUBLE, YOU MAY CALL STARBASE FOR - HELP. STARBASES HAVE A DEVICE CALLED A "LONG-RANGE TRANSPORTER - BEAM" WHICH THEY CAN USE TO TELEPORT YOU TO BASE. THIS WORKS BY - DEMATERIALIZING YOUR STARSHIP AT ITS CURRENT POSITION AND (HOPEFULLY) - RE-MATERIALIZING IT ADJACENT TO THE NEAREST STARBASE. TELEPORTATION - IS INSTANTANEOUS, AND STARBASE SUPPLIES THE REQUIRED ENERGY--ALL YOU - HAVE TO DO IS LET THEM KNOW (VIA SUBSPACE RADIO) THAT YOU NEED HELP. - - 15 - THIS COMMAND SHOULD BE EMPLOYED ONLY WHEN ABSOLUTELY NECESSARY. - IN THE FIRST PLACE, CALLING FOR HELP IS AN ADMISSION ON YOUR PART - THAT YOU GOT YOURSELF INTO SOMETHING YOU CANNOT GET YOURSELF OUT - OF, AND YOU ARE HEAVILY PENALIZED FOR THIS IN THE FINAL SCORING. - SECONDLY, THE LONG-RANGE TRANSPORTER BEAM IS NOT RELIABLE--STARBASE - CAN ALWAYS MANAGE TO DEMATERIALIZE YOUR STARSHIP, BUT (DEPENDING - ON DISTANCE) MAY OR MAY NOT BE ABLE TO RE-MATERIALIZE YOU AGAIN. - THE LONG-RANGE TRANSPORTER BEAM HAS NO ABSOLUTE MAXIMUM RANGE; - IF YOU ARE IN THE SAME QUADRANT AS A STARBASE, YOU HAVE A GOOD - CHANCE (ABOUT 90 PERCENT) OF RE-MATERIALIZING SUCCESSFULLY. - YOUR CHANCES DROP TO ROUGHLY 50-50 AT JUST OVER 3 QUADRANTS. - - - - **************** - * ABANDON SHIP * - **************** - - MNEMONIC: ABANDON - (NO ABBREVIATION) - - YOU MAY ABANDON THE ENTERPRISE IF NECESSARY. IF THERE IS - STILL A STARBASE IN THE GALAXY, YOU WILL BE SENT THERE AND PUT - IN CHARGE OF A WEAKER SHIP, THE FAERIE QUEENE. - - THE FAERIE QUEENE CANNOT BE ABANDONED. - - ***************** - * SELF-DESTRUCT * - ***************** - - MNEMONIC: DESTRUCT - (NO ABBREVIATION) - - YOU MAY SELF-DESTRUCT, THUS KILLING YOURSELF AND ENDING THE - GAME. IF THERE ARE NEARBY KLINGONS, YOU MAY TAKE A FEW OF THEM - WITH YOU (THE MORE ENERGY YOU HAVE LEFT, THE BIGGER THE BANG). - - IN ORDER TO SELF-DESTRUCT YOU MUST REMEMBER THE PASSWORD YOU - TYPED IN AT THE BEGINNING OF THE GAME. - - - - ****************************** - * TERMINATE THE CURRENT GAME * - ****************************** - - MNEMONIC: TERMINATE - (NO ABBREVIATION) - - IMMEDIATELY CANCEL THE CURRENT GAME; NO CONCLUSION IS REACHED. - YOU WILL BE GIVEN AN OPPORTUNITY TO START A NEW GAME OR TO LEAVE - THE STAR TREK PROGRAM. - - 16 - *************** - * SENSOR-SCAN * - *************** - - MNEMONIC: SENSORS - SHORTEST ABBREVIATION: SE - - UTILIZING THE SHORT-RANGE SENSORS, SCIENCE OFFICER - SPOCK GIVES YOU A READOUT ON ANY PLANET IN YOUR QUADRANT. - PLANETS COME IN THREE CLASSES: M, N, AND O. ONLY CLASS M - PLANETS HAVE EARTH-LIKE CONDITIONS. SPOCK INFORMS YOU IF THE - PLANET HAS ANY DILITHIUM CRYSTALS. SENSOR SCANS ARE FREE. - - ************************ - * ENTER STANDARD ORBIT * - ************************ - - MNEMONIC: ORBIT - SHORTEST ABBREVIATION: O - - TO LAND ON A PLANET YOU MUST FIRST BE IN STANDARD ORBIT. - YOU ACHIEVE THIS IN A MANNER SIMILAR TO DOCKING AT STARBASE. - MOVING TO ONE OF THE EIGHT SECTOR POSITIONS IMMEDIATELY ADJACENT - TO THE PLANET, YOU GIVE THE ORBIT COMMAND WHICH PUTS YOUR SHIP - INTO STANDARD ORBIT ABOUT THE PLANET. SINCE THIS IS A MANEUVER, - A SMALL AMOUNT OF TIME IS USED; NEGLIGIBLE ENERGY IS REQUIRED. - IF ENEMIES ARE PRESENT, THEY WILL ATTACK. - - ********************** - * TRANSPORTER-TRAVEL * - ********************** - - MNEMONIC: TRANSPORT - SHORTEST ABBREVIATION: T - - THE TRANSPORTER IS A DEVICE WHICH CAN CONVERT ANY PHYSICAL - OBJECT INTO ENERGY, BEAM THE ENERGY THROUGH SPACE, AND RECONSTRUCT - THE PHYSICAL OBJECT AT SOME DESTINATION. TRANSPORTING IS ONE - WAY TO LAND ON A PLANET. SINCE THE TRANSPORTER HAS A LIMITED - RANGE, YOU MUST BE IN STANDARD ORBIT TO BEAM DOWN TO A PLANET. - SHIELDS MUST BE DOWN WHILE TRANSPORTING. - - THE TRANSPORT COMMAND IS USED TO BEAM A LANDING PARTY ONTO - A PLANET TO MINE "DILITHIUM CRYSTALS". EACH TIME THE COMMAND - IS GIVEN THE LANDING PARTY (WHICH YOU LEAD) MOVES FROM THE SHIP - TO THE PLANET, OR VICE-VERSA. - - YOU ARE ADVISED AGAINST NEEDLESS TRANSPORTING, SINCE LIKE - ALL DEVICES, THE TRANSPORTER WILL SOMETIMES MALFUNCTION. - - THE TRANSPORTER CONSUMES NEGLIGIBLE TIME AND ENERGY. ITS - USE DOES NOT CONSTITUTE A "TURN". - - 17 - ***************** - * SHUTTLE CRAFT * - ***************** - - MNEMONIC: SHUTTLE - SHORTEST ABBREVIATION: SHU - - AN ALTERNATE WAY TO TRAVEL TO AND FROM PLANETS. BECAUSE - OF LIMITED RANGE, YOU MUST BE IN STANDARD ORBIT TO USE THE - SHUTTLE CRAFT, NAMED "GALILEO". SHIELDS MUST BE DOWN. - - UNLIKE TRANSPORTING, USE OF THE SHUTTLE CRAFT DOES CONSTITUTE - A "TURN" SINCE TIME IS CONSUMED. THE TIME NATURALLY DEPENDS - ON ORBIT ALTITUDE, BUT WILL USUALLY BE LESS THAN 0.2 STARDATES. - SHUTTLING USES NO SHIP ENERGY. - - *************************** - * MINE DILITHIUM CRYSTALS * - *************************** - - MNEMONIC: MINE - SHORTEST ABBREVIATION: MI - - ONCE YOU AND YOUR MINING PARTY ARE ON THE SURFACE OF A - PLANET WHICH HAS DILITHIUM CRYSTALS, THIS COMMAND WILL DIG THEM - FOR YOU. - - MINING REQUIRES TIME AND CONSTITUTES A "TURN". NO ENERGY - IS USED. CLASS M PLANETS REQUIRE 0.1 TO 0.3 STARDATES TO MINE. - CLASS N PLANETS TAKE TWICE AS LONG, AND CLASS O PLANETS TAKE - THREE TIMES AS LONG. - - DILITHIUM CRYSTALS CONTAIN ENORMOUS ENERGY IN A FORM - THAT IS READILY RELEASED IN THE SHIP'S POWER SYSTEM. IT - IS AN EXCELLENT IDEA TO MINE THEM WHENEVER POSSIBLE, FOR USE - IN EMERGENCIES. ONCE YOU HAVE MINED CRYSTALS, AND HAVE THEM - SAFELY ABOARD SHIP, YOU HAVE A SUPPLY THAT WILL LAST THE ENTIRE - GAME. THERE IS NO NEED TO GO BACK FOR MORE (UNLESS YOU ABANDON - SHIP). - - *************************** - * LOAD DILITHIUM CRYSTALS * - *************************** - - MNEMONIC: CRYSTALS - SHORTEST ABBREVIATION: CR - - THIS IS A VERY POWERFUL COMMAND WHICH SHOULD BE USED WITH - CAUTION. ONCE YOU HAVE DILITHIUM CRYSTALS ABOARD SHIP, THIS - COMMAND WILL INSTRUCT ENGINEERING OFFICER SCOTT AND MR. SPOCK - TO PLACE A RAW DILITHIUM CRYSTAL INTO THE POWER CHANNEL OF THE - SHIP'S MATTER-ANTIMATTER CONVERTER. WHEN IT WORKS, THIS COMMAND - WILL GREATLY BOOST THE SHIP'S ENERGY. - - 18 - BECAUSE THE CRYSTALS ARE RAW AND IMPURE, INSTABILITIES - CAN OCCUR IN THE POWER CHANNEL. USUALLY SCOTTY CAN CONTROL - THESE. WHEN HE CANNOT, THE RESULTS ARE DISASTROUS. - - EVEN IF THE CRYSTALS ARE LOADED SUCCESSFULLY, SOME DAMAGE - IS INEVITABLY DONE TO THE POWER CHANNEL. THIS DAMAGE HAS NO - EFFECT ON THE OPERATION OF THE POWER PLANT, BUT WILL MAKE IT MORE - DIFFICULT TO CONTROL INSTABILITIES THE NEXT TIME CRYSTALS ARE - LOADED. - - SINCE USING RAW DILITHIUM CRYSTALS FOR THIS PURPOSE ENTAILS - CONSIDERABLE RISK, STARFLEET REGULATIONS ALLOW ITS USE ONLY DURING - "CONDITION YELLOW". NO TIME OR ENERGY IS USED. - - ***************** - * PLANET REPORT * - ***************** - - MNEMONIC: PLANETS - SHORTEST ABBREVIATION: PL - - MR. SPOCK PRESENTS YOU A LIST OF THE AVAILABLE INFORMATION - ON PLANETS IN THE GALAXY. SINCE PLANETS DO NOT SHOW UP ON - LONG-RANGE SCANS, THE ONLY WAY TO OBTAIN THIS INFORMATION IS - WITH THE "SENSORS" COMMAND. - - ********** - * FREEZE * - ********** - - MNEMONIC: FREEZE - (NO ABBREVIATION) - FULL COMMAND: FREEZE - - THE PURPOSE OF THE COMMAND IS TO ALLOW A PLAYER - TO SAVE THE CURRENT STATE OF THE GAME, SO THAT IT CAN BE FINISHED - LATER. A FILE WITH THE SPECIFIED AND TYPE '.TRK' IS - CREATED (IF NECESSARY) IN THE CURRENT DIRECTORY, AND ALL PERTINENT - INFORMATION ABOUT THE GAME IS WRITTEN TO THAT FILE. THE GAME - IS THEN TERMINATED, AND YOU ARE GIVEN THE CHOICE OF STARTING A NEW - GAME OR LEAVING THE PROGRAM. YOU MAY CONTINUE THE CURRENT GAME - USING THE PROCEDURE DESCRIBED NEXT. - - TO RESTART A GAME CREATED BY THE "FREEZE" COMMAND, THE USER - NEED ONLY TYPE "FROZEN" IN RESPONSE TO THE INITIAL QUESTION - ABOUT THE TYPE OF GAME DESIRED, FOLLOWED BY THE . - - NOTE: A "TOURNAMENT" GAME IS LIKE A FROZEN GAME, WITH THE - FOLLOWING DIFFERENCES. (1) TOURNAMENT GAMES ALWAYS START FROM - THE BEGINNING, WHILE A FROZEN GAME CAN START AT ANY POINT. - (2) TOURNAMENT GAMES REQUIRE ONLY THAT THE PLAYER REMEMBER THE - NAME OR NUMBER OF THE TOURNAMENT, WHILE THE INFORMATION ABOUT A - FROZEN GAME MUST BE KEPT ON A FILE. - - A POINT WORTH NOTING IS THAT 'FREEZE' DOES NOT SAVE THE SEED - FOR THE RANDOM NUMBER GENERATOR, SO THAT IDENTICAL ACTIONS AFTER - RESTARTING THE SAME FROZEN GAME CAN LEAD TO DIFFERENT RESULTS. - HOWEVER, IDENTICAL ACTIONS AFTER STARTING A GIVEN TOURNAMENT - GAME ALWAYS LEAD TO THE SAME RESULTS. - - 19 - *********** - * REQUEST * - *********** - - MNEMONIC: REQUEST - SHORTEST ABBREVIATION: REQ - FULL COMMAND: REQUEST - - THIS COMMAND ALLOWS YOU TO GET ANY SINGLE PIECE OF INFORMATION - FROM THE COMMAND. SPECIFIES WHICH INFORMATION AS FOLLOWS: - - INFORMATION MNEMONIC FOR SHORTEST ABBREVIATION - - STARDATE DATE D - CONDITION CONDITION C - POSITION POSITION P - LIFE SUPPORT LSUPPORT L - WARP FACTOR WARPFACTOR W - ENERGY ENERGY E - TORPEDOES TORPEDOES TO - SHIELDS SHIELDS S - KLINGONS LEFT KLINGONS K - TIME LEFT TIME T - - ************************** - * EXPERIMENTAL DEATH RAY * - ************************** - - MNEMONIC: DEATHRAY - (NO ABBREVIATION) - - THIS COMMAND SHOULD BE USED ONLY IN THOSE DESPERATE CASES - WHERE YOU HAVE ABSOLUTELY NO ALTERNATIVE. THE DEATH RAY USES - ENERGY TO REARRANGE MATTER. UNFORTUNATELY, ITS WORKING PRINCIPLES - ARE NOT YET THOROUGHLY UNDERSTOOD, AND THE RESULTS ARE HIGHLY - UNPREDICTABLE. - - THE DEATH RAY IS A VERY DELICATE DEVICE AND IS USUALLY DAMAGED - AFTER ITS FIRST USE. THE FIRST TIME ONE USES THE DEATH RAY, THERE - IS A SEVENTY PERCENT CHANCE OF ITS FUNCTIONING CORRECTLY. WHEN IT - WORKS, THE DEATH RAY ELIMINATES ALL THE ENEMIES IN THE QUADRANT. - WHEN IT DOES NOT..................... - - IF THE DEATH RAY IS DAMAGED IN ITS USE, IT MUST BE TOTALLY - REPLACED. THIS CAN ONLY BE DONE AT STARBASE. BECAUSE IT IS A VERY - COMPLEX DEVICE, IT TAKES 9.99 STARDATES AT BASE TO REPLACE THE - DEATH RAY. - - THE DEATH RAY CANNOT BE REPAIRED IN FLIGHT. - - 20 - ****************** - * EMERGENCY EXIT * - ****************** - - MNEMONIC: EMEXIT - SHORTEST ABBREVIATION: E - - THIS COMMAND PROVIDES A QUICK WAY TO EXIT FROM THE GAME WHEN - YOU OBSERVE A KLINGON BATTLE CRUISER APPROACHING YOUR TERMINAL. - ITS EFFECT IS TO FREEZE THE GAME ON THE FILE 'EMSAVE.TRK' IN YOUR - CURRENT DIRECTORY, ERASE THE SCREEN (IF YOU ARE PLAYING AT A VT52), - AND EXIT. - - A SHORT IMPLEMENTATION NOTE: THE SCREEN ERASURE IS DONE BY THE - MODULE 'GETOUT', WHICH CAN EASILY BE MODIFIED TO HANDLE TERMINALS - THAT USE DIFFERENT CONTROL OR ESCAPE SEQUENCES TO EFFECT SCREEN - ERASURE. - - *************** - * GAME REPORT * - *************** - - MNEMONIC: GAME - SHORTEST ABBREVIATION: G - - THIS COMMAND SUPPLIES YOU WITH INFORMATION ABOUT THE STATE OF THE - CURRENT GAME. ITS PURPOSE IS TO REMIND YOU OF THINGS THAT YOU HAVE - LEARNED DURING PLAY, BUT MAY HAVE FORGOTTEN, AND CANNOT OTHERWISE - RETRIEVE IF YOU ARE NOT PLAYING AT A HARD-COPY TERMINAL. - - YOU ARE TOLD THE FOLLOWING THINGS: - - . THE LENGTH AND SKILL LEVEL OF THE GAME YOU ARE PLAYING - . THE ORIGINAL NUMBER OF KLINGONS - . HOW MANY KLINGONS YOU HAVE DESTROYED - . WHETHER THE SUPER-COMMANDER HAS BEEN DESTROYED - . HOW MANY BASES HAVE BEEN DESTROYED - . HOW MANY BASES ARE LEFT - . WHAT BASES (IF ANY) ARE UNDER ATTACK; YOU MUST HAVE BEEN - INFORMED OF THE ATTACK VIA SUBSPACE RADIO - . HOW MANY CASUALTIES YOU HAVE SUFFERED - . HOW MANY TIMES YOU HAVE CALLED FOR HELP. - - YOU ARE ALSO WARNED IF THE SUBSPACE RADIO HAS BEEN DAMAGED, WHICH - MAY RENDER YOUR INFORMATION INCOMPLETE. - - THIS SAME INFORMATION IS AUTOMATICALLY GIVEN TO YOU WHEN YOU - START TO PLAY A FROZEN GAME. - - 21 - ----------MISCELLANEOUS NOTES---------- - - STARBASES CAN BE ATTACKED BY EITHER COMMANDERS OR BY THE - "SUPER-COMMANDER". WHEN THIS HAPPENS, YOU WILL BE NOTIFIED - BY SUBSPACE RADIO, PROVIDED IT IS WORKING. THE MESSAGE WILL - INFORM YOU HOW LONG THE BASE UNDER ATTACK CAN LAST. SINCE THE - "SUPER-COMMANDER" IS MORE POWERFUL THAN AN ORDINARY COMMANDER, - HE CAN DESTROY A BASE MORE QUICKLY. - - THE "SUPER-COMMANDER" TRAVELS AROUND THE GALAXY AT A SPEED - OF ABOUT WARP 6 OR 7. HIS MOVEMENT IS STRICTLY TIME BASED; THE - MORE TIME PASSES, THE FURTHER HE CAN GO. - - SCATTERED THROUGH THE GALAXY ARE CERTAIN ZONES OF CONTROL, - COLLECTIVELY DESIGNATED THE "ROMULAN NEUTRAL ZONE". ANY - QUADRANT WHICH CONTAINS ROMULANS WITHOUT KLINGONS IS PART OF THE - NEUTRAL ZONE, EXCEPT IF A BASE IS PRESENT. SINCE ROMULANS DO NOT - SHOW ON EITHER THE LONG-RANGE SCAN OR THE STAR CHART, IT IS EASY - FOR YOU TO STUMBLE INTO THIS ZONE. WHEN YOU DO, IF YOUR SUBSPACE - RADIO IS WORKING, YOU WILL RECEIVE A WARNING MESSAGE FROM THE - ROMULAN, POLITELY ASKING YOU TO LEAVE. - - IN GENERAL, ROMULANS ARE A GALACTIC NUISANCE. - - THE HIGH-SPEED SHIELD CONTROL IS FAIRLY RELIABLE, BUT IT HAS - BEEN KNOWN TO MALFUNCTION. - - YOU CAN OBSERVE THE GALACTIC MOVEMENTS OF THE "SUPER-COMMANDER" - ON THE STAR CHART, PROVIDED HE IS IN TERRITORY YOU HAVE SCANNED. - - PERIODICALLY, YOU WILL RECEIVE INTELLIGENCE REPORTS FROM - STARFLEET COMMAND, INDICATING THE CURRENT QUADRANT OF THE - "SUPER-COMMANDER". YOUR SUBSPACE RADIO MUST BE WORKING, OF - COURSE. - - EACH QUADRANT WILL CONTAIN FROM 0 TO 3 BLACK HOLES. - TORPEDOES ENTERING A BLACK HOLE DISAPPEAR. IN FACT, ANYTHING - ENTERING A BLACK HOLE DISAPPEARS, PERMANENTLY. IF YOU CAN DISPLACE - AN ENEMY INTO ONE, HE IS A GONER. BLACK HOLES DO NOT NECESSARILY - REMAIN IN A QUADRANT. THEY ARE TRANSIENT PHENOMENA. - - BATTLE COMPUTER INFORMATION IS AVAILABLE BY FIRING PHASERS - MANUALLY, AND ALLOWING THE COMPUTER TO PROMPT YOU. IF YOU ENTER - ZERO FOR THE AMOUNT TO FIRE AT EACH ENEMY, YOU WILL GET A - COMPLETE REPORT, WITHOUT COST. THE BATTLE COMPUTER WILL TELL YOU HOW - MUCH PHASER ENERGY TO FIRE AT EACH ENEMY FOR A SURE KILL. THIS - INFO APPEARS IN PARENTHESES PRIOR TO THE PROMPT FOR EACH ENEMY. - SINCE THE AMOUNT IS COMPUTED FROM SENSOR DATA, IF EITHER THE COMPUTER - OR S.R. SENSORS ARE DAMAGED, THIS INFO WILL BE UNAVAILABLE, AND - PHASERS MUST BE FIRED MANUALLY. BATTLE COMPUTER INFORMATION CAN BE - OBTAINED EVEN IF THE PHASERS ARE DAMAGED (OR OTHERWISE UNUSABLE), - PROVIDED THE COMPUTER AND SHORT-RANGE SENSORS ARE BOTH WORKING. - - IF WARP ENGINES ARE DAMAGED LESS THAN 10 STARDATES (UNDOCKED) - YOU CAN STILL GO WARP 4. - - 22 - - ----------SCORING---------- - - - SCORING IS FAIRLY SIMPLE. YOU GET POINTS FOR GOOD THINGS, AND - YOU LOSE POINTS FOR BAD THINGS. - - YOU GAIN-- - - (1) 10 POINTS FOR EACH ORDINARY KLINGON YOU KILL, - (2) 50 POINTS FOR EACH COMMANDER YOU KILL, - (3) 200 POINTS FOR KILLING THE "SUPER-COMMANDER", - (4) 20 POINTS FOR EACH ROMULAN KILLED, - (5) 1 POINT FOR EACH ROMULAN CAPTURED. - (6) 500 TIMES YOUR AVERAGE KLINGON/STARDATE KILL RATE. IF YOU - LOSE THE GAME, YOUR KILL RATE IS BASED ON A MINIMUM OF - 5 STARDATES. - (7) YOU GET A BONUS IF YOU WIN THE GAME, BASED ON YOUR RATING: - NOVICE=100, FAIR=200, GOOD=300, EXPERT=400, EMERITUS=500. - - YOU LOSE-- - - (8) 200 POINTS IF YOU GET YOURSELF KILLED, - (9) 100 POINTS FOR EACH STARBASE YOU DESTROY, - (10) 100 POINTS FOR EACH STARSHIP YOU LOSE, - (11) 45 POINTS FOR EACH TIME YOU HAD TO CALL FOR HELP, - (12) 10 POINTS FOR EACH PLANET YOU DESTROYED, - (13) 5 POINTS FOR EACH STAR YOU DESTROYED, AND - (14) 1 POINT FOR EACH CASUALTY YOU INCURRED. - - IN ADDITION TO YOUR SCORE, YOU MAY ALSO BE PROMOTED ONE GRADE - IN RANK IF YOU PLAY WELL ENOUGH. PROMOTION IS BASED PRIMARILY ON - YOUR KLINGON/STARDATE KILL RATE, SINCE THIS IS THE BEST INDICATOR - OF WHETHER YOU ARE READY TO GO ON TO THE NEXT HIGHER RATING. - HOWEVER, IF YOU HAVE LOST 100 OR MORE POINTS IN PENALTIES, YOU - WILL NOT RECEIVE A PROMOTION. - - YOU CAN BE PROMOTED FROM ANY LEVEL. THERE IS A SPECIAL PROMOTION - AVAILABLE IF YOU GO BEYOND THE "EXPERT" RANGE. YOU CAN ALSO HAVE - A CERTIFICATE OF MERIT PRINTED WITH YOUR NAME, DATE, AND - KLINGON KILL RATE, PROVIDED YOU ARE PROMOTED FROM EITHER THE - "EXPERT" OR "EMERITUS" LEVELS. - - YOU SHOULD PROBABLY START OUT AT THE NOVICE LEVEL, EVEN IF YOU - ARE ALREADY FAMILIAR WITH ONE OF THE OTHER VERSIONS OF THE STAR TREK - GAME--BUT, OF COURSE, THE LEVEL OF GAME YOU PLAY IS UP TO YOU. IF - YOU WANT TO START AT THE EXPERT LEVEL, GO AHEAD. IT'S YOUR FUNERAL. - THE EMERITUS GAME IS STRICTLY FOR MASOCHISTS. - - 23 - - ----------MODIFICATIONS---------- - - - THE STAR TREK GAME IS SUPPORTED BY THE AUTHORS. FROM TIME TO - TIME, CORRECTIONS, MODIFICATIONS AND IMPROVEMENTS WILL BE MADE IN - THE GAME. THE DOCUMENTATION FOR THE GAME (WHICH YOU ARE READING - NOW) IS KEPT UP TO DATE, AND THE LATEST VERSION OF THE DOCUMENTATION - IS AVAILABLE BY EXECUTING THE CONTROL CARDS: - - EXECPF 1234 GAMES. - AND ENTERING "TRKINST" AS YOUR GAME. - - PLAYERS WHO ALREADY HAVE A COPY OF THE DOCUMENTATION CAN KEEP - ABREAST OF THE NEW MODIFICATIONS BY EXECUTING THE CONTROL CARDS: - - EXECPF 1234 GAMES. - AND ENTERING "TRKNEWS" AS YOUR GAME. - - CORRECTIONS AND MINOR MODIFICATIONS (THOSE WHICH HAVE LITTLE EFFECT - ON THE GAME) WILL NOT IN GENERAL BE REPORTED. - - CAVEAT: SINCE THE GAME IS CONTINUALLY BEING IMPROVED, IT IS - POSSIBLE THAT NEW REVISIONS WILL ALTER THE NATURE OF TOURNAMENT - GAMES OR WILL RENDER PREVIOUSLY FROZEN GAMES UNPLAYABLE. THE - AUTHORS WILL ATTEMPT TO AVOID SUCH OCCURRANCES WHEREVER POSSIBLE - AND TO MINIMIZE THE EFFECTS WHEN THEY DO OCCUR, BUT CANNOT MAKE - ANY GUARANTEES. - - 24 - ----------HANDY REFERENCE PAGE---------- - - ABBREV FULL COMMAND DEVICE USED - ------ ------------ ----------- - ABANDON ABANDON SHUTTLE CRAFT - C CHART (NONE) - CR CRYSTALS (NONE) - DA DAMAGES (NONE) - DEATHRAY DEATHRAY DEATHRAY - DESTRUCT DESTRUCT COMPUTER - D DOCK (NONE) - E EMEXIT (NONE) - FREEZE FREEZE (NONE) - G GAME (NONE) - HELP HELP SUBSPACE RADIO - I IMPULSE IMPULSE ENGINES - IMPULSE IMPULSE ENGINES AND COMPUTER - L LRSCAN LONG-RANGE SENSORS - MI MINE (NONE) - M MOVE WARP ENGINES - MOVE WARP ENGINES AND COMPUTER - O ORBIT WARP OR IMPULSE ENGINES - P PHASERS PHASERS AND COMPUTER - PHASERS AUTOMATIC PHASERS, COMPUTER, SR SENSORS - PHASERS MANUAL ... PHASERS - PHO PHOTONS TORPEDO TUBES - PL PLANETS (NONE) - REQ REQUEST (NONE) - R REST (NONE) - SE SENSORS SHORT-RANGE SENSORS - SH SHIELDS DEFLECTOR SHIELDS - SHU SHUTTLE SHUTTLE CRAFT - S SRSCAN SHORT-RANGE SENSORS - ST STATUS (NONE) - TERMINATE TERMINATE (NONE) - T TRANSPORT TRANSPORTER - W WARP (NONE) - L. R. SCAN: THOUSANDS DIGIT: SUPERNOVA - HUNDREDS DIGIT: KLINGONS - TENS DIGIT: STARBASES - ONES DIGIT: STARS - PERIOD (.): DIGIT NOT KNOWN (STAR CHART ONLY) - - COURSES ARE GIVEN IN MANUAL MODE IN X - Y DISPLACEMENTS; IN AUTOMATIC - MODE AS DESTINATION QUADRANT AND/OR SECTOR. MANUAL MODE IS DEFAULT. - DISTANCES ARE GIVEN IN QUADRANTS. A DISTANCE OF ONE SECTOR IS 0.1 QUADRANT. - ORDINARY KLINGONS HAVE ABOUT 400 UNITS OF ENERGY, COMMANDERS ABOUT - 1200. ROMULANS NORMALLY HAVE ABOUT 800 UNITS OF ENERGY, AND THE - (GULP) "SUPER-COMMANDER" HAS ABOUT 1800. - PHASER FIRE DIMINISHES TO ABOUT 60 PERCENT AT 5 SECTORS. UP TO 1500 - UNITS MAY BE FIRED IN A SINGLE BURST WITHOUT DANGER OF OVERHEAT. - WARP 6 IS THE FASTEST SAFE SPEED. AT HIGHER SPEEDS, ENGINE DAMAGE - MAY OCCUR. AT WARP 10 YOU MAY ENTER A TIME WARP. - SHIELDS COST 50 UNITS OF ENERGY TO RAISE, AND DOUBLE THE POWER - REQUIREMENTS OF MOVING UNDER WARP DRIVE. ENGAGING THE HIGH-SPEED - SHIELD CONTROL REQUIRES 200 UNITS OF ENERGY. - WARP DRIVE REQUIRES (DISTANCE)*(WARP FACTOR CUBED) UNITS OF ENERGY - TO TRAVEL AT A SPEED OF (WARP FACTOR SQUARED)/10 QUADRANTS PER STARDATE. - IMPULSE ENGINES REQUIRE 20 UNITS TO WARM UP, PLUS 100 UNITS PER - QUADRANT. SPEED IS JUST UNDER ONE SECTOR PER STARDATE. - - 25 - ----------ACKNOWLEDGMENTS---------- - - - THE AUTHORS WOULD LIKE TO THANK PROFESSOR MICHAEL DUGGAN FOR - HIS ENCOURAGEMENT AND ADMINISTRATIVE ASSISTANCE WITH THE DEVELOPMENT - OF THE STAR TREK GAME, WITHOUT WHICH IT MIGHT NEVER HAVE BEEN - COMPLETED. - - MUCH CREDIT IS DUE TO PATRICK MCGEHEARTY AND RICH COHEN, WHO - ASSISTED WITH THE ORIGINAL DESIGN OF THE GAME AND CONTRIBUTED - GREATLY TO ITS CONCEPTUAL DEVELOPMENT. - - THANKS ARE ALSO DUE TO CARL STRANGE, HARDY TICHENOR AND STEVEN - BRUELL FOR THEIR ASSISTANCE WITH CERTAIN CODING PROBLEMS. - - THIS GAME WAS INSPIRED BY AND RATHER LOOSELY BASED ON AN EARLIER - GAME, PROGRAMMED IN THE BASIC LANGUAGE, BY JIM KORP AND GRADY HICKS. - IT IS THE AUTHORS' UNDERSTANDING THAT THE BASIC GAME WAS IN TURN - DERIVED FROM A STILL EARLIER VERSION IN USE AT PENN STATE UNIVERSITY. - - - - - ----------REFERENCES---------- - - - 1. STAR TREK (THE ORIGINAL TELEVISION SERIES), PRODUCED AND - DIRECTED BY GENE RODENBERRY. - - 2. STAR TREK (THE ANIMATED TELEVISION SERIES), PRODUCED BY GENE - RODENBERRY AND DIRECTED BY HAL SUTHERLAND. ALSO EXCELLENT, - AND NOT JUST KIDDIE FARE. IF YOU ENJOYED THE ORIGINAL SERIES - YOU SHOULD ENJOY THIS ONE (UNLESS YOU HAVE SOME SORT OF A - HANGUP ABOUT WATCHING CARTOONS). - - 3. THE MAKING OF STAR TREK, BY STEVEN E. WHITFIELD AND GENE - RODENBERRY. THE BEST AND MOST COMPLETE READILY AVAILABLE - BOOK ABOUT STAR TREK. (BALLANTINE BOOKS) - - 4. THE WORLD OF STAR TREK, BY DAVID GERROLD. SIMILIAR IN SCOPE - TO THE ABOVE BOOK. (BANTAM) - - 5. THE STAR TREK GUIDE, THIRD REVISION 4/17/67, BY GENE - RODENBERRY. THE ORIGINAL WRITER'S GUIDE FOR THE TELEVISION - SERIES, BUT LESS COMPREHENSIVE THAN (3) ABOVE. - (NORWAY PRODUCTIONS) - - 6. THE TROUBLE WITH TRIBBLES, BY DAVID GERROLD. INCLUDES THE - COMPLETE SCRIPT OF THIS POPULAR SHOW. (BALLANTINE BOOKS) - - 7. STAR TREK, STAR TREK 2, ..., STAR TREK 9, BY JAMES BLISH. - THE ORIGINAL SHOWS IN SHORT STORY FORM. (BANTAM) - - 8. SPOCK MUST DIE, BY JAMES BLISH. AN ORIGINAL NOVEL, BUT - RATHER SIMILAR TO THE SHOW "THE ENEMY WITHIN". (BANTAM) - - 9. MODEL KITS OF THE ENTERPRISE AND A "KLINGON BATTLE-CRUISER" - BY AMT CORPORATION ARE AVAILABLE AT MOST HOBBY SHOPS. diff --git a/programs/games/StarTrek/trunk/Globals.Inc b/programs/games/StarTrek/trunk/Globals.Inc deleted file mode 100644 index 1ff71a3850..0000000000 --- a/programs/games/StarTrek/trunk/Globals.Inc +++ /dev/null @@ -1,182 +0,0 @@ -; -------------------------------------------------------------------------- -; Global variables -; -------------------------------------------------------------------------- - -glb_GameThreadBusy BOOL 1 -glb_Instance HINSTANCE 0 -glb_Allocator HANDLE 0 -glb_MainWnd HWND 0 -glb_Font HFONT 0 -glb_FPU_Int32 INT32 0 -glb_Score INT32 0 -glb_CharSize rb SIZE.size -glb_pConsole PTConsole 0 -glb_pCmdBuf PTCmdBuf 0 -glb_pRawMsgBuffer PCHAR 0 -glb_pMsgItems PPCHAR 0 -glb_NumMsgItems COUNT 0 -glb_pGameData PTGameData 0 -glb_pCommon PTCommon 0 -glb_pMersenne PTRandom 0 -glb_pLog PVOID 0 -glb_MOVED BYTE 0 -glb_LogEnabled BYTE 0 -glb_bEmExit BYTE 0 -glb_AttrCondition BYTE ATTR_COND_GREEN, ATTR_COND_RED, ATTR_COND_YELLOW, ATTR_COND_GREEN - -glb_ObjectMap BYTE CHAR_ROMULAN, CHAR_KLINGON, CHAR_COMMANDER, \ - CHAR_SCOM, CHAR_ASTERISK, CHAR_PLANET, CHAR_STARBASE, \ - CHAR_BLACK_HOLE, CHAR_THOLIAN - -glb_Plaque BYTE PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - 64,' ',50,'E',PLAQUE_END_OF_LINE,\ - 38,' ',3,'E',22,' ',PLAQUE_STRING,6,'E : :',41,' ',1,':',2,' ',1,'E',PLAQUE_END_OF_LINE,\ - 36,' ',2,'E',3,' ',3,'E',19,' ',PLAQUE_STRING,6,'E : :',19,' ',\ - PLAQUE_STRING,8,'NCC-1701',14,' ',PLAQUE_STRING,4,': E',PLAQUE_END_OF_LINE,\ - 20,' ',16,'E',8,' ',15,'E',4,' ',PLAQUE_STRING,6,'E : :',41,' ',PLAQUE_STRING,3,': E',\ - PLAQUE_END_OF_LINE,\ - 21,' ',1,'E',37,' ',1,'E',4,' ',48,'E',PLAQUE_END_OF_LINE,\ - 22,' ',9,'E',15,' ',13,'E',17,' ',PLAQUE_STRING,4,'E E',PLAQUE_END_OF_LINE,\ - 31,' ',7,'E',3,' ',5,'E',4,' ',1,'E',10,' ',1,'E',14,' ',PLAQUE_STRING,4,'E E',PLAQUE_END_OF_LINE,\ - 38,' ',3,'E',11,' ',1,'E',10,' ',1,'E',12,' ',PLAQUE_STRING,4,'E E',PLAQUE_END_OF_LINE,\ - 55,' ',1,'E',9,' ',1,'E',10,' ',PLAQUE_STRING,4,'E E',PLAQUE_END_OF_LINE,\ - 57,' ',13,'E',6,' ',PLAQUE_STRING,4,'E E',PLAQUE_END_OF_LINE,\ - 54,' ',3,'E',1,' ',1,':',11,' ',7,'E',2,' ',8,'E',PLAQUE_END_OF_LINE,\ - 52,' ',1,':',1,'E',4,' ',1,':',17,' ',4,'E',7,' ',1,'E',PLAQUE_END_OF_LINE,\ - 51,' ',PLAQUE_STRING,8,')-E -:',5,'-',23,' ',1,'E',PLAQUE_END_OF_LINE,\ - 52,' ',1,':',1,'E',4,' ',1,':',28,' ',1,'E',PLAQUE_END_OF_LINE,\ - 54,' ',2,'E',2,' ',1,':',20,' ',8,'E',PLAQUE_END_OF_LINE,\ - 56,' ',23,'E',PLAQUE_END_OF_LINE,\ - PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - 55,' ',PLAQUE_STRING,19,'U. S. S. ENTERPRISE',PLAQUE_END_OF_LINE,\ - PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - 34,' ',PLAQUE_STRING,43,'FOR DEMONSTRATING OUTSTANDING ABILITY AS A ',\ - PLAQUE_STRING,16,'STARSHIP CAPTAIN',PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - 48,' ',PLAQUE_STRING,32,'STARFLEET COMMAND BESTOWS TO YOU',PLAQUE_END_OF_LINE,\ - PLAQUE_END_OF_LINE,PLAQUE_INSERT_NAME,PLAQUE_END_OF_LINE,\ - 59,' ',PLAQUE_STRING,11,'THE RANK OF',PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - 55,' ',PLAQUE_STRING,20,'"COMMODORE EMERITUS"',PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - 58,' ',PLAQUE_INSERT_LEVEL,PLAQUE_STRING,6,' LEVEL',PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - 54,' ',PLAQUE_STRING,12,'THIS DAY OF ',PLAQUE_INSERT_DATE,PLAQUE_END_OF_LINE,\ - PLAQUE_END_OF_LINE,56,' ',PLAQUE_STRING,13,'YOUR SCORE: ',PLAQUE_INSERT_SCORE,\ - PLAQUE_END_OF_LINE,PLAQUE_END_OF_LINE,\ - 52,' ',PLAQUE_STRING,24,'KLINGONS PER STARDATE: ',PLAQUE_INSERT_KLRATE,\ - PLAQUE_END_OF_LINE,PLAQUE_END_OF_ALL - -align 2 -str_MainWndClass du 'SST32-FASM',0 -str_MainWndTitle du 'STAR TREK',0 -str_FontFace du 'Courier',0 -str_CharSizeText du 'Mj',0 -str_SetDirFailed du 'Unable to Set Current Directory. Please check permissions.',0 -str_MsgFileName du 'MsgTable.txt',0 -str_LogFileName du 'STARTREK.LOG',0 -str_FileMask du '*.TRK',0 -str_THOLIANX db 'THOLIANX',0 -str_TRK db '.TRK',0 -str_CmdListGames db '?.TRK',0 -str_EmSaveGame db 'EMSAVE.TRK',0 -str_PlaqueFile db 'PLAQUE.TXT',0 - -align 16 -glb_dbl_2e31 DOUBLE 2147483648.0 -glb_dbl_2e32 DOUBLE 4294967296.0 -glb_dbl_Ten DOUBLE 10.0 -glb_dbl_FpuPopper DOUBLE 0.0 -glb_dbl_0dot0625 DOUBLE 0.0625 -glb_dbl_0dot08 DOUBLE 0.08 -glb_dbl_0dot095 DOUBLE 0.095 -glb_dbl_0dot1 DOUBLE 0.1 -glb_dbl_0dot01 DOUBLE 0.01 -glb_dbl_0dot001 DOUBLE 0.001 -glb_dbl_0dot2 DOUBLE 0.2 -glb_dbl_0dot02 DOUBLE 0.02 -glb_dbl_0dot00001 DOUBLE 0.00001 -glb_dbl_0dot2777 DOUBLE 0.2777 -glb_dbl_0dot1777777777 DOUBLE 0.1777777777 -glb_dbl_0dot15 DOUBLE 0.15 -glb_dbl_0dot015 DOUBLE 0.015 -glb_dbl_0dot5 DOUBLE 0.5 -glb_dbl_0dot5235998 DOUBLE 0.5235998 -glb_dbl_0dot5235988 DOUBLE 0.5235988 -glb_dbl_0dot3 DOUBLE 0.3 -glb_dbl_0dot03 DOUBLE 0.03 -glb_dbl_0dot333 DOUBLE 0.3333333333 -glb_dbl_1dot5 DOUBLE 1.5 -glb_dbl_10dot5 DOUBLE 10.5 -glb_dbl_2dot5 DOUBLE 2.5 -glb_dbl_1dot2 DOUBLE 1.2 -glb_dbl_1dot23 DOUBLE 1.23 -glb_dbl_1dot4142 DOUBLE 1.4142 -glb_dbl_1dot57079633 DOUBLE 1.57079633 -glb_dbl_1dot01 DOUBLE 1.01 -glb_dbl_1dot90985932 DOUBLE 1.90985932 -glb_dbl_0dot04 DOUBLE 0.04 -glb_dbl_0dot4 DOUBLE 0.4 -glb_dbl_0dot45 DOUBLE 0.45 -glb_dbl_0dot49 DOUBLE 0.49 -glb_dbl_0dot05 DOUBLE 0.05 -glb_dbl_0dot005 DOUBLE 0.005 -glb_dbl_0dot00038 DOUBLE 0.00038 -glb_dbl_0dot006 DOUBLE 0.006 -glb_dbl_0dot75 DOUBLE 0.75 -glb_dbl_0dot77 DOUBLE 0.77 -glb_dbl_0dot65 DOUBLE 0.65 -glb_dbl_0dot6 DOUBLE 0.6 -glb_dbl_0dot89 DOUBLE 0.89 -glb_dbl_0dot8 DOUBLE 0.8 -glb_dbl_0dot9 DOUBLE 0.9 -glb_dbl_0dot99 DOUBLE 0.99 -glb_dbl_9dot99 DOUBLE 9.99 -glb_dbl_0dot98 DOUBLE 0.98 -glb_dbl_0dot995 DOUBLE 0.995 -glb_dbl_DOCKFAC DOUBLE 0.25 -glb_dbl_100 DOUBLE 100.0 -glb_dbl_200 DOUBLE 200.0 -glb_dbl_270 DOUBLE 270.0 -glb_dbl_66dot666 DOUBLE 66.666666666 -glb_dbl_2 DOUBLE 2.0 -glb_dbl_20 DOUBLE 20.0 -glb_dbl_3 DOUBLE 3.0 -glb_dbl_31 DOUBLE 31.0 -glb_dbl_39dot95 DOUBLE 39.95 -glb_dbl_4 DOUBLE 4.0 -glb_dbl_4dot5 DOUBLE 4.5 -glb_dbl_5 DOUBLE 5.0 -glb_dbl_6 DOUBLE 6.0 -glb_dbl_8 DOUBLE 8.0 -glb_dbl_25 DOUBLE 25.0 -glb_dbl_125 DOUBLE 125.0 -glb_dbl_50 DOUBLE 50.0 -glb_dbl_150 DOUBLE 150.0 -glb_dbl_950 DOUBLE 950.0 -glb_dbl_7 DOUBLE 7.0 -glb_dbl_7dot5 DOUBLE 7.5 -glb_dbl_9 DOUBLE 9.0 -glb_dbl_7dot853981634 DOUBLE 7.853981634 -glb_dbl_15 DOUBLE 15.0 -glb_dbl_12 DOUBLE 12.0 -glb_dbl_1175 DOUBLE 1175.0 -glb_dbl_75 DOUBLE 75.0 -glb_dbl_300 DOUBLE 300.0 -glb_dbl_30 DOUBLE 30.0 -glb_dbl_3000 DOUBLE 3000.0 -glb_dbl_400 DOUBLE 400.0 -glb_dbl_500 DOUBLE 500.0 -glb_dbl_600 DOUBLE 600.0 -glb_dbl_700 DOUBLE 700.0 -glb_dbl_800 DOUBLE 800.0 -glb_dbl_7200 DOUBLE 7200.0 -glb_dbl_450 DOUBLE 450.0 -glb_dbl_1000 DOUBLE 1000.0 -glb_dbl_5000 DOUBLE 5000.0 -glb_dbl_2500 DOUBLE 2500.0 -glb_dbl_1400 DOUBLE 1400.0 -glb_dbl_1500 DOUBLE 1500.0 -glb_dbl_1250 DOUBLE 1250.0 -glb_dbl_1E38 DOUBLE 1e38 -glb_dbl_3E_neg_5 DOUBLE 3e-5 -glb_dbl_KlingonsPerDate DOUBLE 0.0 - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/Imports.Inc b/programs/games/StarTrek/trunk/Imports.Inc deleted file mode 100644 index ddcfbe2153..0000000000 --- a/programs/games/StarTrek/trunk/Imports.Inc +++ /dev/null @@ -1,680 +0,0 @@ - -; Import Section - - dd 0, 0, 0, RVA kernel32, RVA kernel32tbl - dd 0, 0, 0, RVA user32, RVA user32tbl - dd 0, 0, 0, RVA gdi32, RVA gdi32tbl - dd 0, 0, 0, 0, 0 - -kernel32tbl: -;{W32} - GetLocalTime dd RVA _GetLocalTime -;{W32} - SetFilePointer dd RVA _SetFilePointer -;{W32} - GetFileAttributes dd RVA _GetFileAttributes -;{W32} - SetCurrentDir dd RVA _SetCurrentDir -;{W32} - GetConsoleScrBufInfo dd RVA _GetConsoleScrBufInfo -;{W32} - GetConsoleMode dd RVA _GetConsoleMode -;{W32} - GetStdHandle dd RVA _GetStdHandle -;{W32} - FreeConsole dd RVA _FreeConsole -;{W32} - AllocConsole dd RVA _AllocConsole -;{W32} - CreateThread dd RVA _CreateThread -;{W32} - Sleep dd RVA _Sleep -;{W32} - MulDiv dd RVA _MulDiv -;{W32} - VirtualFree dd RVA _VirtualFree -;{W32} - VirtualAlloc dd RVA _VirtualAlloc -;{W32} - GetFileSize dd RVA _GetFileSize -;{W32} - WriteFile dd RVA _WriteFile -;{W32} - ReadFile dd RVA _ReadFile -;{W32} - CloseHandle dd RVA _CloseHandle -;{W32} - CreateFile dd RVA _CreateFile -;{W32} - CreateFileAnsi dd RVA _CreateFileAnsi -;{W32} - GetTickCount dd RVA _GetTickCount -;{W32} - FindClose dd RVA _FindClose -;{W32} - FindNextFile dd RVA _FindNextFile -;{W32} - FindFirstFile dd RVA _FindFirstFile -;{W32} - GetProcessHeap dd RVA _GetProcessHeap -;{W32} - GetModuleFileName dd RVA _GetModuleFileName -;{W32} - OutputDebugString dd RVA _OutputDebugString -;{W32} - HeapCreate dd RVA _HeapCreate -;{W32} - HeapAlloc dd RVA _HeapAlloc -;{W32} - HeapReAlloc dd RVA _HeapReAlloc -;{W32} - HeapFree dd RVA _HeapFree -;{W32} - HeapDestroy dd RVA _HeapDestroy -;{W32} - GetModuleHandle dd RVA _GetModuleHandle -;{W32} - ExitProcess dd RVA _ExitProcess - dd 0 - -user32tbl: -;{W32} - OffsetRect dd RVA _OffsetRect -;{W32} - AdjustWindowRect dd RVA _AdjustWindowRect -;{W32} - MessageBeep dd RVA _MessageBeep -;{W32} - GetCursorPos dd RVA _GetCursorPos -;{W32} - TrackPopupMenu dd RVA _TrackPopupMenu -;{W32} - AppendMenu dd RVA _AppendMenu -;{W32} - DestroyMenu dd RVA _DestroyMenu -;{W32} - CreatePopupMenu dd RVA _CreatePopupMenu -;{W32} - GetFocus dd RVA _GetFocus -;{W32} - GetWindowTextLen dd RVA _GetWindowTextLen -;{W32} - GetWindowText dd RVA _GetWindowText -;{W32} - GetDlgItem dd RVA _GetDlgItem -;{W32} - PostMessage dd RVA _PostMessage -;{W32} - SendMessage dd RVA _SendMessage -;{W32} - InflateRect dd RVA _InflateRect -;{W32} - EndDialog dd RVA _EndDialog -;{W32} - DlgBoxParam dd RVA _DlgBoxParam -;{W32} - GetSystemMetrics dd RVA _GetSystemMetrics -;{W32} - DrawIcon dd RVA _DrawIcon -;{W32} - DrawText dd RVA _DrawText -;{W32} - ReleaseCapture dd RVA _ReleaseCapture -;{W32} - SetCapture dd RVA _SetCapture -;{W32} - SetWindowText dd RVA _SetWindowText -;{W32} - SetCursor dd RVA _SetCursor -;{W32} - ReleaseDC dd RVA _ReleaseDC -;{W32} - GetDC dd RVA _GetDC -;{W32} - FrameRect dd RVA _FrameRect -;{W32} - FillRect dd RVA _FillRect -;{W32} - EndPaint dd RVA _EndPaint -;{W32} - BeginPaint dd RVA _BeginPaint -;{W32} - UpdateWindow dd RVA _UpdateWindow -;{W32} - PostQuitMessage dd RVA _PostQuitMessage -;{W32} - LoadBitmap dd RVA _LoadBitmap -;{W32} - LoadImage dd RVA _LoadImage -;{W32} - LoadIcon dd RVA _LoadIcon -;{W32} - LoadCursor dd RVA _LoadCursor -;{W32} - GetWindowRect dd RVA _GetWindowRect -;{W32} - GetClientRect dd RVA _GetClientRect -;{W32} - ShowWindow dd RVA _ShowWindow -;{W32} - CreateWindowEx dd RVA _CreateWindowEx -;{W32} - DefWindowProc dd RVA _DefWindowProc -;{W32} - RegisterClass dd RVA _RegisterClass -;{W32} - GetClassInfo dd RVA _GetClassInfo -;{W32} - SetWindowLong dd RVA _SetWindowLong -;{W32} - GetWindowLong dd RVA _GetWindowLong -;{W32} - GetMessage dd RVA _GetMessage -;{W32} - DispatchMessage dd RVA _DispatchMessage -;{W32} - TranslateMessage dd RVA _TranslateMessage -;{W32} - TranslateAccelerator dd RVA _TranslateAccelerator -;{W32} - CreateAcceleratorTable dd RVA _CreateAcceleratorTable -;{W32} - InvalidateRect dd RVA _InvalidateRect -;{W32} - MoveWindow dd RVA _MoveWindow -;{W32} - IsWindowVisible dd RVA _IsWindowVisible -;{W32} - MessageBox dd RVA _MessageBox - dd 0 - -gdi32tbl: -;{W32} - TextOut dd RVA _TextOut -;{W32} - MoveToEx dd RVA _MoveToEx -;{W32} - SetTextAlign dd RVA _SetTextAlign -;{W32} - BitBlt dd RVA _BitBlt -;{W32} - CreateCompatibleBitmap dd RVA _CreateCompatibleBitmap -;{W32} - DeleteDC dd RVA _DeleteDC -;{W32} - SetTextColor dd RVA _SetTextColor -;{W32} - CreatePatternBrush dd RVA _CreatePatternBrush -;{W32} - GetStockObject dd RVA _GetStockObject -;{W32} - CreatePen dd RVA _CreatePen -;{W32} - Polyline dd RVA _Polyline -;{W32} - CreateSolidBrush dd RVA _CreateSolidBrush -;{W32} - DeleteObject dd RVA _DeleteObject -;{W32} - CreateFontIndirect dd RVA _CreateFontIndirect -;{W32} - GetDeviceCaps dd RVA _GetDeviceCaps -;{W32} - GetTextExtentPoint32 dd RVA _GetTextExtentPoint32 -;{W32} - SetBkMode dd RVA _SetBkMode -;{W32} - SelectObject dd RVA _SelectObject -;{W32} - CreateCompatibleDC dd RVA _CreateCompatibleDC - dd 0 - -; --- Modules - -kernel32 db 'KERNEL32.DLL', 0 -user32 db 'USER32.DLL', 0 -gdi32 db 'GDI32.DLL', 0 - -; --- Table - -align 2 -_GetLocalTime dw 0 -db 'GetLocalTime',0 - -align 2 -_SetFilePointer dw 0 -db 'SetFilePointer',0 - -align 2 -_GetFileAttributes dw 0 -db 'GetFileAttributesA',0 - -align 2 -_SetCurrentDir dw 0 -db 'SetCurrentDirectoryW',0 - -align 2 -_OffsetRect dw 0 -db 'OffsetRect',0 - -align 2 -_GetConsoleScrBufInfo dw 0 -db 'GetConsoleScreenBufferInfo',0 - -align 2 -_GetConsoleMode dw 0 -db 'GetConsoleMode',0 - -align 2 -_FreeConsole dw 0 -db 'FreeConsole',0 - -align 2 -_GetStdHandle dw 0 -db 'GetStdHandle',0 - -align 2 -_AllocConsole dw 0 -db 'AllocConsole',0 - -align 2 -_CreateThread dw 0 -db 'CreateThread',0 - -align 2 -_Sleep dw 0 -db 'Sleep',0 - -align 2 -_AdjustWindowRect dw 0 -db 'AdjustWindowRect',0 - -align 2 -_MessageBeep dw 0 -db 'MessageBeep',0 - -align 2 -_TextOut dw 0 -db 'TextOutW',0 - -align 2 -_MoveToEx dw 0 -db 'MoveToEx',0 - -align 2 -_SetTextAlign dw 0 -db 'SetTextAlign',0 - -align 2 -_BitBlt dw 0 -db 'BitBlt',0 - -align 2 -_CreateCompatibleBitmap dw 0 -db 'CreateCompatibleBitmap',0 - -align 2 -_DeleteDC dw 0 -db 'DeleteDC',0 - -align 2 -_MulDiv dw 0 -db 'MulDiv',0 - -align 2 -_GetCursorPos dw 0 -db 'GetCursorPos',0 - -align 2 -_TrackPopupMenu dw 0 -db 'TrackPopupMenu',0 - -align 2 -_AppendMenu dw 0 -db 'AppendMenuW',0 - -align 2 -_DestroyMenu dw 0 -db 'DestroyMenu',0 - -align 2 -_CreatePopupMenu dw 0 -db 'CreatePopupMenu',0 - -align 2 -_GetFocus dw 0 -db 'GetFocus',0 - -align 2 -_SetTextColor dw 0 -db 'SetTextColor',0 - -align 2 -_GetWindowTextLen dw 0 -db 'GetWindowTextLengthW',0 - -align 2 -_GetWindowText dw 0 -db 'GetWindowTextW',0 - -align 2 -_CreatePatternBrush dw 0 -db 'CreatePatternBrush',0 - -align 2 -_GetDlgItem dw 0 -db 'GetDlgItem',0 - -align 2 -_VirtualFree dw 0 -db 'VirtualFree',0 - -align 2 -_VirtualAlloc dw 0 -db 'VirtualAlloc',0 - -align 2 -_ImageList_AddMasked dw 0 -db 'ImageList_AddMasked',0 - -align 2 -_ImageList_Create dw 0 -db 'ImageList_Create',0 - -align 2 -_PostMessage dw 0 -db 'PostMessageW',0 - -align 2 -_SendMessage dw 0 -db 'SendMessageW',0 - -align 2 -_GetFileSize dw 0 -db 'GetFileSize',0 - -align 2 -_WriteFile dw 0 -db 'WriteFile',0 - -align 2 -_ReadFile dw 0 -db 'ReadFile',0 - -align 2 -_CloseHandle dw 0 -db 'CloseHandle',0 - -align 2 -_CreateFile dw 0 -db 'CreateFileW',0 - -align 2 -_CreateFileAnsi dw 0 -db 'CreateFileA',0 - -align 2 -_InflateRect dw 0 -db 'InflateRect',0 - -align 2 -_EndDialog dw 0 -db 'EndDialog',0 - -align 2 -_DlgBoxParam dw 0 -db 'DialogBoxIndirectParamW',0 - -align 2 -_GetSystemMetrics dw 0 -db 'GetSystemMetrics',0 - -align 2 -_GetStockObject dw 0 -db 'GetStockObject',0 - -align 2 -_GetTickCount dw 0 -db 'GetTickCount',0 - -align 2 -_FindClose dw 0 -db 'FindClose',0 - -align 2 -_FindNextFile dw 0 -db 'FindNextFileW',0 - -align 2 -_FindFirstFile dw 0 -db 'FindFirstFileW',0 - -align 2 -_DrawText dw 0 -db 'DrawTextW',0 - -align 2 -_DrawIcon dw 0 -db 'DrawIcon',0 - -align 2 -_CreatePen dw 0 -db 'CreatePen',0 - -align 2 -_Polyline dw 0 -db 'Polyline',0 - -align 2 -_CreateSolidBrush dw 0 -db 'CreateSolidBrush',0 - -align 2 -_DeleteObject dw 0 -db 'DeleteObject',0 - -align 2 -_SetCapture dw 0 -db 'SetCapture',0 - -align 2 -_ReleaseCapture dw 0 -db 'ReleaseCapture',0 - -align 2 -_SetWindowText dw 0 -db 'SetWindowTextW',0 - -align 2 -_InitCommonControlsEx dw 0 -db 'InitCommonControlsEx',0 - -align 2 -_SetCursor dw 0 -db 'SetCursor',0 - -align 2 -_GetProcessHeap dw 0 -db 'GetProcessHeap',0 - -align 2 -_CreateFontIndirect dw 0 -db 'CreateFontIndirectW',0 - -align 2 -_GetDeviceCaps dw 0 -db 'GetDeviceCaps',0 - -align 2 -_ReleaseDC dw 0 -db 'ReleaseDC',0 - -align 2 -_GetDC dw 0 -db 'GetDC',0 - -align 2 -_GetTextExtentPoint32 dw 0 -db 'GetTextExtentPoint32W',0 - -align 2 -_GetModuleFileName dw 0 -db 'GetModuleFileNameW',0 - -align 2 -_FrameRect dw 0 -db 'FrameRect',0 - -align 2 -_FillRect dw 0 -db 'FillRect',0 - -align 2 -_SetBkMode dw 0 -db 'SetBkMode',0 - -align 2 -_EndPaint dw 0 -db 'EndPaint',0 - -align 2 -_BeginPaint dw 0 -db 'BeginPaint',0 - -align 2 -_SelectObject dw 0 -db 'SelectObject',0 - -align 2 -_OutputDebugString dw 0 -db 'OutputDebugStringW',0 - -align 2 -_HeapCreate dw 0 -db 'HeapCreate',0 - -align 2 -_HeapAlloc dw 0 -db 'HeapAlloc',0 - -align 2 -_HeapReAlloc dw 0 -db 'HeapReAlloc',0 - -align 2 -_HeapFree dw 0 -db 'HeapFree',0 - -align 2 -_HeapDestroy dw 0 -db 'HeapDestroy',0 - -align 2 -_IsWindowVisible dw 0 -db 'IsWindowVisible',0 - -align 2 -_MoveWindow dw 0 -db 'MoveWindow',0 - -align 2 -_InvalidateRect dw 0 -db 'InvalidateRect',0 - -align 2 -_UpdateWindow dw 0 -db 'UpdateWindow',0 - -align 2 -_CreateAcceleratorTable dw 0 -db 'CreateAcceleratorTableW',0 - -align 2 -_TranslateAccelerator dw 0 -db 'TranslateAccelerator',0 - -align 2 -_TranslateMessage dw 0 -db 'TranslateMessage',0 - -align 2 -_DispatchMessage dw 0 -db 'DispatchMessageW',0 - -align 2 -_GetMessage dw 0 -db 'GetMessageW',0 - -align 2 -_PostQuitMessage dw 0 -db 'PostQuitMessage',0 - -align 2 -_LoadBitmap dw 0 -db 'LoadBitmapW',0 - -align 2 -_LoadImage dw 0 -db 'LoadImageW',0 - -align 2 -_LoadIcon dw 0 -db 'LoadIconW',0 - -align 2 -_LoadCursor dw 0 -db 'LoadCursorW',0 - -align 2 -_GetWindowRect dw 0 -db 'GetWindowRect',0 - -align 2 -_GetClientRect dw 0 -db 'GetClientRect',0 - -align 2 -_ShowWindow dw 0 -db 'ShowWindow',0 - -align 2 -_CreateWindowEx dw 0 -db 'CreateWindowExW',0 - -align 2 -_DefWindowProc dw 0 -db 'DefWindowProcW',0 - -align 2 -_RegisterClass dw 0 -db 'RegisterClassW',0 - -align 2 -_GetClassInfo dw 0 -db 'GetClassInfoW',0 - -align 2 -_SetWindowLong dw 0 -db 'SetWindowLongW',0 - -align 2 -_GetWindowLong dw 0 -db 'GetWindowLongW',0 - -align 2 -_GetModuleHandle dw 0 -db 'GetModuleHandleW',0 - -align 2 -_CreateCompatibleDC dw 0 -db 'CreateCompatibleDC',0 - -align 2 -_ExitProcess dw 0 -db 'ExitProcess',0 - -align 2 -_MessageBox dw 0 -db 'MessageBoxW',0 - -; diff --git a/programs/games/StarTrek/trunk/MAIN.ASM b/programs/games/StarTrek/trunk/MAIN.ASM deleted file mode 100644 index ee150c757a..0000000000 --- a/programs/games/StarTrek/trunk/MAIN.ASM +++ /dev/null @@ -1,98 +0,0 @@ -; -------------------------------------------------------------------------- -; Win32 PE File Template -; {BINEXT=EXE} (Do not edit or remove this line) -; -------------------------------------------------------------------------- - -; ********************************************************************* -; * PERMISSION IS HEREBY GRANTED FOR THE COPYING, * -; * DISTRIBUTION, MODIFICATION AND USE OF THIS PROGRAM AND * -; * ASSOCIATED DOCUMENTATION FOR RECREATIONAL PURPOSES, * -; * PROVIDED THAT ALL REFERENCES TO THE AUTHOR ARE RETAINED. * -; * HOWEVER, PERMISSION IS NOT AND WILL NOT BE GRANTED FOR * -; * THE SALE OR PROMOTIONAL USE OF THIS PROGRAM OR PROGRAM * -; * DOCUMENTATION, OR FOR USE IN ANY SITUATION IN WHICH * -; * PROFIT MAY BE CONSIDERED AN OBJECTIVE, SINCE IT IS THE * -; * DESIRE OF THE AUTHOR TO RESPECT THE COPYRIGHTS OF THE * -; * ORIGINATORS OF STAR TREK. * -; ********************************************************************* - - format PE GUI 4.0 - entry start - stack 10000h, 10000h - -; -------------------------------------------------------------------------- -; Definitions -; -------------------------------------------------------------------------- - - include 'Macros.Inc' - include 'Win32.Inc' - include 'TConsole.Inc' - include 'TCmdBuf.Inc' - include 'TCommon.Inc' - include 'TRandom.Inc' - include 'TLog.Inc' - ;{INCLDEF} (Definitions will be inserted before this line) - - PROC_ALIGN equ 8 - -; -------------------------------------------------------------------------- -; Data Section -; -------------------------------------------------------------------------- -section '.data' data readable writeable - - include 'Globals.Inc' - -; -------------------------------------------------------------------------- -; Code Modules -; -------------------------------------------------------------------------- -section '.code' code readable executable - - include 'TApp.Asm' - include 'TConsole.Asm' - include 'TString.Asm' - include 'TCmdBuf.Asm' - include 'TGame.Asm' - include 'TMsgTable.Asm' - include 'TCommon.Asm' - include 'TRandom.Asm' - include 'TArray.Asm' - include 'TFormat.Asm' - include 'TSrScan.Asm' - include 'TLrScan.Asm' - include 'TChart.Asm' - include 'TMove.Asm' - include 'TFinish.Asm' - include 'TAttack.Asm' - include 'TEvents.Asm' - include 'TNova.Asm' - include 'TPhasers.Asm' - include 'TShields.Asm' - include 'TDock.Asm' - include 'TPhotons.Asm' - include 'TPlanet.Asm' - include 'TImpulse.Asm' - include 'TLog.Asm' - ;{INCLIMPL} (Code modules will be inserted before this line) - -; -------------------------------------------------------------------------- -; Entry Point -; -------------------------------------------------------------------------- -align PROC_ALIGN -start: - call TApp_SetLocalDir - jnc .exit - - call TApp_Init - call TApp_Run - -.exit: - invoke ExitProcess, 0 - -; -------------------------------------------------------------------------- -; Imports -; -------------------------------------------------------------------------- -section '.idata' import data readable writeable - - include 'Imports.Inc' - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/Macros.Inc b/programs/games/StarTrek/trunk/Macros.Inc deleted file mode 100644 index 1e881d3f3d..0000000000 --- a/programs/games/StarTrek/trunk/Macros.Inc +++ /dev/null @@ -1,292 +0,0 @@ - -_DEBUG = 1 - -; --- Parameters inside WndProc - -hWnd equ [ebp + 8] -uiMsg equ [ebp + 12] -WParam equ [ebp + 16] -LParam equ [ebp + 20] - -; --- Splitting WndProc parameters - -macro mcLPtoXY LParam { - ; OUT: EDX = Y coordinate or HEIGHT - ; OUT: EAX = X coordinate or WIDTH - mov eax, LParam - mov edx, LParam - and eax, 0000FFFFh - shr edx, 16 -} - -; --- String operation (WCHAR) - -macro mcStrCopy { - xor eax, eax -@@: - lodsw - stosw - test eax, eax - jnz @r -} - -; --- Indirectly call STDCALL procedure - -macro invoke api_proc, [arg] -{ - common - if ~ arg eq - reverse - pushd arg - common - end if - call [api_proc] -} - -macro rinvoke api_proc_reg, [arg] -{ - common - if ~ arg eq - reverse - pushd arg - common - end if - call api_proc_reg -} - -; --- FPU - -macro mcFpuPushR32 r32 -{ - mov [glb_FPU_Int32], r32 - fild [glb_FPU_Int32] -} - -macro mcFpuPop -{ - fstp [glb_dbl_FpuPopper] -} - -; --- Heap allocator - -macro mcMemAlloc hHeap, nBytes { - invoke HeapAlloc, hHeap, HEAP_NO_SERIALIZE, nBytes -} - -macro mcMemFree hHeap, pBuf { - invoke HeapFree, hHeap, HEAP_NO_SERIALIZE, pBuf -} - -macro mcGlobalMalloc nBytes { - mcMemAlloc [glb_HAllocator], nBytes -} - -macro mcGlobalFree pBuf { - mcMemFree [glb_HAllocator], pBuf -} - -; --- Page allocator - -macro mcAllocatePages nBytes { - invoke VirtualAlloc, 0, nBytes, \ - MEM_RESERVE or MEM_COMMIT, \ - PAGE_READWRITE -} - -macro mcReleasePages pData { - invoke VirtualFree, pData, 0, MEM_RELEASE -} - -; --- Local variables - -macro mcLoadLocalRef AnyReg, instance { - lea AnyReg, [esp + instance] -} - -macro mcLoadLocal AnyReg, instance { - mov AnyReg, [esp + instance] -} - -macro mcStoreThis { - mov [esp], ebx -} - -macro mcLoadThis { - mov ebx, [esp] -} - -macro mcStoreLocal instance, AnyReg { - mov [esp + instance], AnyReg -} - -macro mcBeginLocals LocalSize { - sub esp, LocalSize -} - -macro mcEndLocals LocalSize { - add esp, LocalSize -} - -; --- Virtual call on the object instance - -macro mcVirtCallOnEBX OfsMethod { - mov eax, [ebx] - call dword [eax + OfsMethod] -} - -macro mcVirtCall Instance, OfsMethod { - lea ebx, [Instance] - mov eax, [ebx] - call dword [eax + OfsMethod] -} - -; --- CALLBACK - -macro mcProlog { - push ebp - mov ebp, esp - push ebx - push esi - push edi -} - -macro mcEpilog { - pop edi - pop esi - pop ebx - leave -} - -; --- Misc... - -macro mc_CMP_ST0_ST1 -{ - fcomip st, st1 - fstp [glb_dbl_FpuPopper] -} - -macro mcLoadQuadStatePtr r32 -{ - mov r32, [glb_pGameState] - add r32, TGameState.game_QuadState -} - -macro mcLoadNeg1 r32 -{ - mcZeroBits r32 - dec r32 -} - -macro mcLoad8bitsToReg32 r32, _8bit_value -{ - push _8bit_value - pop r32 -} - -macro mcLoad1 r32 -{ - mcZeroBits r32 - inc r32 -} - -; ESI = source -; EDI = destination -macro mcMemCopy nBytesAligned4 -{ - mov ecx, nBytesAligned4 - shr ecx, 2 - rep movsd -} - -macro mcMul10 r32 { - push esi - shl r32, 1 - push r32 - shl r32, 2 - pop esi - add r32, esi - pop esi -} - -macro mcZeroBits any_reg { - xor any_reg, any_reg -} - -macro mcLoadRGB reg32, r8, g8, b8 { - mov reg32, (b8 shl 16) or (g8 shl 8) or r8 -} - -; --- Rectangle - -macro mcRectCopy { - ; ESI = source rectangle - ; EDI = target rectangle - movsd - movsd - movsd - movsd -} - -macro mcRectCopySafe { - ; ESI = source rectangle - ; EDI = target rectangle - push esi - movsd - movsd - movsd - movsd - pop esi -} - -macro mcRectWidth r32, pRect { - mov r32, [pRect + RECT.rc_Right] - sub r32, [pRect + RECT.rc_Left] -} - -macro mcRectHeight r32, pRect { - mov r32, [pRect + RECT.rc_Bottom] - sub r32, [pRect + RECT.rc_Top] -} - -; --- Branching - -macro mcOnRegEqu AnyReg, AnyValue, AnyLabel { - cmp AnyReg, AnyValue - je AnyLabel -} - -macro mcOnRegNotEqu AnyReg, AnyValue, AnyLabel { - cmp AnyReg, AnyValue - jne AnyLabel -} - -macro mcOnRegZero AnyReg, AnyLabel { - test AnyReg, AnyReg - jz AnyLabel -} - -macro mcOnRegNotZero AnyReg, AnyLabel { - test AnyReg, AnyReg - jnz AnyLabel -} - -; --- OOP - -macro mcLoadMemberRef AnyReg, instance { - lea AnyReg, [ebx + instance] -} - -macro mcLoadMember AnyReg, instance { - mov AnyReg, [ebx + instance] -} - -macro mcStoreMember instance, AnyReg { - mov [ebx + instance], AnyReg -} - -macro mcAttachVTable addrvtbl { - mov eax, addrvtbl - mov [ebx], eax -} - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TApp.Asm b/programs/games/StarTrek/trunk/TApp.Asm deleted file mode 100644 index 03e14ef4b8..0000000000 --- a/programs/games/StarTrek/trunk/TApp.Asm +++ /dev/null @@ -1,770 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TApp.Asm -; DATE: September 21, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; DESTRCT -; -------------------------------------------------------------------------- -virtual at 0 -loc84: - .nCountDown COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_SelfDestruct: - mcBeginLocals loc84.size - - mov cl, DEV_COMPUTER - call TArray_IsDamaged - jnc .L5 - - call TConsole_ScrollUp - mov ecx, 686 - call TConsole_ProutGameMsg - call TConsole_ScrollUp - jmp .done - -.L5: - call TConsole_ScrollUp - mov ecx, 290 - call TConsole_ProutGameMsg - mov ecx, 687 - call TConsole_Prout - inc ecx - call TConsole_Prout - call TConsole_ScrollUp - - mcLoad8bitsToReg32 ecx, 10 - mcStoreLocal loc84.nCountDown, ecx - -.pre_sequence: - mov ecx, 694 - call TConsole_Cram - mcLoadLocal eax, loc84.nCountDown - call TConsole_CramInt - call TConsole_RefreshCaretLine - invoke Sleep, 1000 - - dec [esp + loc84.nCountDown] - cmp [esp + loc84.nCountDown], 6 - jae .pre_sequence - - call TConsole_ScrollUp - call TConsole_ScrollUp - - mov cl, ATTR_PROMPT_TEXT - call TConsole_SetAttr - - mov ecx, 689 - call TConsole_Prout - inc ecx - call TConsole_Prout - inc ecx - call TGame_Prompt - call TConsole_ScrollUp - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .password_rejected - - mcLoadGameDataPtr edi - add edi, TREKDATA.PASSWD - call TString_AnsiEqual - jnc .password_rejected - - mov ecx, 692 - call TConsole_ProutGameMsg - mov cl, 22 - call TConsole_RepeatBlank - -.final_sequence: - mov ecx, 694 - call TConsole_Cram - mcLoadLocal eax, loc84.nCountDown - call TConsole_CramInt - call TConsole_RefreshCaretLine - invoke Sleep, 1000 - - dec [esp + loc84.nCountDown] - jnz .final_sequence - - call TConsole_ScrollUp - - fld [glb_dbl_0dot05] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jnc .everyone_wasted - - mov ecx, 693 - call TConsole_ProutGameMsg - invoke Sleep, 1000 - -.everyone_wasted: - call TConsole_ScrollUp - call TConsole_ScrollUp - call TPlanet_KaBoom - jmp .done - -.password_rejected: - mov ecx, 695 - call TConsole_ProutGameMsg - inc ecx - call TConsole_Prout - call TConsole_ScrollUp - call TConsole_ScrollUp - -.done: - mcEndLocals loc84.size - ret - -; -------------------------------------------------------------------------- -; PLAQUE -; -------------------------------------------------------------------------- -virtual at 0 -loc112: - .pNextInByte PCHAR ? - .pNextOutByte PCHAR ? - .bufAnsiValue CHARS 16 - .bufAnsiKirkAlias CHARS 32 - .pAllocatedOutBuffer PCHAR ? - .timeNow rb SYSTIME.size - .nLenName COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_PlaqueProcessor: - mcBeginLocals loc112.size - - mov ecx, 727 - call TGame_Prompt - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .done - - mcLoadLocalRef edi, loc112.bufAnsiKirkAlias - call TString_AnsiCopy - - mov esi, glb_Plaque - invoke HeapAlloc, [glb_Allocator], HEAP_NO_SERIALIZE, 8192 ; <-- 2 pages is enough! - mcStoreLocal loc112.pAllocatedOutBuffer, eax - mcStoreLocal loc112.pNextOutByte, eax - mcStoreLocal loc112.pNextInByte, esi - -.load_input_byte: - mcLoadLocal esi, loc112.pNextInByte - inc [esp + loc112.pNextInByte] - mov al, [esi] - - mcOnRegEqu al, PLAQUE_STRING, .dump_string - mcOnRegEqu al, PLAQUE_INSERT_DATE, .dump_date - mcOnRegEqu al, PLAQUE_INSERT_KLRATE, .dump_klrate - mcOnRegEqu al, PLAQUE_INSERT_LEVEL, .dump_level - mcOnRegEqu al, PLAQUE_INSERT_NAME, .dump_captain_name - mcOnRegEqu al, PLAQUE_INSERT_SCORE, .dump_score - mcOnRegEqu al, PLAQUE_END_OF_LINE, .dump_CR_LF - mcOnRegEqu al, PLAQUE_END_OF_ALL, .save - ; - ; This byte is a count of charactes defined by next byte - ; - movzx ecx, al - mov al, [esi + 1] - inc [esp + loc112.pNextInByte] - mcLoadLocal edi, loc112.pNextOutByte - add [esp + loc112.pNextOutByte], ecx - rep stosb - jmp .load_input_byte - -.dump_string: - ; - ; The next byte is a length of data to be copied - ; - movzx ecx, byte [esi + 1] - inc [esp + loc112.pNextInByte] - ; - ; Copy data - ; - mcLoadLocal edi, loc112.pNextOutByte - mcLoadLocal esi, loc112.pNextInByte - add [esp + loc112.pNextInByte], ecx - add [esp + loc112.pNextOutByte], ecx - rep movsb - jmp .load_input_byte - -.dump_date: - mcLoadLocalRef edi, loc112.timeNow - invoke GetLocalTime, edi - - movzx ecx, word [edi + SYSTIME.wMonth] - add ecx, 714 - call TMsgTable_GetItem - - call TCmdBuf_AnsiStrLen - mcLoadLocal edi, loc112.pNextOutByte - add [esp + loc112.pNextOutByte], ecx - rep movsb - - mov al, ' ' - stosb - inc [esp + loc112.pNextOutByte] - - mcLoadLocalRef esi, loc112.timeNow - movzx eax, word [esi + SYSTIME.wDay] - mcLoadLocalRef edi, loc112.bufAnsiValue - call TFormat_Int32 - - mov esi, edi - mcLoadLocal edi, loc112.pNextOutByte - add [esp + loc112.pNextOutByte], ecx - rep movsb - - mov al, ',' - stosb - mov al, ' ' - stosb - add [esp + loc112.pNextOutByte], 2 - - mcLoadLocalRef esi, loc112.timeNow - movzx eax, word [esi + SYSTIME.wYear] - mcLoadLocalRef edi, loc112.bufAnsiValue - call TFormat_Int32 - - mov esi, edi - mcLoadLocal edi, loc112.pNextOutByte - add [esp + loc112.pNextOutByte], ecx - rep movsb - jmp .load_input_byte - -.dump_klrate: - mov cl, 2 - mcLoadLocalRef edi, loc112.bufAnsiValue - fld [glb_dbl_KlingonsPerDate] - call TFormat_Double - - mov esi, edi - mcLoadLocal edi, loc112.pNextOutByte - add [esp + loc112.pNextOutByte], ecx - rep movsb - jmp .load_input_byte - -.dump_level: - mcLoadGameDataPtr esi - movzx ecx, [esi + TREKDATA.SKILL] - add cl, 12 - call TMsgTable_GetItem - - mcLoadLocal edi, loc112.pNextOutByte - mcZeroBits eax - mcZeroBits ecx - -.next_level_char: - lodsb - mcOnRegZero eax, .level_copied - - stosb - inc ecx - jmp .next_level_char - -.level_copied: - add [esp + loc112.pNextOutByte], ecx - jmp .load_input_byte - -.dump_captain_name: - ; - ; NSKIP = 65 - LEN (NAME)/2 - ; - mcLoadLocalRef esi, loc112.bufAnsiKirkAlias - call TCmdBuf_AnsiStrLen - mcStoreLocal loc112.nLenName, ecx - mcLoad8bitsToReg32 eax, 65 - shr ecx, 1 - sub eax, ecx - - mov cl, ' ' - xchg eax, ecx - mcLoadLocal edi, loc112.pNextOutByte - add [esp + loc112.pNextOutByte], ecx - rep stosb - - mcLoadLocalRef esi, loc112.bufAnsiKirkAlias - mcLoadLocal ecx, loc112.nLenName - add [esp + loc112.pNextOutByte], ecx - rep movsb - jmp .dump_CR_LF - -.dump_score: - mcLoadLocalRef edi, loc112.bufAnsiValue - mov eax, [glb_Score] - call TFormat_Int32 - - mov esi, edi - mcLoadLocal edi, loc112.pNextOutByte - add [esp + loc112.pNextOutByte], ecx - rep movsb - jmp .load_input_byte - -.dump_CR_LF: - mcLoadLocal edi, loc112.pNextOutByte - mov al, 0Dh - stosb - mov al, 0Ah - stosb - mcStoreLocal loc112.pNextOutByte, edi - jmp .load_input_byte - -.save: - invoke CreateFileAnsi, str_PlaqueFile, GENERIC_WRITE, 0, 0,\ - CREATE_ALWAYS, FILE_FLAG_SEQ_SCAN, 0 - - mov ebx, eax - mcOnRegEqu ebx, -1, .done - - mcLoadLocal esi, loc112.pAllocatedOutBuffer - mcLoadLocalRef edi, loc112.pNextInByte - mcLoadLocal ecx, loc112.pNextOutByte - sub ecx, esi - invoke WriteFile, ebx, esi, ecx, edi, 0 - invoke CloseHandle, ebx - - call TConsole_SetGameMsgAttr - mov cl, 3 - call TConsole_Skip - - mov ecx, 728 - call TConsole_Prout - inc ecx - call TConsole_Prout - inc ecx - call TConsole_Prout - - mov cl, 3 - call TConsole_Skip - -.done: - mcEndLocals loc112.size - ret - -; -------------------------------------------------------------------------- -; Output: -; CF = TRUE if directory has been set -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_SetLocalDir: - mcBeginLocals 260*2 - - mov esi, esp - invoke GetModuleFileName, 0, esi, 260 - - mcZeroBits eax - mcZeroBits edi - -.next_char: - lodsw - mcOnRegZero eax, .set_dir - - cmp al, '\' - jne .next_char - - mov edi, esi - jmp .next_char - -.set_dir: - mcOnRegZero edi, .failed - - stosw - invoke SetCurrentDir, esp - mcOnRegZero eax, .failed - -.done: - mcEndLocals 260*2 - stc - ret - -.failed: - invoke MessageBox, 0, str_SetDirFailed, str_MainWndTitle, 10h - mcEndLocals 260*2 - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = HDC -; -------------------------------------------------------------------------- -virtual at 0 -loc1: - .hDC HDC ? - .hMemDC HDC ? - .hSurfaceBmp HBITMAP ? - .hDefaultBmp HBITMAP ? - .hDefaultFont HFONT ? - .rect_Client rb RECT.size - .bkMode INT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_WmPaint: - mcBeginLocals loc1.size - mcStoreLocal loc1.hDC, eax - - mcLoadLocalRef edi, loc1.rect_Client - invoke GetClientRect, [glb_MainWnd], edi - - mcLoadLocal edx, loc1.hDC - invoke CreateCompatibleDC, edx - mcStoreLocal loc1.hMemDC, eax - - mov ebx, esp - invoke CreateCompatibleBitmap, [ebx + loc1.hDC], \ - dword [ebx + loc1.rect_Client + RECT.rc_Right], \ - dword [ebx + loc1.rect_Client + RECT.rc_Bottom] - - mcStoreLocal loc1.hSurfaceBmp, eax - - invoke SelectObject, [ebx + loc1.hMemDC], eax - mcStoreLocal loc1.hDefaultBmp, eax - - invoke GetStockObject, BLACK_BRUSH - mcLoadLocalRef esi, loc1.rect_Client - invoke FillRect, [ebx + loc1.hMemDC], esi, eax - - invoke SetBkMode, [ebx + loc1.hMemDC], TRANSPARENT - mcStoreLocal loc1.bkMode, eax - - invoke SelectObject, [ebx + loc1.hMemDC], [glb_Font] - mcStoreLocal loc1.hDefaultFont, eax - - mcLoadLocal edx, loc1.hMemDC - call TConsole_DrawAllLines - - mov ebx, esp - invoke SetBkMode, [ebx + loc1.hMemDC], [ebx + loc1.bkMode] - invoke SelectObject, [ebx + loc1.hMemDC], [ebx + loc1.hDefaultFont] - - mcZeroBits ecx - - invoke BitBlt, [ebx + loc1.hDC], ecx, ecx, \ - dword [ebx + loc1.rect_Client + RECT.rc_Right], \ - dword [ebx + loc1.rect_Client + RECT.rc_Bottom], \ - [ebx + loc1.hMemDC], ecx, ecx, SRCCOPY - - invoke SelectObject, [ebx + loc1.hMemDC], [ebx + loc1.hDefaultBmp] - invoke DeleteObject, [ebx + loc1.hSurfaceBmp] - invoke DeleteDC, [ebx + loc1.hMemDC] - - mcEndLocals loc1.size - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = WCHAR received from user -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_WmChar: - and eax, 0FFh - - cmp al, 20h - jb .control_char - - cmp al, 'a' - jb .draw_symbol - cmp al, 'z' - ja .draw_symbol - - sub al, 20h - -.draw_symbol: - mov cl, ATTR_PROMPT_VALUE - call TConsole_SetAttr - call TCmdBuf_PutChar - call TConsole_PutChar - call TConsole_RefreshCaretLine - ret - -.backspace: - call TCmdBuf_IsEmpty - jnc .del_last_char - ret - -.del_last_char: - call TCmdBuf_Backspace - call TConsole_Backspace - ret - -.command_complete: - call TConsole_ScrollUp - call TCmdBuf_Parse - lock inc [glb_GameThreadBusy] - ret - -.key_escape: - ret - -.control_char: - cmp al, CHAR_BACKSPACE - je .backspace - cmp al, CHAR_ENTER - je .command_complete - cmp al, CHAR_ESC - je .key_escape - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_QueryTextSize: - invoke GetDC, 0 - mov esi, eax - - invoke SelectObject, eax, [glb_Font] - push eax - - invoke GetTextExtentPoint32, esi, str_CharSizeText, 2, glb_CharSize - - pop edx - invoke SelectObject, esi, edx - - invoke ReleaseDC, 0, esi - - shr dword [glb_CharSize + SIZE.size_Width], 1 - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = address of rectangle to redraw -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_RefreshMainWndRect: - mov ebx, [glb_MainWnd] - invoke InvalidateRect, ebx, esi, 1 - invoke UpdateWindow, ebx - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_AdjustWndRect: - mcBeginLocals RECT.size - - mov esi, esp - - mcZeroBits eax - mov [esi + RECT.rc_Left], eax - mov [esi + RECT.rc_Top], eax - - mov ecx, dword [glb_CharSize + SIZE.size_Width] - imul ecx, CONSOLE_COLS - add ecx, 2 - mov [esi + RECT.rc_Right], ecx - - mov ecx, dword [glb_CharSize + SIZE.size_Height] - imul ecx, CONSOLE_ROWS - add ecx, 2 - mov [esi + RECT.rc_Bottom], ecx - - invoke OffsetRect, esi, 200, 32 - invoke AdjustWindowRect, esi, WS_NOSIZEWND, 0 - - mcRectWidth ecx, esi - mcRectHeight edx, esi - - invoke MoveWindow, [glb_MainWnd], \ - [esi + RECT.rc_Left], \ - [esi + RECT.rc_Top], \ - ecx, edx, 0 - - mcEndLocals RECT.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_WmCreate: - call TCommon_Allocate - call TMsgTable_Load - call TCmdBuf_Create - call TApp_QueryTextSize - call TApp_AdjustWndRect - - invoke PostMessage, [glb_MainWnd], WM_CUSTOM_DO_PRELIM, 0, 0 - ret - -; -------------------------------------------------------------------------- -; Input: -; hWnd, uiMsg, WParam, LParam -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_WndProc: - mcProlog - - mov eax, uiMsg - mcOnRegEqu eax, WM_CREATE, .OnCreate - mcOnRegEqu eax, WM_DESTROY, .OnDestroy - mcOnRegEqu eax, WM_ERASEBKGND, .OnEraseBkGnd - mcOnRegEqu eax, WM_PAINT, .OnPaint - mcOnRegEqu eax, WM_CHAR, .OnChar - mcOnRegEqu eax, WM_CUSTOM_DO_PRELIM, .StartGameThread - - invoke DefWindowProc, hWnd, uiMsg, WParam, LParam - -.exit: - mcEpilog - ret 10h - -.StartGameThread: - invoke CreateThread, 0, 0, TGame_Thread, 0, 0, 0 - -.ret_zero: - mcZeroBits eax - jmp .exit - -.OnCreate: - mov eax, hWnd - mov [glb_MainWnd], eax - call TApp_WmCreate - jmp .ret_zero - -.OnDestroy: - invoke PostQuitMessage, 0 - jmp .ret_zero - -.OnEraseBkGnd: - mcLoad1 eax - jmp .exit - -.OnPaint: - mcBeginLocals PAINTSTRUCT.size - invoke BeginPaint, [glb_MainWnd], esp - call TApp_WmPaint - invoke EndPaint, [glb_MainWnd], esp - mcEndLocals PAINTSTRUCT.size - jmp .ret_zero - -.OnChar: - mcZeroBits eax - lock add [glb_GameThreadBusy], eax - jnz .ret_zero - - mov eax, WParam - call TApp_WmChar - jmp .ret_zero - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_CreateFont: - mcBeginLocals LOGFONT.size - - mov edi, esp - mov ecx, LOGFONT.size - mcZeroBits eax - rep stosb - - mov edx, FW_NORMAL - mov [esp + LOGFONT.lf_Weight], edx - - mov dl, DEFAULT_CHARSET - mov [esp + LOGFONT.lf_CharSet], dl - - lea edi, [esp + LOGFONT.lf_FaceName] - mov esi, str_FontFace - call TString_Copy - - invoke GetDC, 0 - mov esi, eax - invoke GetDeviceCaps, esi, LOGPIXELSY - invoke MulDiv, 12, eax, 72 - - neg eax - mov [esp + LOGFONT.lf_Height], eax - invoke ReleaseDC, 0, esi - - invoke CreateFontIndirect, esp - mov [glb_Font], eax - - mcEndLocals LOGFONT.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_RegisterWnd: - mcBeginLocals WNDCLASS.size - - mov ebx, esp - - mcZeroBits ecx - mcStoreMember WNDCLASS.wc_lpszMenuName, ecx - mcStoreMember WNDCLASS.wc_cbClsExtra, ecx - mcStoreMember WNDCLASS.wc_cbWndExtra, ecx - mcStoreMember WNDCLASS.wc_hbrBackground, ecx - - invoke LoadCursor, 0, IDC_ARROW - mcStoreMember WNDCLASS.wc_hCursor, eax - - invoke LoadIcon, 0, IDI_EXCLAMATION - mcStoreMember WNDCLASS.wc_hIcon, eax - - mov eax, [glb_Instance] - mcStoreMember WNDCLASS.wc_hInstance, eax - - mov eax, TApp_WndProc - mcStoreMember WNDCLASS.wc_lpfnWndProc, eax - - mov eax, str_MainWndClass - mcStoreMember WNDCLASS.wc_lpszClassName, eax - - invoke RegisterClass, ebx - - mcEndLocals WNDCLASS.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_CreateMainWnd: - invoke CreateWindowEx, WS_EX_APPWINDOW, str_MainWndClass, \ - str_MainWndTitle, WS_NOSIZEWND, \ - 80, 40, 500, 500, \ - 0, 0, [glb_Instance], 0 - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_Init: - invoke GetModuleHandle, 0 - mov [glb_Instance], eax - - invoke HeapCreate, HEAP_NO_SERIALIZE, 0x20000, 0 - mov [glb_Allocator], eax - - call TRandom_Create - call TApp_RegisterWnd - call TApp_CreateFont - call TApp_CreateMainWnd - call TConsole_Create - call TLog_Create - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TApp_Run: - mcBeginLocals MSG.size - - mov esi, [glb_MainWnd] - invoke ShowWindow, esi, SW_SHOWNORMAL - invoke UpdateWindow, esi - -@@: - mcZeroBits eax - mov edi, esp - invoke GetMessage, edi, eax, eax, eax - mcOnRegZero eax, .done - - invoke TranslateMessage, edi - invoke DispatchMessage, edi - jmp @r - -.done: - call TLog_Disable - - mcEndLocals MSG.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TArray.Asm b/programs/games/StarTrek/trunk/TArray.Asm deleted file mode 100644 index 1bf49b8105..0000000000 --- a/programs/games/StarTrek/trunk/TArray.Asm +++ /dev/null @@ -1,677 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TArray.Asm -; DATE: October 4, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; LEAVE -; -------------------------------------------------------------------------- -; Input: -; ECX = 1-based index (IESC) of the leaving enemy -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_Leave: - pushad - - mcLoadGameDataPtr ebx - movzx edx, [ebx + TREKDATA.NENHERE] - dec edx - dec ecx - - mcLoadMemberRef edi, TREKDATA.KX - mov al, [edi + edx] - mov [edi + ecx], al - - mcLoadMemberRef edi, TREKDATA.KY - mov al, [edi + edx] - mov [edi + ecx], al - - imul ecx, 10 - imul edx, 10 - - mcLoadMemberRef edi, TREKDATA.KPOWER - fld tbyte [edi + edx] - fstp tbyte [edi + ecx] - - mcLoadMemberRef edi, TREKDATA.KDIST - fld tbyte [edi + edx] - fstp tbyte [edi + ecx] - - dec [ebx + TREKDATA.KLHERE] - dec [ebx + TREKDATA.NENHERE] - - cmp [ebx + TREKDATA.CONDIT], CONDITION_DOCKED - je .done - - call TCommon_NewCondition - -.done: - popad - ret - -; -------------------------------------------------------------------------- -; Input: -; EDI = array relative offset -; ECX = 1-based index of DOUBLE cell -; ST(0) = value to store -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_SetDouble: - push eax ecx - movzx ecx, cl - dec ecx - imul ecx, 10 - mcLoadGameDataPtr eax - add edi, eax - fstp tbyte [edi + ecx] - pop ecx eax - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = 1-based index of KPOWER cell -; Output: -; EDX = address of that DOUBLE cell -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_KlingonPowerPtr: - push ecx - movzx ecx, cl - mcLoadGameDataPtr edx - add edx, TREKDATA.KPOWER - dec ecx - imul ecx, 10 - add edx, ecx - pop ecx - ret - -; -------------------------------------------------------------------------- -; Input: -; EDI = array relative offset -; CL = 1-based index of DOUBLE cell -; Output: -; ST(0) = loaded value -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_GetDouble: - push eax ecx - movzx ecx, cl - dec ecx - imul ecx, 10 - mcLoadGameDataPtr eax - add edi, eax - fld tbyte [edi + ecx] - pop ecx eax - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = 1-based index of DAMAGE cell -; Output: -; ST(0) = loaded value -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_GetDblDamage: - push edi - mcLoad8bitsToReg32 edi, TREKDATA.DAMAGE - call TArray_GetDouble - pop edi - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = 1-based index of DEVICE -; Output: -; CF=1 if device is damaged -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_IsDamaged: - call TArray_GetDblDamage - fldz - mc_CMP_ST0_ST1 - jz .no_damage - - stc - ret - -.no_damage: - clc - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = 1-based index of KPOWER cell -; Output: -; ST(0) = loaded value -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_GetDblKPower: - push edi - mcLoad8bitsToReg32 edi, TREKDATA.KPOWER - call TArray_GetDouble - pop edi - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = 1-based index of KDIST cell -; Output: -; ST(0) = loaded value -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_GetDblKDist: - push edi - mcLoad8bitsToReg32 edi, TREKDATA.KDIST - call TArray_GetDouble - pop edi - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = 1-based index of DAMAGE cell -; ST(0) = value to store -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_SetDblDamage: - push edi - mcLoad8bitsToReg32 edi, TREKDATA.DAMAGE - call TArray_SetDouble - pop edi - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = 1-based index of KPOWER cell -; ST(0) = value to store -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_SetDblKPower: - push edi - mcLoad8bitsToReg32 edi, TREKDATA.KPOWER - call TArray_SetDouble - pop edi - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = 1-based index of KDIST cell -; ST(0) = value to store -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_SetDblKDist: - push edi - mcLoad8bitsToReg32 edi, TREKDATA.KDIST - call TArray_SetDouble - pop edi - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..10] -; DL = Y coordinate in range [1..10] -; Output: -; EBX = address of QUAD (X,Y) -; NOTE: -; Coordinates are preserved during the call -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_QuadPtr: - push eax ecx edx - ; - ; I = (X-1)*10 + (Y-1) - ; - dec al - dec dl - cbw - imul ax, 10 - add al, dl - movzx ecx, al - ; - ; Load address into EBX - ; - mov ebx, [glb_pGameData] - lea ebx, [ebx + ecx + TREKDATA.QUAD] - - pop edx ecx eax - ret - -; -------------------------------------------------------------------------- -; Output: -; CF=TRUE if CHAR_WEB is the only element encountered around -; the quadrant edges. -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_IsWebComplete: - ; - ; Check the way from sector 1-1 to sector 1-10 - ; - mcLoad1 eax - mov edx, eax - call TArray_QuadPtr - - mcLoad8bitsToReg32 ecx, 10 - mov al, CHAR_WEB - -.check_1: - cmp [ebx], al - jne .return_false - inc ebx - loop .check_1 - ; - ; Check the way from sector 10-1 to sector 10-10 - ; - mov al, 10 - mov dl, 1 - call TArray_QuadPtr - - mcLoad8bitsToReg32 ecx, 10 - mov al, CHAR_WEB - -.check_2: - cmp [ebx], al - jne .return_false - inc ebx - loop .check_2 - ; - ; Check the vertical ways: - ; 1. From sector 1-1 to sector 10-1 - ; 2. From sector 1-10 to sector 10-10 - ; - mov al, 2 - mov dl, 1 - call TArray_QuadPtr - - mcLoad8bitsToReg32 ecx, 8 - mov al, CHAR_WEB - -.check_3: - cmp [ebx], al - jne .return_false - cmp [ebx + 9], al - jne .return_false - - add ebx, 10 - loop .check_3 - ; - ; All plugged! - ; - stc - ret - -.return_false: - clc - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_SetShip: - mcLoadGameDataPtr ebx - mcLoadMember al, TREKDATA.SECTX - mcLoadMember dl, TREKDATA.SECTY - push ebx - call TArray_QuadPtr - pop esi - - mov al, [esi + TREKDATA.SHIP] - mov [ebx], al - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; Output: -; ECX = index into array (NOT OFFSET) -; NOTE: -; Coordinates are preserved during the call -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_8x8Index: - ; - ; In STAR TREK cosmos: coordinate X is row and - ; coordinate Y is column in the matrix, so - ; index is calculated as: - ; - ; I = (X-1)*8 + (Y-1) - ; - push eax edx - dec al - dec dl - shl al, 3 - add al, dl - movzx ecx, al - pop edx eax - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; Output: -; EBX = address of SCANNED (8,8) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_ScannedQuadPtr: - push ecx - call TArray_8x8Index - mov ebx, [glb_pGameData] - lea ebx, [ebx + ecx + TREKDATA.SCANNED] - pop ecx - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_SetScanned: - push ebx - call TArray_ScannedQuadPtr - mov byte [ebx], 1 - pop ebx - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; Output: -; CF=TRUE if quadrant was scanned by SRSCAN command -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_IsScanned: - push eax - push ebx - call TArray_ScannedQuadPtr - mov al, [ebx] - pop ebx - shr al, 1 - pop eax - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; Output: -; EBX = address of NEWSTUF (8,8) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_NewStufPtr: - push ecx - call TArray_8x8Index - mov ebx, [glb_pGameData] - lea ebx, [ebx + ecx + TREKDATA.NEWSTUF] - pop ecx - ret - -; -------------------------------------------------------------------------- -; Output: -; EBX = address of NEWSTUF (QUADX,QUADY) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_MyNewStufPtr: - push eax edx esi - mov esi, [glb_pGameData] - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - call TArray_NewStufPtr - pop esi edx eax - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; Output: -; EBX = address of GALAXY (8,8) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_GalaxyPtr: - push ecx - call TArray_8x8Index - mov ebx, [glb_pGameData] - lea ebx, [ebx + ecx*4 + TREKDATA.GALAXY] - pop ecx - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = quadrant X coordinate in range [1..8] -; DL = quadrant Y coordinate in range [1..8] -; ESI = TPlanet address -; Output: -; CF=1 if location is matching PLNETS array item -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_IsPlanetHere: - cmp [esi + TPlanet.planet_X], al - jne .ret_false - - cmp [esi + TPlanet.planet_Y], dl - jne .ret_false - - stc - ret - -.ret_false: - clc - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = quadrant X coordinate in range [1..8] -; DL = quadrant Y coordinate in range [1..8] -; ECX = commander index (1-based) -; Output: -; CF=1 if location is matching CX,CY arrays -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_IsCommanderHere: - push ebx ecx esi edi - mcLoadGameDataPtr ebx - - mcLoadMemberRef esi, TREKDATA.CX - mcLoadMemberRef edi, TREKDATA.CY - dec ecx - - cmp [esi + ecx], al - jne .ret_false - - cmp [edi + ecx], dl - jne .ret_false - - pop edi esi ecx ebx - stc - ret - -.ret_false: - pop edi esi ecx ebx - clc - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = quadrant X coordinate in range [1..8] -; DL = quadrant Y coordinate in range [1..8] -; Output: -; ECX = 1-based index into PLNETS array or zero -; ESI = address of TPlanet structure -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_FindPlanet: - mcLoadGameDataPtr ebx - mcLoadMemberRef esi, TREKDATA.PLNETS - mcLoad1 ecx - -.check_planet: - call TArray_IsPlanetHere - jc .done - - inc ecx - cmp cl, [ebx + TREKDATA.INPLAN] - ja .ret_false - - add esi, TPlanet.size - jmp .check_planet - -.ret_false: - mcZeroBits ecx - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = quadrant X coordinate in range [1..8] -; DL = quadrant Y coordinate in range [1..8] -; Output: -; ECX = 1-based index into CX,CY arrays or zero -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_FindCommander: - mcLoadGameDataPtr esi - mcLoad1 ecx - -.scan: - call TArray_IsCommanderHere - jc .found_it - - inc ecx - cmp cl, [esi + TREKDATA.REMCOM] - jbe .scan - - mcZeroBits ecx - -.found_it: - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = planet index (1-based) -; Output: -; EDI = address of TPlanet structure -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_PlanetPtr: - dec ecx - mcLoadGameDataPtr edi - imul ecx, TPlanet.size - lea edi, [edi + ecx + TREKDATA.PLNETS] - ret - -; -------------------------------------------------------------------------- -; Output: -; EBX = address of GALAXY (QUADX,QUADY) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_MyGalaxyPtr: - push eax edx esi - mov esi, [glb_pGameData] - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - call TArray_GalaxyPtr - pop esi edx eax - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; Output: -; EBX = address of STARCH (8,8) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_StarChartPtr: - push ecx - call TArray_8x8Index - mov ebx, [glb_pGameData] - lea ebx, [ebx + ecx*4 + TREKDATA.STARCH] - pop ecx - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; Output: -; ECX = value of STARCH (8,8) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_GetStarChartValue: - push ebx - call TArray_StarChartPtr - mov ecx, [ebx] - pop ebx - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; Output: -; ECX = value of GALAXY (8,8) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_GetGalaxyValue: - push ebx - call TArray_GalaxyPtr - mov ecx, [ebx] - pop ebx - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; ECX = value to set at STARCH (8,8) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_SetStarChartValue: - push ebx - call TArray_StarChartPtr - mov [ebx], ecx - pop ebx - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate in range [1..8] -; DL = Y coordinate in range [1..8] -; ECX = value to set at GALAXY (8,8) cell -; NOTE: -; All registers are preserved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TArray_SetGalaxyValue: - push ebx - call TArray_GalaxyPtr - mov [ebx], ecx - pop ebx - ret - - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TAttack.Asm b/programs/games/StarTrek/trunk/TAttack.Asm deleted file mode 100644 index d08b17c24d..0000000000 --- a/programs/games/StarTrek/trunk/TAttack.Asm +++ /dev/null @@ -1,1813 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TAttack.Asm -; DATE: October 18, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; EBX = address of BYTE A -; ECX = address of BYTE B -; -------------------------------------------------------------------------- -; Performs the following statement: -; IF (2*ABS(A) < ABS (B)) A=0 -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_Helper1: - push eax edx - - movsx eax, byte [ebx] - call TCommon_AbsEAX - lea edx, [eax + eax] - - movsx eax, byte [ecx] - call TCommon_AbsEAX - - cmp edx, eax - jnb .done - -.apply_zero: - mov byte [ebx], 0 - -.done: - pop edx eax - ret - -; -------------------------------------------------------------------------- -; Input: -; EBX = address of BYTE A -; EAX = value of MOTION -; -------------------------------------------------------------------------- -; Performs the following statement: -; IF (A != 0) A = ISIGN (1, MOTION*A) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_Helper2: - cmp byte [ebx], 0 - jne .get_sign - ret - -.get_sign: - push eax ecx - movsx ecx, byte [ebx] - imul ecx, eax - mcLoad1 eax - call TAttack_ISign - mov [ebx], al - pop ecx eax - ret - -; -------------------------------------------------------------------------- -; Input: -; BL = QUAD -; AL = LOOK -; Output: -; AL = QUAD + (LOOK+9)/10 - 1 -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_Helper3: - add al, 9 - movzx eax, al - mcLoad8bitsToReg32 ecx, 10 - mcZeroBits edx - div ecx - add al, bl - dec al - ret - -; -------------------------------------------------------------------------- -; ISIGN -; -------------------------------------------------------------------------- -; Input: -; EAX = Int32 value -; ECX = any signed value -; Output: -; EAX = same value with a sign of value in ECX -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_ISign: - call TCommon_AbsEAX - - add ecx, 0 - js .apply_negative - ret - -.apply_negative: - neg eax - ret - -; -------------------------------------------------------------------------- -; CASULTY -; -------------------------------------------------------------------------- -; Input: -; ST(0) = total hit incurred by the ship -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_Casualties: - call TRandom_Ranf - fmulp - fld [glb_dbl_0dot015] - fmulp - call TCommon_FP_Truncate - - cmp eax, 2 - jb .done - - mcLoadGameDataPtr edi - add [edi + TREKDATA.CASUAL], al - push eax - - call TConsole_SetCrewMsgAttr - mov ecx, 272 - call TConsole_Cram - - pop eax - call TConsole_CramInt - - mov ecx, 273 - call TConsole_Prout - call TConsole_SetGameMsgAttr - -.done: - ret - -; -------------------------------------------------------------------------- -; Check in debugger if all values in KPOWER array are intact -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_DbgVerifyKPower: - pushad - - mcLoadGameDataPtr esi - movzx ecx, [esi + TREKDATA.NENHERE] - lea ebx, [esi + TREKDATA.KPOWER] - -@@: - fld tbyte [ebx] - mcFpuPop - add ebx, 10 - loop @r - - popad - ret - -; -------------------------------------------------------------------------- -; ZAP -; -------------------------------------------------------------------------- -; Input: -; ESI = address of HIT -; EDI = address of IHURT -; ECX = L (1-based klingon index) -; -------------------------------------------------------------------------- -virtual at 0 -loc37: - .pTrekData PVOID ? - .pIHURT PBOOL ? - .pHIT PDOUBLE ? - .dbl_HITSH DOUBLE ? - .dbl_ABSORB DOUBLE ? - .dbl_PROPOR DOUBLE ? - .dbl_CHGFAC DOUBLE ? - .dbl_EXTRADM DOUBLE ? - .dbl_PFAC DOUBLE ? - .nCRIT COUNT ? - .nKTR COUNT ? - .nJ INDEX ? - .nL INDEX ? - .nLL INDEX ? - .arrCDAM BYTES 8 - .nCDAM COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_Zap: - mcBeginLocals loc37.size - mcStoreLocal loc37.pHIT, esi - mcStoreLocal loc37.pIHURT, edi - mcStoreLocal loc37.nL, ecx - - mcLoadGameDataPtr ebx - mcStoreLocal loc37.pTrekData, ebx - - fld1 - fld [ebx + TREKDATA.INSHLD] - fdivp - fstp [esp + loc37.dbl_PFAC] - - fld1 - fstp [esp + loc37.dbl_CHGFAC] - - cmp [ebx + TREKDATA.SHLDCHG], 0 - je .check_defenses - - call TRandom_Ranf - fld [glb_dbl_0dot5] - fmulp - fld [glb_dbl_DOCKFAC] ; Reusing 0.25 - faddp - fstp [esp + loc37.dbl_CHGFAC] - -.check_defenses: - cmp [ebx + TREKDATA.SHLDUP], 0 - jne .reduce_hit - cmp [ebx + TREKDATA.SHLDCHG], 0 - je .L10 - -.reduce_hit: - fld [ebx + TREKDATA.SHLD] - fld [esp + loc37.dbl_PFAC] - fmulp - fld [glb_dbl_0dot1] - call TCommon_FPU_Max - fld st - fstp [esp + loc37.dbl_PROPOR] - - fld [esp + loc37.dbl_CHGFAC] - fmulp - mcLoadLocal esi, loc37.pHIT - fld tbyte [esi] - fmulp - fld1 - faddp - fld st - fstp [esp + loc37.dbl_HITSH] - - fld [glb_dbl_0dot8] - fmulp - fstp [esp + loc37.dbl_ABSORB] - - fld [ebx + TREKDATA.SHLD] - fld [esp + loc37.dbl_ABSORB] - mc_CMP_ST0_ST1 - jc .reduce_shields - - fld [ebx + TREKDATA.SHLD] - fstp [esp + loc37.dbl_ABSORB] - -.reduce_shields: - fld [ebx + TREKDATA.SHLD] - fld [esp + loc37.dbl_ABSORB] - fsubp - fld st - fstp [ebx + TREKDATA.SHLD] - - fldz - mc_CMP_ST0_ST1 - jc .reduce_hit2 - - mov [ebx + TREKDATA.SHLDUP], 0 - -.reduce_hit2: - mcLoadLocal edi, loc37.pHIT - fld tbyte [edi] - fld [esp + loc37.dbl_HITSH] - fsubp - fstp tbyte [edi] - - fld [esp + loc37.dbl_PROPOR] - fld [glb_dbl_0dot1] - mc_CMP_ST0_ST1 - jz .L10 - - fld [ebx + TREKDATA.ENERGY] - fld [glb_dbl_0dot005] - fmulp - fld tbyte [edi] - mc_CMP_ST0_ST1 - jc .done - -.L10: - ; - ; We've been hit!! - ; - mcLoadLocal edi, loc37.pIHURT - inc dword [edi] - - call TConsole_SetGameMsgAttr - mov cl, 2 - mov dl, 8 - mcLoadLocal esi, loc37.pHIT - fld tbyte [esi] - - call TConsole_CramFloatWidth - mcLoad8bitsToReg32 ecx, 254 - call TConsole_Cram - - cmp [esp + loc37.nL], 0 - je .L15 - - mcLoad8bitsToReg32 ecx, 255 - call TConsole_Cram - - mcLoadLocal ebx, loc37.pTrekData - mcLoadLocal ecx, loc37.nL - dec ecx - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - mov al, [esi + ecx] - mov dl, [edi + ecx] - call TConsole_CramEnemyAtEx - -.L15: - call TConsole_ScrollUp - invoke Sleep, 350 - ; - ; Decide if hit is critical - ; - mcLoadLocal ebx, loc37.pTrekData - mov eax, 275 - movzx ecx, [ebx + TREKDATA.SKILL] - imul ecx, 25 - sub eax, ecx - - push eax - call TRandom_Ranf - pop eax - - fld [glb_dbl_0dot5] - fmulp - fld1 - faddp - call TCommon_FPU_Load_EAX - fmulp - - mcLoadLocal esi, loc37.pHIT - fld tbyte [esi] - mc_CMP_ST0_ST1 - jc .L60 - - call TRandom_Ranf - fld [glb_dbl_100] - fmulp - fld [glb_dbl_500] - faddp - - mcLoadLocal esi, loc37.pHIT - fld tbyte [esi] - fdivrp - fld1 - faddp - call TCommon_FP_Truncate - mcStoreLocal loc37.nCRIT, eax - - call TConsole_SetGameMsgAttr - mov ecx, 256 - call TConsole_Cram - ; - ; Select devices and cause damage - ; - mcLoad1 eax - mcStoreLocal loc37.nKTR, eax - mcStoreLocal loc37.nLL, eax - dec eax - mcStoreLocal loc37.nCDAM, eax - -.L20: - mcLoad8bitsToReg32 edx, 13 - call TRandom_IRan - inc eax - mov ecx, eax - mcStoreLocal loc37.nJ, eax - call TArray_GetDblDamage - - fldz - fxch - mc_CMP_ST0_ST1 - jc .L20 - ; - ; Prevent shuttle damage unless on ship - ; - cmp [esp + loc37.nJ], 10 - jne .calculate_damage - - mcLoadLocal esi, loc37.pTrekData - cmp [esi + TREKDATA.ISCRAFT], 1 - jne .L20 - -.calculate_damage: - mcLoadLocal ecx, loc37.nCDAM - mcLoadLocalRef edi, loc37.arrCDAM - inc [esp + loc37.nCDAM] - mcLoadLocal eax, loc37.nJ - mov [edi + ecx], al - - call TRandom_Ranf - fld [glb_dbl_25] - fmulp - fld [glb_dbl_75] - faddp - fild [esp + loc37.nCRIT] - fmulp - - mcLoadLocal esi, loc37.pTrekData - mcLoadLocal ebx, loc37.pHIT - fld [esi + TREKDATA.DAMFAC] - fld tbyte [ebx] - fmulp - fdivrp - fstp [esp + loc37.dbl_EXTRADM] - - mcLoadLocal ecx, loc37.nJ - call TArray_GetDblDamage - fld [esp + loc37.dbl_EXTRADM] - faddp - - mcLoadLocal ecx, loc37.nJ - call TArray_SetDblDamage - - cmp [esp + loc37.nLL], 1 - je .L40 - ; - ; Check if device has been reported once - ; - mcLoadLocal ecx, loc37.nCDAM - mcLoadLocal edx, loc37.nJ - mcLoadLocalRef esi, loc37.arrCDAM - -.check_if_reported: - lodsb - cmp al, dl - je .L50 - loop .check_if_reported - ; - ; Report the device - ; - inc [esp + loc37.nKTR] - cmp [esp + loc37.nKTR], 3 - jne .cram_AND - - call TConsole_ScrollUp - -.cram_AND: - mov ecx, 258 - call TConsole_Cram - -.L40: - mcLoadLocal ecx, loc37.nJ - call TConsole_CramDevice - -.L50: - inc [esp + loc37.nLL] - mcLoadLocal ecx, loc37.nLL - cmp ecx, [esp + loc37.nCRIT] - jbe .L20 - - mov ecx, 259 - call TConsole_Prout - ; - ; Print message if shields got knocked down - ; - mov cl, DEV_SHIELDS - call TArray_IsDamaged - jnc .L60 - - mcLoadLocal esi, loc37.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - je .L60 - - dec [esi + TREKDATA.SHLDUP] - mov ecx, 260 - call TConsole_Prout - -.L60: - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jnc .deplete - - mcLoadLocal edi, loc37.pTrekData - mov [edi + TREKDATA.ISUBDAM], 1 - -.deplete: - mcLoadLocal edi, loc37.pTrekData - mcLoadLocal esi, loc37.pHIT - fld [edi + TREKDATA.ENERGY] - fld tbyte [esi] - fsubp - fstp [edi + TREKDATA.ENERGY] - -.done: - mcEndLocals loc37.size - ret - -; -------------------------------------------------------------------------- -; MOVECOM -; -------------------------------------------------------------------------- -virtual at 0 -loc52: - .pTrekData PVOID ? - .pNOEXIT PVOID ? - .pKDIST PDOUBLE ? - .pKPOWER PDOUBLE ? - .pKX PBYTE ? - .pKY PBYTE ? - .nLOCCOM INDEX ? - .nI INDEX ? - .nLL INDEX ? - .nSTEPS COUNT ? - .bIRUN BYTE ? - .chIENM BYTE ? - .nKRAWLX BYTE ? - .nKRAWLY BYTE ? - .nIX BYTE ? - .nIY BYTE ? - .nCOMX BYTE ? - .nCOMY BYTE ? - .nMX BYTE ? - .nMY BYTE ? - .nNEXTX BYTE ? - .nNEXTY BYTE ? - .nLOOKX BYTE ? - .nLOOKY BYTE ? - .nIQX BYTE ? - .nIQY BYTE ? - .chIQUAD BYTE ? - .pad_1 BYTE ? - .pad_2 BYTE ? - .pad_3 BYTE ? - .nMOTION INT32 ? - .dbl_TFAC DOUBLE ? - .dbl_EFAC DOUBLE ? - .dbl_MDIST DOUBLE ? - .dbl_DIST1 DOUBLE ? - .dbl_NBADDYS DOUBLE ? - .dbl_FORCES DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_MoveCommanders: - mcBeginLocals loc52.size - - mcLoadGameDataPtr esi - mcStoreLocal loc52.pTrekData, esi - - lea eax, [esi + TREKDATA.KPOWER] - lea edx, [esi + TREKDATA.KDIST] - lea ebx, [esi + TREKDATA.KX] - lea ecx, [esi + TREKDATA.KY] - mcStoreLocal loc52.pKPOWER, eax - mcStoreLocal loc52.pKDIST, edx - mcStoreLocal loc52.pKX, ebx - mcStoreLocal loc52.pKY, ecx - - mov al, 1 - mcStoreLocal loc52.nKRAWLX, al - mcStoreLocal loc52.nKRAWLY, al - ; - ; IF ((NENHERE == 0) OR (JUSTIN == 1)) RETURN - ; - cmp [esi + TREKDATA.NENHERE], 0 - je .done - cmp [esi + TREKDATA.JUSTIN], al - je .done - ; - ; NBADDYS = COMHERE + ISHERE - ; - mov al, [esi + TREKDATA.COMHERE] - add al, [esi + TREKDATA.ISHERE] - call TCommon_LoadByteIntoFPU - fstp [esp + loc52.dbl_NBADDYS] - ; - ; IF (KSTUF5 != 0) - ; NBADDYS = ((2*COMHERE)+(2*ISHERE)+(KLHERE*1.23)+(IRHERE*1.5))/2 - ; - cmp [esi + TREKDATA.KSTUF5], 0 - je .begin_loop - - mov al, [esi + TREKDATA.COMHERE] - add al, al - mov cl, [esi + TREKDATA.ISHERE] - add cl, cl - add al, cl - call TCommon_LoadByteIntoFPU - - mov al, [esi + TREKDATA.KLHERE] - call TCommon_LoadByteIntoFPU - fld [glb_dbl_1dot23] - fmulp - faddp - - mov al, [esi + TREKDATA.IRHERE] - call TCommon_LoadByteIntoFPU - fld [glb_dbl_1dot5] - fmulp - faddp - - fld [glb_dbl_2] - fdivp - fstp [esp + loc52.dbl_NBADDYS] - -.begin_loop: - mcLoad1 eax - mcStoreLocal loc52.nI, eax - -.L1: - mov [esp + loc52.bIRUN], 0 - ; - ; IX = KX (I) - ; IY = KY (I) - ; - mcLoadLocal ecx, loc52.nI - mcStoreLocal loc52.nLOCCOM, ecx - dec ecx - mcLoadLocal esi, loc52.pKX - mcLoadLocal edi, loc52.pKY - mov al, [esi + ecx] - mov dl, [edi + ecx] - mcStoreLocal loc52.nIX, al - mcStoreLocal loc52.nIY, dl - mcStoreLocal loc52.nCOMX, al - mcStoreLocal loc52.nCOMY, dl - ; - ; IENM = QUAD (IX,IY) - ; - call TArray_QuadPtr - mov al, [ebx] - mcStoreLocal loc52.chIENM, al - ; - ; IF (KSTUF5==0) AND ((IENM != 'S') OR (IENM != 'C')) GOTO 500 - ; - mcLoadLocal esi, loc52.pTrekData - cmp [esi + TREKDATA.KSTUF5], 0 - jne .check_if_scom - - cmp [esp + loc52.chIENM], CHAR_SCOM - jne .L500 - cmp [esp + loc52.chIENM], CHAR_COMMANDER - jne .L500 - -.check_if_scom: - ; - ; IF (IENM != 'S') GOTO 3 - ; - cmp [esp + loc52.chIENM], CHAR_SCOM - jne .L3 - ; - ; Check with spy to see if S.C. should hi-tail it - ; IF (KPOWER (LOCCOM) > 500.0) AND (!DOCKED OR TUBES DAMAGED) GOTO 3 - ; - mcLoadLocal ecx, loc52.nLOCCOM - mcLoadLocal ebx, loc52.pKPOWER - dec ecx - imul ecx, 10 - fld [glb_dbl_500] - fld tbyte [ebx + ecx] - mc_CMP_ST0_ST1 - jc .enemy_runs - - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .L3 - - mov cl, DEV_PHOTON_TUBES - call TArray_IsDamaged - jc .L3 - -.enemy_runs: - inc [esp + loc52.bIRUN] - mcLoad8bitsToReg32 eax, -10 - mcStoreLocal loc52.nMOTION, eax - jmp .L8 - -.L3: - ; - ; Decide whether to advance, retreat or hold position - ; and by how much - ; - mcZeroBits eax - mcStoreLocal loc52.nMOTION, eax - ; - ; DIST1 = KDIST (LOCCOM) - ; - mcLoadLocal ecx, loc52.nLOCCOM - mcLoadLocal ebx, loc52.pKDIST - dec ecx - imul ecx, 10 - fld tbyte [ebx + ecx] - fstp [esp + loc52.dbl_DIST1] - ; - ; MDIST = DIST1 + 0.5 - ; - fld [esp + loc52.dbl_DIST1] - fld [glb_dbl_0dot5] - faddp - fstp [esp + loc52.dbl_MDIST] - ; - ; FORCES = KPOWER (LOCCOM) + NENHERE*100.0 + (NBADDYS-1.0)*400.0 - ; - mcLoadLocal ecx, loc52.nLOCCOM - mcLoadLocal ebx, loc52.pKPOWER - dec ecx - imul ecx, 10 - fld tbyte [ebx + ecx] - - mcLoadLocal esi, loc52.pTrekData - mov al, [esi + TREKDATA.NENHERE] - call TCommon_LoadByteIntoFPU - fld [glb_dbl_100] - fmulp - faddp - - fld [esp + loc52.dbl_NBADDYS] - fld1 - fsubp - fld [glb_dbl_400] - fmulp - faddp - fstp [esp + loc52.dbl_FORCES] - ; - ; IF (SHLDUP == 0) FORCES += 1000.0 - ; - cmp [esi + TREKDATA.SHLDUP], 0 - jne .check_damages - - fld [esp + loc52.dbl_FORCES] - fld [glb_dbl_1000] - faddp - fstp [esp + loc52.dbl_FORCES] - -.check_damages: - ; - ; IF ((DAMAGE (3) == 0) OR (DAMAGE (4) == 0)) GOTO 4 - ; - mov cl, DEV_PHASERS - call TArray_IsDamaged - jnc .L4 - - mov cl, DEV_PHOTON_TUBES - call TArray_IsDamaged - jnc .L4 - ; - ; FORCES += 1000.0 - ; - fld [esp + loc52.dbl_FORCES] - fld [glb_dbl_1000] - faddp - fstp [esp + loc52.dbl_FORCES] - jmp .L7 - -.L4: - fld1 - fld1 - fstp [esp + loc52.dbl_EFAC] - fstp [esp + loc52.dbl_TFAC] - ; - ; IF (DAMAGE (3) == 0) GOTO 5 - ; - mov cl, DEV_PHASERS - call TArray_IsDamaged - jnc .L5 - ; - ; EFAC = 0.0 - ; FORCES += 300.0 - ; - fldz - fstp [esp + loc52.dbl_EFAC] - - fld [esp + loc52.dbl_FORCES] - fld [glb_dbl_300] - faddp - fstp [esp + loc52.dbl_FORCES] - -.L5: - ; - ; IF (DAMAGE (4) == 0) GOTO 6 - ; - mov cl, DEV_PHOTON_TUBES - call TArray_IsDamaged - jnc .L6 - ; - ; TFAC = 0.0 - ; FORCES += 300.0 - ; - fldz - fstp [esp + loc52.dbl_TFAC] - - fld [esp + loc52.dbl_FORCES] - fld [glb_dbl_300] - faddp - fstp [esp + loc52.dbl_FORCES] - -.L6: - ; - ; FORCES = FORCES - 50.0*TORPS*TFAC + 0.2*EFAC*(2500.0-ENERGY) + 0.6*SHLDUP*(1250.0-SHLD) - ; - fld [esp + loc52.dbl_FORCES] - mcLoadLocal esi, loc52.pTrekData - movzx eax, [esi + TREKDATA.TORPS] - imul eax, 50 - call TCommon_FPU_Load_EAX - fld [esp + loc52.dbl_TFAC] - fmulp - fsubp - - fld [glb_dbl_2500] - fld [esi + TREKDATA.ENERGY] - fsubp - fld [esp + loc52.dbl_EFAC] - fmulp - fld [glb_dbl_0dot2] - fmulp - faddp - - fld [glb_dbl_1250] - fld [esi + TREKDATA.SHLD] - fsubp - fld [glb_dbl_0dot6] - fmulp - mov al, [esi + TREKDATA.SHLDUP] - call TCommon_LoadByteIntoFPU - fmulp - faddp - fstp [esp + loc52.dbl_FORCES] - -.L7: - ; - ; IF (FORCES > 1000.0) MOTION = (1.0-RANF(0)**2)*DIST1 + 1.0 - ; - fld [glb_dbl_1000] - fld [esp + loc52.dbl_FORCES] - mc_CMP_ST0_ST1 - jc .check_docked - - fld1 - call TRandom_Ranf - fld st - fmulp - fsubp - fld [esp + loc52.dbl_DIST1] - fmulp - fld1 - faddp - call TCommon_FP_Truncate - mcStoreLocal loc52.nMOTION, eax - -.check_docked: - ; - ; IF (DOCKED) MOTION -= SKILL*(2.0-RANF(0)**2) - ; - mcLoadLocal esi, loc52.pTrekData - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .check_no_motion - - fld [glb_dbl_2] - call TRandom_Ranf - fld st - fmulp - fsubp - mov al, [esi + TREKDATA.SKILL] - call TCommon_LoadByteIntoFPU - fmulp - call TCommon_FP_Truncate - sub [esp + loc52.nMOTION], eax - -.check_no_motion: - ; - ; IF (MOTION == 0) MOTION = ((FORCES + 200.0*RANF(0))/150.0) - 5.0 - ; - cmp [esp + loc52.nMOTION], 0 - jne .we_have_motion - - call TRandom_Ranf - fld [glb_dbl_200] - fmulp - fld [esp + loc52.dbl_FORCES] - faddp - fld [glb_dbl_150] - fdivp - call TCommon_FP_Truncate - sub eax, 5 - mcStoreLocal loc52.nMOTION, eax - mcOnRegZero eax, .L500 - -.we_have_motion: - ; - ; IF (ABS (MOTION) > SKILL) MOTION = ISIGN (SKILL, MOTION) - ; - mcLoadLocal eax, loc52.nMOTION - call TCommon_AbsEAX - - mcLoadLocal esi, loc52.pTrekData - movzx ecx, [esi + TREKDATA.SKILL] - - cmp eax, ecx - jbe .L8 - - xchg eax, ecx - call TAttack_ISign - mcStoreLocal loc52.nMOTION, eax - -.L8: - ; - ; Calculate preferred number of steps to - ; move a commander. - ; - mcLoadLocal eax, loc52.nMOTION - call TCommon_AbsEAX - mcStoreLocal loc52.nSTEPS, eax - ; - ; IF (MOTION > 0) AND (NSTEPS > MDIST) NSTEPS=MDIST - ; - cmp [esp + loc52.nMOTION], 0 - jle .validate_step_count - - fld [esp + loc52.dbl_MDIST] - call TCommon_FP_Truncate - cmp [esp + loc52.nSTEPS], eax - jle .validate_step_count - - mcStoreLocal loc52.nSTEPS, eax - -.validate_step_count: - cmp [esp + loc52.nSTEPS], 1 - jb .set_one_step - cmp [esp + loc52.nSTEPS], 10 - jbe .compute_dx_dy - - push 10 - jmp .apply_num_steps - -.set_one_step: - push 1 - -.apply_num_steps: - pop eax - mcStoreLocal loc52.nSTEPS, eax - -.compute_dx_dy: - ; - ; Compute preferred values of Delta X and Delta Y - ; MX = SECTX - COMX - ; MY = SECTY - COMY - ; - mcLoadLocal esi, loc52.pTrekData - mov al, [esi + TREKDATA.SECTX] - mov dl, [esi + TREKDATA.SECTY] - sub al, [esp + loc52.nCOMX] - sub dl, [esp + loc52.nCOMY] - mcStoreLocal loc52.nMX, al - mcStoreLocal loc52.nMY, dl - ; - ; IF (2*ABS(MX) < ABS(MY)) MX=0 - ; IF (2*ABS(MY) < ABS(MX)) MY=0 - ; - mcLoadLocalRef ebx, loc52.nMX - mcLoadLocalRef ecx, loc52.nMY - call TAttack_Helper1 - - xchg ebx, ecx - call TAttack_Helper1 - ; - ; IF (MX != 0) MX = ISIGN (1, MX*MOTION) - ; IF (MY != 0) MY = ISIGN (1, MY*MOTION) - ; - mcLoadLocalRef ebx, loc52.nMX - mcLoadLocal eax, loc52.nMOTION - call TAttack_Helper2 - - mcLoadLocalRef ebx, loc52.nMY - call TAttack_Helper2 - ; - ; Main loop to attempt to move COMMANDER steps - ; NEXTX = COMX - ; NEXTY = COMY - ; - mcLoadLocal al, loc52.nCOMX - mcLoadLocal dl, loc52.nCOMY - mcStoreLocal loc52.nNEXTX, al - mcStoreLocal loc52.nNEXTY, dl - ; - ; QUAD (COMX,COMY) = IHDOT - ; - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - ; - ; DO 60 LL=1,NSTEPS - ; - mcLoad1 eax - mcStoreLocal loc52.nLL, eax - -.look_next: - ; - ; LOOKX = NEXTX + MX - ; LOOKY = NEXTY + MY - ; - mcLoadLocal al, loc52.nNEXTX - mcLoadLocal dl, loc52.nNEXTY - add al, [esp + loc52.nMX] - add dl, [esp + loc52.nMY] - mcStoreLocal loc52.nLOOKX, al - mcStoreLocal loc52.nLOOKY, dl - - mov ecx, .L10 - mcStoreLocal loc52.pNOEXIT, ecx - ; - ; IF (LOOKX < 1) OR (LOOKX > 10) IF (MOTION) 70,30,30 - ; - cmp al, 1 - jl .look_x_out_of_quad - cmp al, 10 - jg .look_x_out_of_quad - ; - ; IF (LOOKY < 1) OR (LOOKY > 10) IF (MOTION) 70,10,10 - ; - cmp dl, 1 - jl .look_y_out_of_quad - cmp dl, 10 - jg .look_y_out_of_quad - ; - ; IQUAD = QUAD (LOOKX,LOOKY) - ; - call TArray_QuadPtr - mov cl, [ebx] - mcStoreLocal loc52.chIQUAD, cl - ; - ; IF (IQUAD != SHIP) GOTO 9010 - ; - mcLoadLocal esi, loc52.pTrekData - cmp [esi + TREKDATA.SHIP], cl - jne .L9010 - ; - ; Only let COMMANDERS ram the ship - ; - mcOnRegEqu cl, CHAR_COMMANDER, .whamo - mcOnRegNotEqu cl, CHAR_SCOM, .L9010 - -.whamo: - mov bl, 1 - mcLoadLocal cl, loc52.chIENM - mcLoadLocal al, loc52.nCOMX - mcLoadLocal dl, loc52.nCOMY - call TMove_Ram - jmp .L500 - -.look_x_out_of_quad: - cmp [esp + loc52.nMOTION], 0 - jl .L70 - jmp .L30 - -.look_y_out_of_quad: - cmp [esp + loc52.nMOTION], 0 - jl .L70 - jmp .L10 - -.at_L10_out_of_quad: - cmp [esp + loc52.nMOTION], 0 - jl .L70 - jmp .L20 - -.L9010: - cmp [esp + loc52.chIQUAD], CHAR_COSMOS - je .L50 - -.L10: - ; - ; IF (MY == KRAWLY) OR (MX == 0) GOTO 30 - ; - mcLoadLocal al, loc52.nMY - cmp al, [esp + loc52.nKRAWLY] - je .L30 - cmp [esp + loc52.nMX], 0 - je .L30 - ; - ; LOOKY = NEXTY + KRAWLY - ; - mcLoadLocal al, loc52.nNEXTY - add al, [esp + loc52.nKRAWLY] - mcStoreLocal loc52.nLOOKY, al - - mov ecx, .L20 - mcStoreLocal loc52.pNOEXIT, ecx - ; - ; IF (LOOKY < 1) OR (LOOKY > 10) IF (MOTION) 70,20,20 - ; - cmp al, 1 - jl .at_L10_out_of_quad - cmp al, 10 - jg .at_L10_out_of_quad - ; - ; IF (LOOKX < 1) OR (LOOKX > 10) IF (MOTION) 70,20,20 - ; - mcLoadLocal dl, loc52.nLOOKX - cmp dl, 1 - jl .at_L10_out_of_quad - cmp dl, 10 - jg .at_L10_out_of_quad - ; - ; IF (QUAD (LOOKX,LOOKY) == IHDOT) GOTO 50 - ; - xchg edx, eax - call TArray_QuadPtr - cmp byte [ebx], CHAR_COSMOS - je .L50 - -.L20: - ; - ; KRAWLY = -KRAWLY - ; - neg [esp + loc52.nKRAWLY] - -.L30: - ; - ; IF (MX == KRAWLX) OR (MY == 0) GOTO 60 - ; - mcLoadLocal al, loc52.nMX - cmp al, [esp + loc52.nKRAWLX] - je .L60 - cmp [esp + loc52.nMY], 0 - je .L60 - ; - ; LOOKX = NEXTX + KRAWLX - ; - mcLoadLocal al, loc52.nNEXTX - add al, [esp + loc52.nKRAWLX] - mcStoreLocal loc52.nLOOKX, al - - mov ecx, .L40 - mcStoreLocal loc52.pNOEXIT, ecx - ; - ; IF (LOOKX < 1) OR (LOOKX > 10) IF (MOTION) 70,40,40 - ; - cmp al, 1 - jl .at_L30_out_of_quad - cmp al, 10 - jg .at_L30_out_of_quad - ; - ; IF (LOOKY < 1) OR (LOOKY > 10) IF (MOTION) 70,40,40 - ; - mcLoadLocal dl, loc52.nLOOKY - cmp dl, 1 - jl .at_L30_out_of_quad - cmp dl, 10 - jg .at_L30_out_of_quad - ; - ; IF (QUAD (LOOKX,LOOKY) == IHDOT) GOTO 50 - ; - call TArray_QuadPtr - cmp byte [ebx], CHAR_COSMOS - je .L50 - -.L40: - neg [esp + loc52.nKRAWLX] - jmp .L60 - -.at_L30_out_of_quad: - cmp [esp + loc52.nMOTION], 0 - jl .L70 - jmp .L40 - -.L50: - ; - ; NEXTX = LOOKX - ; NEXTY = LOOKY - ; - mcLoadLocal al, loc52.nLOOKX - mcLoadLocal dl, loc52.nLOOKY - mcStoreLocal loc52.nNEXTX, al - mcStoreLocal loc52.nNEXTY, dl - -.L60: - inc [esp + loc52.nLL] - mov ecx, [esp + loc52.nLL] - cmp ecx, [esp + loc52.nSTEPS] - jbe .look_next - ; - ; Put COMMANDER in new place within same quadrant - ; QUAD (NEXTX,NEXTY) = IENM - ; - mcLoadLocal al, loc52.nNEXTX - mcLoadLocal dl, loc52.nNEXTY - call TArray_QuadPtr - mcLoadLocal cl, loc52.chIENM - mov [ebx], cl - ; - ; IF ((NEXTX == COMX) AND (NEXTY == COMY)) GOTO 500 - ; - mcLoadLocal dl, loc52.nCOMX - cmp [esp + loc52.nNEXTX], dl - jne .do_reposition - - mcLoadLocal dl, loc52.nCOMY - cmp [esp + loc52.nNEXTY], dl - je .L500 - -.do_reposition: - ; - ; KX (LOCCOM) = NEXTX - ; KY (LOCCOM) = NEXTY - ; - mcLoadLocal al, loc52.nNEXTX - mcLoadLocal dl, loc52.nNEXTY - mcLoadLocal ecx, loc52.nLOCCOM - dec ecx - mcLoadLocal esi, loc52.pKX - mcLoadLocal edi, loc52.pKY - mov [esi + ecx], al - mov [edi + ecx], dl - ; - ; KDIST (LOCCOM) = sqrt ((SECTX-NEXTX)**2 + (SECTY-NEXTY)**2) - ; - imul ecx, 10 - mcLoadLocal esi, loc52.pTrekData - mov al, [esi + TREKDATA.SECTX] - mov dl, [esi + TREKDATA.SECTY] - sub al, [esp + loc52.nNEXTX] - sub dl, [esp + loc52.nNEXTY] - movsx eax, al - movsx edx, dl - imul eax, eax - imul edx, edx - add eax, edx - call TCommon_FPU_Load_EAX - fsqrt - mcLoadLocal edi, loc52.pKDIST - fstp tbyte [edi + ecx] - - mcLoadNeg1 eax - mcStoreLocal loc52.nMOTION, eax - ; - ; IF (KDIST (LOCCOM) < DIST1) MOTION=1 - ; - fld [esp + loc52.dbl_DIST1] - fld tbyte [edi + ecx] - mc_CMP_ST0_ST1 - jnc .advance_retreat_msg - - neg [esp + loc52.nMOTION] - -.advance_retreat_msg: - call TConsole_SetGameMsgAttr - call TConsole_Cram3Asterisks - mcLoadLocal al, loc52.chIENM - call TConsole_CramEnemy - - mcZeroBits eax - add [esp + loc52.nMOTION], 0 - sets al - lea ecx, [eax + 596] - call TConsole_Cram - - mcLoadLocal al, loc52.nNEXTX - mcLoadLocal dl, loc52.nNEXTY - mov cl, 2 - call TConsole_CramLoc - call TConsole_ScrollUp - invoke Sleep, 350 - jmp .L500 - -.goto_no_exit: - jmp [esp + loc52.pNOEXIT] - -.L70: - ; - ; Try to move into adjacent quadrant, avoiding - ; negative energy barrier, supernovae and >8 Klingons. - ; - ; IQX = QUADX + (LOOKX+9)/10 - 1 - ; IQY = QUADY + (LOOKY+9)/10 - 1 - ; - mcLoadLocal esi, loc52.pTrekData - mov bl, [esi + TREKDATA.QUADX] - mcLoadLocal al, loc52.nLOOKX - call TAttack_Helper3 - mcStoreLocal loc52.nIQX, al - - mov bl, [esi + TREKDATA.QUADY] - mcLoadLocal al, loc52.nLOOKY - call TAttack_Helper3 - mcStoreLocal loc52.nIQY, al - ; - ; IF (IQX,IQY is out of galaxy) GOTO NOEXIT - ; - cmp al, 1 - jb .goto_no_exit - cmp al, 8 - ja .goto_no_exit - - mcLoadLocal dl, loc52.nIQX - cmp dl, 1 - jb .goto_no_exit - cmp dl, 8 - ja .goto_no_exit - ; - ; IF (GALAXY (IQX,IQY) > 899) GOTO NOEXIT - ; - xchg eax, edx - call TArray_GetGalaxyValue - cmp ecx, 899 - ja .goto_no_exit - - cmp [esp + loc52.bIRUN], 0 - jne .L86 - - cmp [esp + loc52.chIENM], CHAR_SCOM - je .L85 - ; - ; Check if quadrant IQX,IQY will be an intrusion to another COMMANDER - ; - mcLoadLocal esi, loc52.pTrekData - movzx ecx, [esi + TREKDATA.REMCOM] - lea edi, [esi + TREKDATA.CY] - add esi, TREKDATA.CX - mcLoadLocal al, loc52.nIQX - mcLoadLocal dl, loc52.nIQY - -.check_intrusion: - cmp [esi], al - jne .next_commander - - cmp [edi], dl - je .goto_no_exit - -.next_commander: - inc esi - inc edi - loop .check_intrusion - ; - ; Romulans do not leave! - ; - cmp [esp + loc52.chIENM], CHAR_ROMULAN - je .goto_no_exit - ; - ; Do not leave if attacking a base - ; - mcLoadLocal esi, loc52.pTrekData - mov al, [esi + TREKDATA.QUADX] - cmp al, [esi + TREKDATA.BATX] - jne .L85 - - mov al, [esi + TREKDATA.QUADY] - cmp al, [esi + TREKDATA.BATY] - je .goto_no_exit - -.L85: - ; - ; IF (KPOWER (LOCCOM) > 1000.0) GOTO NOEXIT - ; - mcLoadLocal esi, loc52.pTrekData - mcLoadLocal ecx, loc52.nLOCCOM - lea ebx, [esi + TREKDATA.KPOWER] - dec ecx - imul ecx, 10 - fld tbyte [ebx + ecx] - fld [glb_dbl_1000] - mc_CMP_ST0_ST1 - jc .goto_no_exit - -.L86: - ; - ; Print escape message and bail out of quadrant! - ; - call TConsole_SetGameMsgAttr - call TConsole_Cram3Asterisks - mcLoadLocal al, loc52.chIENM - call TConsole_CramEnemy - - mov ecx, 598 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal al, loc52.nIQX - mcLoadLocal dl, loc52.nIQY - call TConsole_CramLoc - - mov ecx, 599 - call TConsole_Prout - - mcLoadLocal ecx, loc52.nLOCCOM - call TArray_Leave - dec [esp + loc52.nI] - ; - ; Handle galaxy matrix - ; - call TArray_MyGalaxyPtr - sub dword [ebx], 100 - - mcLoadLocal al, loc52.nIQX - mcLoadLocal dl, loc52.nIQY - call TArray_GalaxyPtr - add dword [ebx], 100 - - cmp [esp + loc52.chIENM], CHAR_COMMANDER - je .L87 - cmp [esp + loc52.chIENM], CHAR_SCOM - jne .L500 - - mcLoadLocal esi, loc52.pTrekData - mcZeroBits eax - mov [esi + TREKDATA.ISHERE], al - mov [esi + TREKDATA.ISCATE], al - mov [esi + TREKDATA.IENTESC], al - mov [esi + TREKDATA.ISATB], al - - fld [esi + TREKDATA.DATE] - fld [glb_dbl_0dot2777] - faddp - fstp [esi + TREKDATA.FUTURE6] - - fld [glb_dbl_1E38] - fstp [esi + TREKDATA.FUTURE7] - - mcLoadLocal al, loc52.nIQX - mcLoadLocal dl, loc52.nIQY - mov [esi + TREKDATA.ISX], al - mov [esi + TREKDATA.ISY], dl - jmp .L500 - -.L87: - mcLoadLocal ebx, loc52.pTrekData - mcLoadMemberRef esi, TREKDATA.CX - mcLoadMemberRef edi, TREKDATA.CY - movzx ecx, [ebx + TREKDATA.REMCOM] - mcLoadMember al, TREKDATA.QUADX - mcLoadMember dl, TREKDATA.QUADY - -.find_commander: - cmp [esi], al - jne .get_next_commander - - cmp [edi], dl - je .L100 - -.get_next_commander: - inc esi - inc edi - loop .find_commander - - ;int 3 - jmp .L500 - -.L100: - mcLoadLocal al, loc52.nIQX - mcLoadLocal dl, loc52.nIQY - mov [esi], al - mov [edi], dl - - mcLoadLocal edi, loc52.pTrekData - mov [edi + TREKDATA.COMHERE], 0 - -.L500: - mcLoadLocal esi, loc52.pTrekData - movzx ecx, [esi + TREKDATA.NENHERE] - inc [esp + loc52.nI] - cmp [esp + loc52.nI], ecx - jbe .L1 - - call TCommon_SortKlingons - -.done: - mcEndLocals loc52.size - ret - -; -------------------------------------------------------------------------- -; ATTACK -; -------------------------------------------------------------------------- -virtual at 0 -loc36: - .pTrekData PVOID ? - .bIHURT BOOL ? - .bATTACKED BOOL ? - .dbl_HITMAX DOUBLE ? - .dbl_HITTOT DOUBLE ? - .dbl_DUSTFAC DOUBLE ? - .dbl_HIT DOUBLE ? - .nL INDEX ? - .nNENHERE COUNT ? - .pKPOWER PDOUBLE ? - .pKDIST PDOUBLE ? - .pKX PBYTE ? - .pKY PBYTE ? - .chIQUAD BYTE ? - .ch1 BYTE ? - .ch2 BYTE ? - .ch3 BYTE ? - .nPERCENT INT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TAttack_Main: - mcBeginLocals loc36.size - - mcLoadGameDataPtr esi - mcStoreLocal loc36.pTrekData, esi - - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - - cmp [esi + TREKDATA.ITHERE], 0 - je .check_neutral_zone - - push esi - call TEvents_MoveTholian - pop esi - -.check_neutral_zone: - cmp [esi + TREKDATA.NEUTZ], 0 - je .L1 - - dec [esi + TREKDATA.NEUTZ] - jmp .done - -.L1: - cmp [esi + TREKDATA.NENHERE], 0 - je .done - - movzx eax, [esi + TREKDATA.NENHERE] - mcStoreLocal loc36.nNENHERE, eax - - lea eax, [esi + TREKDATA.KPOWER] - lea edx, [esi + TREKDATA.KDIST] - lea edi, [esi + TREKDATA.KX] - lea ecx, [esi + TREKDATA.KY] - mcStoreLocal loc36.pKPOWER, eax - mcStoreLocal loc36.pKDIST, edx - mcStoreLocal loc36.pKX, edi - mcStoreLocal loc36.pKY, ecx - - mov al, [esi + TREKDATA.ISHERE] - add al, [esi + TREKDATA.COMHERE] - mcOnRegZero al, .check_skill - - cmp [esi + TREKDATA.JUSTIN], 0 - jne .check_skill - -.move_enemies: - call TAttack_MoveCommanders - invoke Sleep, 200 - - mcLoadLocal esi, loc36.pTrekData - movzx eax, [esi + TREKDATA.NENHERE] - mcStoreLocal loc36.nNENHERE, eax - jmp .hit_the_ship - -.check_skill: - cmp [esi + TREKDATA.KSTUF5], 2 - je .move_enemies - -.hit_the_ship: - mcZeroBits eax - mcStoreLocal loc36.bIHURT, eax - mcStoreLocal loc36.bATTACKED, eax - mcStoreLocal loc36.nL, eax - call TConsole_ScrollUp - - fldz - fldz - fstp [esp + loc36.dbl_HITMAX] - fstp [esp + loc36.dbl_HITTOT] - jmp .L5 - -.next_evil_doer: - inc [esp + loc36.pKX] - inc [esp + loc36.pKY] - add [esp + loc36.pKPOWER], 10 - add [esp + loc36.pKDIST], 10 - -.L5: - inc [esp + loc36.nL] - mcLoadLocal ecx, loc36.nL - cmp ecx, [esp + loc36.nNENHERE] - ja .L80 - ; - ; If ship is docked - no hits! - ; - mcLoadLocal esi, loc36.pTrekData - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .L6 - - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 241 - call TConsole_Cram - call TConsole_CramShip - call TConsole_ScrollUp - call TConsole_ScrollUp - jmp .done - -.L6: - ; - ; If enemy's power is negative - they can't attack - ; - mcLoadLocal esi, loc36.pKPOWER - fldz - fld tbyte [esi] - mc_CMP_ST0_ST1 - jc .next_evil_doer - jz .next_evil_doer - - inc [esp + loc36.bATTACKED] - - call TRandom_Ranf - fld [glb_dbl_0dot05] - fmulp - fld [glb_dbl_0dot8] - faddp - fstp [esp + loc36.dbl_DUSTFAC] - - mcLoadLocalRef esi, loc36.dbl_DUSTFAC - mcLoadLocal edi, loc36.pKDIST - - call TCommon_X_exp_Y - mcLoadLocal ebx, loc36.pKPOWER - fld tbyte [ebx] - fmulp - fstp [esp + loc36.dbl_HIT] - - mcLoadLocal esi, loc36.pKX - mcLoadLocal edi, loc36.pKY - mov al, [esi] - mov dl, [edi] - call TArray_QuadPtr - mov al, [ebx] - mcStoreLocal loc36.chIQUAD, al - ; - ; Decide if enemy will fire a torpedo. - ; - fld [esp + loc36.dbl_HIT] - fld [glb_dbl_400] - mc_CMP_ST0_ST1 - jc .L10 - - mcLoadLocal esi, loc36.pTrekData - cmp [esi + TREKDATA.JUSTIN], 1 - je .L10 - - fld [glb_dbl_300] - fld [esp + loc36.dbl_HIT] - mc_CMP_ST0_ST1 - jc .check_enemy_type - - mcLoadLocal edi, loc36.pKDIST - fld tbyte [edi] - fld [glb_dbl_5] - mc_CMP_ST0_ST1 - jc .L10 - -.check_enemy_type: - cmp [esp + loc36.chIQUAD], CHAR_KLINGON - jne .torpedo_fired - - call TRandom_Ranf - fld [glb_dbl_0dot1] - mc_CMP_ST0_ST1 - jc .L10 - -.torpedo_fired: - mcLoadLocal edi, loc36.pTrekData - mov [edi + TREKDATA.IPHWHO], 1 - - mcLoadLocal eax, loc36.nL - mov [edi + TREKDATA.KSHOT], al - push edi - call KPHOTON - pop edi - - mov [edi + TREKDATA.IPHWHO], 127 - mov [edi + TREKDATA.KDIDIT], 1 - - cmp [edi + TREKDATA.ALLDONE], 0 - jne .done - - call TArray_MyGalaxyPtr - cmp dword [ebx], 1000 - je .done - jmp .next_evil_doer - -.L10: - ; - ; Enemy fires a disruptor weapon - ; - mcLoadLocal ecx, loc36.nL - mcLoadLocalRef esi, loc36.dbl_HIT - mcLoadLocalRef edi, loc36.bIHURT - call TAttack_Zap - - fld [esp + loc36.dbl_HIT] - fld [esp + loc36.dbl_HITTOT] - faddp - fstp [esp + loc36.dbl_HITTOT] - - fld [esp + loc36.dbl_HITTOT] - fld [esp + loc36.dbl_HITMAX] - call TCommon_FPU_Max - fstp [esp + loc36.dbl_HITMAX] - ; - ; Loop for enemy attacks ends here - ; - jmp .next_evil_doer - -.L80: - cmp [esp + loc36.bATTACKED], 0 - je .done - - fld [esp + loc36.dbl_HITTOT] - fldz - mc_CMP_ST0_ST1 - jz .done - - mcLoadLocal esi, loc36.pTrekData - fldz - fld [esi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jc .L100 - jz .L100 - - fld [esi + TREKDATA.SHLD] - fld [esi + TREKDATA.INSHLD] - fdivp - fld [glb_dbl_100] - fmulp - frndint - call TCommon_FP_Truncate - mcStoreLocal loc36.nPERCENT, eax - - cmp [esp + loc36.bIHURT], 0 - jne .L85 - - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 247 - call TConsole_Cram - jmp .L90 - -.L85: - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - - mcLoad8bitsToReg32 ecx, 248 - call TConsole_Cram - - mcLoadLocal esi, loc36.pTrekData - mov cl, 2 - fld [esi + TREKDATA.ENERGY] - call TConsole_CramFloat - - mcLoad8bitsToReg32 ecx, 249 - call TConsole_Cram - - mcLoadLocal esi, loc36.pTrekData - movzx eax, [esi + TREKDATA.TORPS] - call TConsole_CramInt - - mcLoad8bitsToReg32 ecx, 250 - call TConsole_Cram - - mov cl, DEV_SHIELDS - call TArray_IsDamaged - jc .shields_damaged - - mcLoadLocal esi, loc36.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - je .shields_down - - push 251 - jmp .cram_shield_state - -.shields_down: - push 252 - jmp .cram_shield_state - -.shields_damaged: - push 253 - -.cram_shield_state: - pop ecx - call TConsole_Cram - -.L90: - mcLoadLocal eax, loc36.nPERCENT - call TConsole_CramInt - mov al, '%' - call TConsole_PutChar - call TConsole_ScrollUp - ; - ; Check for casualties. - ; - fld [glb_dbl_200] - fld [esp + loc36.dbl_HITMAX] - mc_CMP_ST0_ST1 - jc .check_total_hit - -.get_casualties: - fld [esp + loc36.dbl_HITTOT] - call TAttack_Casualties - call TConsole_SetGameMsgAttr - -.L120: - call TCommon_SortKlingons - jmp .done - -.check_total_hit: - fld [glb_dbl_500] - fld [esp + loc36.dbl_HITTOT] - mc_CMP_ST0_ST1 - jc .L120 - jmp .get_casualties - -.L100: - mov al, 5 - call TFinish_Main - -.done: - mcEndLocals loc36.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TChart.Asm b/programs/games/StarTrek/trunk/TChart.Asm deleted file mode 100644 index 44769bc496..0000000000 --- a/programs/games/StarTrek/trunk/TChart.Asm +++ /dev/null @@ -1,317 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TChart.Asm -; DATE: October 12, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; EAX = X quadrant coordinate -; EDX = Y quadrant coordinate -; -------------------------------------------------------------------------- -align PROC_ALIGN -TChart_SetQuadAttr: - push ebx ecx - - mcLoadGameDataPtr ebx - cmp al, [ebx + TREKDATA.QUADX] - jne .no_ship_here - cmp dl, [ebx + TREKDATA.QUADY] - je .ship_here - -.no_ship_here: - call TArray_IsScanned - jc .set_scanned_color - - mov cl, ATTR_REPORT_VALUE - jmp .apply - -.set_scanned_color: - mov cl, ATTR_PLANET - jmp .apply - -.ship_here: - mov cl, ATTR_SHIP_QUAD - -.apply: - call TConsole_SetAttr - pop ecx ebx - ret - -; -------------------------------------------------------------------------- -; CHART -; -------------------------------------------------------------------------- -virtual at 0 -loc25: - .nI INDEX ? - .nJ INDEX ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TChart_Main: - mcBeginLocals loc25.size - - mov cl, ATTR_REPORT_TEXT - call TConsole_SetAttr - mcLoad8bitsToReg32 ecx, 136 - call TConsole_Prout - - mov cl, ATTR_SCAN_SCALE - call TConsole_SetAttr - mcLoad8bitsToReg32 ecx, 137 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 138 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 139 - call TConsole_Prout - - mcLoad1 eax - mcStoreLocal loc25.nI, eax - -.row_begins: - mov cl, ATTR_SCAN_SCALE - call TConsole_SetAttr - - mcLoadLocal eax, loc25.nI - call TConsole_CramInt - mcLoad8bitsToReg32 ecx, 140 - call TConsole_Cram - - mcLoad1 ecx - mcStoreLocal loc25.nJ, ecx - -.load_chart_value: - mcLoadLocal eax, loc25.nI - mcLoadLocal edx, loc25.nJ - - call TChart_SetQuadAttr - - call TArray_GetStarChartValue - add ecx, 0 - js .L10 - jz .L20 - - cmp ecx, 999 - ja .L35 - - call TArray_GetGalaxyValue - mov eax, ecx - -.put_value: - mov cl, 5 - call TConsole_CramIntWidth - jmp .L40 - -.L35: - lea eax, [ecx - 1000] - jmp .put_value - -.L40: - inc [esp + loc25.nJ] - cmp [esp + loc25.nJ], 8 - jbe .load_chart_value - - mov cl, ATTR_SCAN_SCALE - call TConsole_SetAttr - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 139 - call TConsole_Prout - - inc [esp + loc25.nI] - cmp [esp + loc25.nI], 8 - jbe .row_begins - - call TConsole_ScrollUp - mov cl, ATTR_REPORT_TEXT - call TConsole_SetAttr - mov cl, 2 - call TConsole_RepeatBlank - call TConsole_CramShip - mcLoad8bitsToReg32 ecx, 143 - call TConsole_Cram - mov cl, 1 - mcLoadGameDataPtr esi - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - call TConsole_CramLoc - jmp .done - -.L10: - mcLoad8bitsToReg32 ecx, 141 - -.L101: - call TConsole_Cram - jmp .L40 - -.L20: - mcLoad8bitsToReg32 ecx, 142 - jmp .L101 - -.done: - call TConsole_ScrollUp - call TConsole_ScrollUp - - mcEndLocals loc25.size - ret - -; -------------------------------------------------------------------------- -; SETWARP -; -------------------------------------------------------------------------- -virtual at 0 -loc51: - .pTrekData PVOID ? - .dbl_OLDFAC DOUBLE ? - .dbl_FNUM DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TChart_SetWarp: - mcBeginLocals loc51.size - - mcLoadGameDataPtr esi - mcStoreLocal loc51.pTrekData, esi - -.L10: - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - jne .L20 - - mov ecx, 585 - call TGame_Prompt - jmp .L10 - -.L20: - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L40 - - fld [ebx + TCmdBuf.cmdbuf_FNUM] - fstp [esp + loc51.dbl_FNUM] - - mov cl, DEV_WARP_ENGINES - call TArray_GetDblDamage - fld [glb_dbl_Ten] - mc_CMP_ST0_ST1 - jc .L70 - - mov cl, DEV_WARP_ENGINES - call TArray_IsDamaged - jnc .validate_warp - - fld [esp + loc51.dbl_FNUM] - fld [glb_dbl_4] - mc_CMP_ST0_ST1 - jc .L80 - -.validate_warp: - fld1 - fld [esp + loc51.dbl_FNUM] - mc_CMP_ST0_ST1 - jc .L50 - - fld [esp + loc51.dbl_FNUM] - fld [glb_dbl_Ten] - mc_CMP_ST0_ST1 - jc .L60 - - mcLoadLocal esi, loc51.pTrekData - fld [esi + TREKDATA.WARPFAC] - fstp [esp + loc51.dbl_OLDFAC] - - fld [esp + loc51.dbl_FNUM] - fstp [esi + TREKDATA.WARPFAC] - - fld [esp + loc51.dbl_FNUM] - fld st - fmulp - fstp [esi + TREKDATA.WFACSQ] - - fld [esp + loc51.dbl_OLDFAC] - fld [esi + TREKDATA.WARPFAC] - mc_CMP_ST0_ST1 - jc .L31 - jz .L31 - - fld [glb_dbl_6] - fld [esi + TREKDATA.WARPFAC] - mc_CMP_ST0_ST1 - jc .L31 - jz .L31 - - fld [glb_dbl_8] - fld [esi + TREKDATA.WARPFAC] - mc_CMP_ST0_ST1 - jc .L32 - jmp .L33 - -.L31: - call TConsole_SetCrewMsgAttr - mov ecx, 586 - call TConsole_Cram - - mcLoadLocal esi, loc51.pTrekData - fld [esi + TREKDATA.WARPFAC] - mov cl, 1 - call TConsole_CramFloat - - mov ecx, 587 - call TConsole_Prout - jmp .done - -.L32: - call TConsole_SetCrewMsgAttr - mov ecx, 588 - call TConsole_Prout - jmp .done - -.L33: - mcLoadLocal esi, loc51.pTrekData - fld [esi + TREKDATA.WARPFAC] - fld [glb_dbl_Ten] - mc_CMP_ST0_ST1 - jz .L36 - - call TConsole_SetCrewMsgAttr - mov ecx, 589 - call TConsole_Prout - jmp .done - -.L36: - call TConsole_SetCrewMsgAttr - mov ecx, 590 - call TConsole_Prout - jmp .done - -.L40: - call TMove_BegPardon - jmp .done - -.L50: - call TConsole_SetCrewMsgAttr - mov ecx, 591 - call TConsole_Prout - jmp .done - -.L60: - call TConsole_SetCrewMsgAttr - mov ecx, 592 - call TConsole_Prout - jmp .done - -.L70: - mov ecx, 593 - call TConsole_ProutGameMsg - jmp .done - -.L80: - call TConsole_SetCrewMsgAttr - mov ecx, 594 - call TConsole_Prout - mov ecx, 595 - call TConsole_Prout - -.done: - mcEndLocals loc51.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TCmdBuf.Asm b/programs/games/StarTrek/trunk/TCmdBuf.Asm deleted file mode 100644 index 0e0e6f7a1b..0000000000 --- a/programs/games/StarTrek/trunk/TCmdBuf.Asm +++ /dev/null @@ -1,529 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TCmdBuf.Asm -; DATE: September 27, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; ESI = ANSI token scanned -; CL = ANSI text to match (1-based index into message table) -; Output: -; CF=TRUE if first token exactly matches text at index in CL -; CF=FALSE if no match (message given to the user) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_VerifyToken: - movzx ecx, cl - -TCmdBuf_VerifyToken_ECX: - push esi - call TMsgTable_GetItem - pop edi - - call TString_AnsiEqual - jnc .ret_false - ret - -.ret_false: - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 93 - call TConsole_Prout - call TConsole_ScrollUp - - clc - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = ANSI token scanned -; ECX = ANSI text to match (1-based index into message table) -; Output: -; CF=TRUE if text at EDI has a prefix like ESI -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_Crop: - push esi esi - call TMsgTable_GetItem - mov edi, esi - pop esi - - mcZeroBits edx - mcZeroBits eax - -.load_chars: - lodsb - mov dl, [edi] - inc edi - - cmp dl, al - je .check_zero - - mcOnRegZero eax, .match - - pop esi - clc - ret - -.check_zero: - mcOnRegNotZero eax, .load_chars - -.match: - pop esi - stc - ret - -; -------------------------------------------------------------------------- -; Input: -; AX = WCHAR to append -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_PutChar: - mov ebx, [glb_pCmdBuf] - cmp [ebx + TCmdBuf.cmdbuf_CmdColumn], CMDBUF_MAX_CHARS - je .done - - mcLoadMember ecx, TCmdBuf.cmdbuf_CmdColumn - mov [ebx + ecx*2], ax - inc [ebx + TCmdBuf.cmdbuf_CmdColumn] - -.done: - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_Parse: - mcZeroBits eax - call TCmdBuf_PutChar - - mov ebx, [glb_pCmdBuf] - mcStoreMember TCmdBuf.cmdbuf_NumTokens, eax - mcStoreMember TCmdBuf.cmdbuf_CmdColumn, eax - - dec eax - mcStoreMember TCmdBuf.cmdbuf_TokenIterator, eax - inc eax - - mov esi, ebx - mov edx, eax - mcLoadMemberRef edi, TCmdBuf.cmdbuf_CmdTokens - -.load_char: - lodsw - mcOnRegZero eax, .done - - cmp al, CHAR_BLANK - je .separator - - mcOnRegNotZero edx, .load_char - - lea edx, [esi - 2] - mov [edi], edx - add edi, 4 - inc [ebx + TCmdBuf.cmdbuf_NumTokens] - cmp [ebx + TCmdBuf.cmdbuf_NumTokens], CMDBUF_MAX_TOKENS - je .done - jmp .load_char - -.separator: - mcZeroBits edx - mov [esi - 2], dx - jmp .load_char - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = character -; Output: -; CF = TRUE if AL is a digit -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_IsDigit: - cmp al, '0' - jb .false - - cmp al, '9' - ja .false - - stc - ret - -.false: - clc - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = token address -; Output: -; CF = TRUE if token is a real value: "-100" or "5.6" -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_IsRealToken: - mcZeroBits ecx - mcZeroBits eax - mcZeroBits edi - -.load_char: - mov ax, [esi + ecx*2] - inc ecx - mcOnRegZero eax, .true - - mcOnRegEqu al, '-', .minus - mcOnRegEqu al, '.', .period - ; - ; Check if digit - ; - call TCmdBuf_IsDigit - jc .load_char - -.false: - clc - ret - -.minus: - mcOnRegEqu ecx, 1, .load_char - jmp .false - -.period: - mcOnRegNotZero edi, .false - mov edi, esi - jmp .load_char - -.true: - stc - ret - -; -------------------------------------------------------------------------- -; Output: -; ESI = token address or NULL -; EAX = token type (CMD_TOKEN_ALPHA, CMD_TOKEN_REAL, CMD_TOKEN_EOL) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_GetNextToken: - mov ebx, [glb_pCmdBuf] - inc [ebx + TCmdBuf.cmdbuf_TokenIterator] - - mcLoadMember ecx, TCmdBuf.cmdbuf_TokenIterator - cmp ecx, [ebx + TCmdBuf.cmdbuf_NumTokens] - jae .end_of_line - - mov esi, [ebx + ecx*4 + TCmdBuf.cmdbuf_CmdTokens] - call TCmdBuf_IsRealToken - jc .real_value - - mcLoad8bitsToReg32 eax, CMD_TOKEN_ALPHA - ret - -.real_value: - mcLoad8bitsToReg32 eax, CMD_TOKEN_REAL - ret - -.end_of_line: - mcZeroBits eax - mcZeroBits esi - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = ANSI text -; AL = character to find -; Output: -; ECX = character offset (CF=TRUE) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_AnsiFindChar: - mcZeroBits ecx - -.test_char: - cmp byte [esi + ecx], 0 - je .not_found - - cmp [esi + ecx], al - je .found - - inc ecx - jmp .test_char - -.found: - stc - ret - -.not_found: - clc - ret - -; -------------------------------------------------------------------------- -; Output: -; EBX = TCmdBuf instance -; ESI = ANSI token scanned -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_Scan: - call TCmdBuf_GetNextToken - mcStoreMember TCmdBuf.cmdbuf_KEY, al - - mcZeroBits edx - mcStoreMember TCmdBuf.cmdbuf_INUM, edx - mcStoreMember TCmdBuf.cmdbuf_AnsiTokenBuf, dl - - fldz - fstp [ebx + TCmdBuf.cmdbuf_FNUM] - - mcOnRegZero esi, .done - ; - ; Convert the token into ANSI - ; - mcLoadMemberRef edi, TCmdBuf.cmdbuf_AnsiTokenBuf - mov eax, edx - -.convert_char: - lodsw - stosb - mcOnRegNotZero eax, .convert_char - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_ALPHA - je .done - - mcLoadMemberRef esi, TCmdBuf.cmdbuf_AnsiTokenBuf - mov al, '.' - call TCmdBuf_AnsiFindChar - jc .set_fp_num - ; - ; Integer value scanned - ; - call TCmdBuf_AnsiStr2Int32 - mcStoreMember TCmdBuf.cmdbuf_INUM, eax - - fild [ebx + TCmdBuf.cmdbuf_INUM] - fstp [ebx + TCmdBuf.cmdbuf_FNUM] - jmp .done - -.set_fp_num: - ; - ; FP value scanned - ; - mcLoadMemberRef edi, TCmdBuf.cmdbuf_FNUM - call TCmdBuf_AnsiStr2Double - -.done: - mcLoadMemberRef esi, TCmdBuf.cmdbuf_AnsiTokenBuf - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = ANSI text -; Output: -; ECX = number of characters in the string -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_AnsiStrLen: - push edx - - mcZeroBits ecx - mcZeroBits edx - -.check_char: - cmp [esi + ecx], dl - je .done - - inc ecx - jmp .check_char - -.done: - pop edx - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = ANSI text -; Output: -; EAX = converted value -; -------------------------------------------------------------------------- -virtual at 0 -loc5: - .bNegative BOOL ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_AnsiStr2Int32: - mcBeginLocals loc5.size - - mcZeroBits eax - mcZeroBits edx - mcStoreLocal loc5.bNegative, eax - - cmp byte [esi], '-' - jne .convert - - inc [esp + loc5.bNegative] - inc esi - -.convert: - mov dl, [esi] - mcOnRegZero edx, .apply_sign - - sub dl, '0' - inc esi - imul eax, 10 - add eax, edx - jmp .convert - -.apply_sign: - cmp byte [esp + loc5.bNegative], 0 - je .done - - neg eax - -.done: - mcEndLocals loc5.size - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = text -; EDI = pointer to DOUBLE value -; -------------------------------------------------------------------------- -virtual at 0 -loc6: - .pszDot PCHAR ? - .pszValue PCHAR ? - .bNegative BOOL ? - .iPart1 INT32 ? - .iPart2 INT32 ? - .pDblResult PDOUBLE ? - .dblPart1 DOUBLE ? - .dblPart2 DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_AnsiStr2Double: - mcBeginLocals loc6.size - mcStoreLocal loc6.pszValue, esi - mcStoreLocal loc6.pDblResult, edi - - mcZeroBits eax - mcStoreLocal loc6.bNegative, eax - mcStoreLocal loc6.pszDot, eax - - cmp byte [esi], '-' - jne .parse - - inc [esp + loc6.bNegative] - inc [esp + loc6.pszValue] - inc esi - -.parse: - lodsb - mcOnRegZero eax, .analysis - mcOnRegEqu al, '.', .dot - jmp .parse - -.dot: - lea edx, [esi - 1] - mcStoreLocal loc6.pszDot, edx - jmp .parse - -.analysis: - cmp byte [esp + loc6.pszDot], 0 - jne .combine_parts - ; - ; No decimal point - ; - mcLoadLocal esi, loc6.pszValue - call TCmdBuf_AnsiStr2Int32 - mcStoreLocal loc6.iPart1, eax - - fild [esp + loc6.iPart1] - jmp .apply_sign - -.combine_parts: - mcLoadLocal edi, loc6.pszDot - mcZeroBits al - stosb - - fldz - fldz - fstp [esp + loc6.dblPart1] - fstp [esp + loc6.dblPart2] - - mov esi, edi - call TCmdBuf_AnsiStr2Int32 - mcStoreLocal loc6.iPart2, eax - - mcLoadLocal esi, loc6.pszValue - call TCmdBuf_AnsiStr2Int32 - mcStoreLocal loc6.iPart1, eax - - mcLoadLocal esi, loc6.pszDot - inc esi - call TCmdBuf_AnsiStrLen - jecxz .combine - - fild [esp + loc6.iPart2] -@@: - fld [glb_dbl_Ten] - fdivp - loop @r - - fstp [esp + loc6.dblPart2] - -.combine: - fild [esp + loc6.iPart1] - fld [esp + loc6.dblPart2] - faddp - -.apply_sign: - cmp byte [esp + loc6.bNegative], 0 - je .done - - fchs - -.done: - mcLoadLocal edi, loc6.pDblResult - fstp tbyte [edi] - - mcEndLocals loc6.size - ret - -; -------------------------------------------------------------------------- -; Output: -; CF = TRUE if buffer has no characters -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_IsEmpty: - mov ebx, [glb_pCmdBuf] - cmp [ebx + TCmdBuf.cmdbuf_CmdColumn], 0 - sete cl - shr cl, 1 - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_Backspace: - mov ebx, [glb_pCmdBuf] - cmp [ebx + TCmdBuf.cmdbuf_CmdColumn], 0 - je .done - - dec [ebx + TCmdBuf.cmdbuf_CmdColumn] - -.done: - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCmdBuf_Create: - invoke HeapAlloc, [glb_Allocator], HEAP_NO_SERIALIZE, TCmdBuf.size - mov [glb_pCmdBuf], eax - - mov edi, eax - mcZeroBits eax - mov ecx, TCmdBuf.size - rep stosb - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TCmdBuf.Inc b/programs/games/StarTrek/trunk/TCmdBuf.Inc deleted file mode 100644 index f197988a16..0000000000 --- a/programs/games/StarTrek/trunk/TCmdBuf.Inc +++ /dev/null @@ -1,37 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TCmdBuf.Inc -; DATE: September 27, 2008 -; -------------------------------------------------------------------------- - -CMDBUF_ROOM_CHARS = 64 -CMDBUF_MAX_CHARS = (CMDBUF_ROOM_CHARS - 1) -CMDBUF_MAX_TOKENS = 16 - -; -------------------------------------------------------------------------- -CMD_TOKEN_EOL = 0 -CMD_TOKEN_REAL = 1 -CMD_TOKEN_ALPHA = 2 -CMD_TOKEN_ERROR = 3 - -; -------------------------------------------------------------------------- -virtual at 0 -TCmdBuf: - .cmdbuf_FullBuffer WCHARS CMDBUF_ROOM_CHARS - .cmdbuf_CmdColumn INDEX ? - .cmdbuf_CmdTokens STRINGS CMDBUF_MAX_TOKENS - .cmdbuf_NumTokens COUNT ? - .cmdbuf_TokenIterator INDEX ? - .cmdbuf_AnsiTokenBuf CHARS CMDBUF_ROOM_CHARS - ; - ; If scanned token is of type CMD_TOKEN_REAL - ; then following section is filled, otherwise - ; all following members are set to zero - ; - .cmdbuf_INUM INT32 ? - .cmdbuf_FNUM DOUBLE ? - .cmdbuf_KEY BYTE ? - .cmdbuf_Reserved BYTE ? - .size = $ -end virtual - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TCommon.Asm b/programs/games/StarTrek/trunk/TCommon.Asm deleted file mode 100644 index a786a6fd05..0000000000 --- a/programs/games/StarTrek/trunk/TCommon.Asm +++ /dev/null @@ -1,1644 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TCommon.Asm -; DATE: October 4, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AbsEAX: - add eax, 0 - js .flip_negative - ret - -.flip_negative: - neg eax - ret - -; -------------------------------------------------------------------------- -; Input: -; ST(0) = DOUBLE value B -; ST(1) = DOUBLE value A -; Output: -; ST(0) = A with a sign of B -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_FPU_SignAB: - mcZeroBits eax - fldz - mc_CMP_ST0_ST1 - adc eax, eax ; EAX=1 if B is positive - - fabs - mcOnRegZero eax, .negative - ret - -.negative: - fchs - ret - -; -------------------------------------------------------------------------- -; Input: -; ST(0) = DOUBLE value #1 -; ST(1) = DOUBLE value #2 -; Output: -; ST(0) = maximum of two values -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_FPU_Max: - mcBeginLocals 16 - - fld st - fstp tbyte [esp] - - fcomip st, st1 - jc .done - - fstp [glb_dbl_FpuPopper] - fld tbyte [esp] - -.done: - mcEndLocals 16 - ret - -; -------------------------------------------------------------------------- -; Input: -; ST(0) = DOUBLE value #1 -; ST(1) = DOUBLE value #2 -; Output: -; ST(0) = minimum of two values -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_FPU_Min: - mcBeginLocals 16 - - fld st - fstp tbyte [esp] - - fcomip st, st1 - jnc .done - - fstp [glb_dbl_FpuPopper] - fld tbyte [esp] - -.done: - mcEndLocals 16 - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_Allocate: - mcAllocatePages TCommon.size - mov [glb_pCommon], eax - - add eax, TCommon.GAMEDB - mov [glb_pGameData], eax - ret - -; -------------------------------------------------------------------------- -; EXPRAN -; -------------------------------------------------------------------------- -; Input: -; ST(0) = AVERAGE -; Output: -; ST(0) = -AVERAGE * LOG (RANF(0)) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_ExpRan: - fchs - fld1 - call TRandom_Ranf - fyl2x - fldln2 - fmulp - fmulp - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = byte lo load -; Output: -; ST(0) = DOUBLE loaded for processing -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_LoadByteIntoFPU: - movzx eax, al - mov [glb_FPU_Int32], eax - fild [glb_FPU_Int32] - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = value lo load -; Output: -; ST(0) = DOUBLE loaded for processing -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_FPU_Load_EAX: - mov [glb_FPU_Int32], eax - fild [glb_FPU_Int32] - ret - -; -------------------------------------------------------------------------- -; Input: -; ST(0) = DOUBLE value -; Output: -; EAX = truncated Int32 value -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_FP_Truncate: - fisttp [glb_FPU_Int32] - mov eax, [glb_FPU_Int32] - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = points to DOUBLE X value -; EDI = points to DOUBLE Y value -; Output: -; ST(0) = result X**Y -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_X_exp_Y: - fld tbyte [edi] - fld tbyte [esi] - - fyl2x - - fld st - frndint - - fsub st1, st - fxch - f2xm1 - fld1 - faddp - - fscale - fxch - mcFpuPop - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc12: - .nQuadrants COUNT ? - .nStars COUNT ? - .pQuadrant PINT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AllocateStars: - mcBeginLocals loc12.size - - mcLoad8bitsToReg32 eax, 64 - mcStoreLocal loc12.nQuadrants, eax - - mcLoadGameDataPtr edx - lea edi, [edx + TREKDATA.GALAXY] - mcStoreLocal loc12.pQuadrant, edi - - mcZeroBits ecx - mcStoreLocal loc12.nStars, ecx - -.stars_for_quadrant: - mcLoad8bitsToReg32 edx, 9 - call TRandom_IRan - inc eax - - add [esp + loc12.nStars], eax - mcLoadLocal edi, loc12.pQuadrant - mov [edi], eax - add [esp + loc12.pQuadrant], 4 - - dec [esp + loc12.nQuadrants] - jnz .stars_for_quadrant - - mcLoadLocal eax, loc12.nStars - mcLoadGameDataPtr ebx - mcStoreMember TREKDATA.INSTAR, eax - - mcEndLocals loc12.size - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc13: - .base_IX INT32 ? - .base_IY INT32 ? - .base_DISTQ_max INT32 ? - .loop_I INT32 ? - .loop_J INT32 ? - .loop_LIM INT32 ? - .loop_INBASE INT32 ? - .pBaseQX PINT32 ? - .pBaseQY PINT32 ? - .pGalaxyCell PINT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AllocateBases: - mcBeginLocals loc13.size - - mcLoadGameDataPtr esi - movzx eax, [esi + TREKDATA.INBASE] - mcStoreLocal loc13.loop_INBASE, eax - - sub eax, 6 - neg eax - imul eax, 6 - mcStoreLocal loc13.base_DISTQ_max, eax - - lea edx, [esi + TREKDATA.BASEQX] - lea ecx, [esi + TREKDATA.BASEQY] - mcStoreLocal loc13.pBaseQX, edx - mcStoreLocal loc13.pBaseQY, ecx - - mcLoad1 eax - mcStoreLocal loc13.loop_I, eax - -.L6: - call TRandom_IRan8 - mcStoreLocal loc13.base_IX, eax - mcStoreLocal loc13.base_IY, edx - - call TArray_GalaxyPtr - mcStoreLocal loc13.pGalaxyCell, ebx - - cmp dword [ebx], 10 - jae .L6 - - cmp [esp + loc13.loop_I], 1 - je .L8 - - mcLoadLocal ecx, loc13.loop_I - dec ecx - mcStoreLocal loc13.loop_LIM, ecx - ; - ; Check distances to already set up bases - ; - mcLoad1 eax - mcStoreLocal loc13.loop_J, eax - -.calculate_distance: - mcLoadLocal ecx, loc13.loop_J - dec ecx - - mcLoadLocal esi, loc13.pBaseQX - mcLoadLocal edi, loc13.pBaseQY - - mcLoadLocal edx, loc13.base_IX - mcLoadLocal eax, loc13.base_IY - - sub dl, [esi + ecx] - sub al, [edi + ecx] - - movsx ecx, dl - imul ecx, ecx - - movsx edx, al - imul edx, edx - - add edx, ecx - cmp edx, [esp + loc13.base_DISTQ_max] - jae .L8 - - fld [glb_dbl_0dot75] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .L6 - - inc [esp + loc13.loop_J] - mcLoadLocal ecx, loc13.loop_J - cmp ecx, [esp + loc13.loop_LIM] - jbe .calculate_distance - -.L8: - mcLoadLocal esi, loc13.pBaseQX - mcLoadLocal edi, loc13.pBaseQY - - mcLoadLocal eax, loc13.base_IX - mcLoadLocal edx, loc13.base_IY - - mcLoadLocal ecx, loc13.loop_I - dec ecx - - mov [esi + ecx], al - mov [edi + ecx], dl - - mcLoad8bitsToReg32 ecx, -1 - call TArray_SetStarChartValue - - mcLoadLocal edi, loc13.pGalaxyCell - add dword [edi], 10 - ; - ; Next base... - ; - inc [esp + loc13.loop_I] - mcLoadLocal ecx, loc13.loop_I - cmp ecx, [esp + loc13.loop_INBASE] - jbe .L6 - - mcEndLocals loc13.size - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc14: - .nKREM COUNT ? - .nKLUMP COUNT ? - .nKLUMPER COUNT ? - .nNUM COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AllocateKlingons: - mcBeginLocals loc14.size - - mcLoadGameDataPtr esi - mcZeroBits eax - mov al, [esi + TREKDATA.INKLING] - sub al, [esi + TREKDATA.INCOM] - sub al, [esi + TREKDATA.NSCREM] - mcStoreLocal loc14.nKREM, eax - - movzx edx, [esi + TREKDATA.SKILL] - movzx ecx, [esi + TREKDATA.LENGTH] - sub ecx, 9 - neg ecx - imul ecx, edx - mov [glb_FPU_Int32], ecx - fild [glb_FPU_Int32] - fld [glb_dbl_DOCKFAC] - fmulp - fld1 - faddp - call TCommon_FP_Truncate - - cmp eax, 9 - jbe .store_KLUMPER - - mcLoad8bitsToReg32 eax, 9 - -.store_KLUMPER: - mcStoreLocal loc14.nKLUMPER, eax - -.L10: - call TRandom_Ranf - fld st - fmulp - fld1 - fsubrp - fild [esp + loc14.nKLUMPER] - fmulp - call TCommon_FP_Truncate - - cmp eax, [esp + loc14.nKREM] - jbe .store_KLUMP - - mcLoadLocal eax, loc14.nKREM - -.store_KLUMP: - mcStoreLocal loc14.nKLUMP, eax - - imul eax, 100 - mcStoreLocal loc14.nNUM, eax - -.L15: - call TRandom_IRan8 - call TArray_GalaxyPtr - - mov eax, [ebx] - add eax, [esp + loc14.nNUM] - cmp eax, 999 - ja .L15 - - mcLoadLocal ecx, loc14.nNUM - add [ebx], ecx - - mcLoadLocal edx, loc14.nKLUMP - sub [esp + loc14.nKREM], edx - - cmp [esp + loc14.nKREM], 0 - jne .L10 - - mcEndLocals loc14.size - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc15: - .loop_INCOM COUNT ? - .loop_IY INT32 ? - .loop_IX INT32 ? - .loop_I COUNT ? - .loop_JJ COUNT ? - .loop_IM1 COUNT ? - .pCX PBYTE ? - .pCY PBYTE ? - .pGalaxyCell PINT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AllocateCommanders: - mcBeginLocals loc15.size - - mcLoadGameDataPtr ebx - - lea esi, [ebx + TREKDATA.CX] - lea edi, [ebx + TREKDATA.CY] - mcStoreLocal loc15.pCX, esi - mcStoreLocal loc15.pCY, edi - - movzx ecx, [ebx + TREKDATA.INCOM] - mcStoreLocal loc15.loop_INCOM, ecx - - mcLoad1 eax - mcStoreLocal loc15.loop_I, eax - -.L16: - call TRandom_IRan8 - mcStoreLocal loc15.loop_IY, edx - mcStoreLocal loc15.loop_IX, eax - - call TArray_GalaxyPtr - mcStoreLocal loc15.pGalaxyCell, ebx - - cmp dword [ebx], 99 - jae .check_if_quad_full - - fld [glb_dbl_0dot75] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .L16 - -.check_if_quad_full: - mcLoadLocal esi, loc15.pGalaxyCell - cmp dword [esi], 899 - ja .L16 - - cmp [esp + loc15.loop_I], 1 - je .L17 - ; - ; Verify that quadrant IX,IY does not contain commander already - ; - mcLoadLocal ecx, loc15.loop_I - dec ecx - - mcLoadLocal esi, loc15.pCX - mcLoadLocal edi, loc15.pCY - mcZeroBits ebx - mcZeroBits eax - mcZeroBits edx - -.check_cx_cy: - mov al, [esi + ebx] - mov dl, [edi + ebx] - - cmp eax, [esp + loc15.loop_IX] - jne .next - - cmp edx, [esp + loc15.loop_IY] - je .L16 - -.next: - inc ebx - loop .check_cx_cy - -.L17: - mcLoadLocal edi, loc15.pGalaxyCell - add dword [edi], 100 - - mcLoadLocal ecx, loc15.loop_I - dec ecx - - mcLoadLocal esi, loc15.pCX - mcLoadLocal edi, loc15.pCY - - mcLoadLocal eax, loc15.loop_IX - mcLoadLocal edx, loc15.loop_IY - - mov [esi + ecx], al - mov [edi + ecx], dl - - inc [esp + loc15.loop_I] - mcLoadLocal ecx, loc15.loop_I - cmp ecx, [esp + loc15.loop_INCOM] - jbe .L16 - - mcEndLocals loc15.size - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc16: - .loop_INPLAN COUNT ? - .pPlanet PTPlanet ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AllocatePlanets: - mcBeginLocals loc16.size - - mcLoadGameDataPtr esi - movzx ecx, [esi + TREKDATA.INPLAN] - add esi, TREKDATA.PLNETS - mcStoreLocal loc16.loop_INPLAN, ecx - mcStoreLocal loc16.pPlanet, esi - -.L19: - call TRandom_IRan8 - call TArray_NewStufPtr - - cmp byte [ebx], 0 - jne .L19 - - inc byte [ebx] - mcLoadLocal ebx, loc16.pPlanet - - mov [ebx + TPlanet.planet_X], al - mov [ebx + TPlanet.planet_Y], dl - - mcLoad8bitsToReg32 edx, 3 - call TRandom_IRan - inc eax - mov [ebx + TPlanet.planet_CLASS], al - - call TRandom_Ranf - fld [glb_dbl_1dot2] - fmulp - call TCommon_FP_Truncate - mov [ebx + TPlanet.planet_DILITHIUM], al - - add [esp + loc16.pPlanet], TPlanet.size - dec [esp + loc16.loop_INPLAN] - jnz .L19 - - mcEndLocals loc16.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AllocateRomulans: - mcLoadGameDataPtr esi - movzx ecx, [esi + TREKDATA.NROMREM] - -.L21: - push ecx - - call TRandom_IRan8 - call TArray_NewStufPtr - add byte [ebx], 10 - - pop ecx - loop .L21 - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AllocateSuperCommander: - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.NSCREM], 0 - je .done - -.L22: - call TRandom_IRan8 - call TArray_GalaxyPtr - - cmp dword [ebx], 899 - ja .L22 - - mcLoadGameDataPtr edi - mov [edi + TREKDATA.ISX], al - mov [edi + TREKDATA.ISY], dl - add dword [ebx], 100 - -.done: - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_AllocateThing: - call TRandom_Ranf - fld [glb_dbl_0dot04] - mc_CMP_ST0_ST1 - jc .no_thing - - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.THINGX], -1 - je .no_thing - - call TRandom_IRan8 - mcLoadGameDataPtr ebx - mcStoreMember TREKDATA.THINGX, al - mcStoreMember TREKDATA.THINGY, dl - jmp .done - -.no_thing: - mcZeroBits eax - mcLoadGameDataPtr ebx - mcStoreMember TREKDATA.THINGX, al - mcStoreMember TREKDATA.THINGY, al - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X sector coordinate -; DL = Y sector coordinate -; CH = value to check -; CL = replacement value -; NOTE: -; All registers are saved -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_ReserveSector: - push ebx - - call TArray_QuadPtr - cmp [ebx], ch - jne .done - - mov [ebx], cl - -.done: - pop ebx - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = object character -; Output: -; AL = X sector coordinate -; DL = Y sector coordinate -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_DropIn: - mcBeginLocals 4 - mov [esp], eax - -.try_sector: - call TRandom_IRan10 - call TArray_QuadPtr - - cmp byte [ebx], CHAR_COSMOS - jne .try_sector - - mov ecx, [esp] - mov [ebx], cl - - mcEndLocals 4 - ret - -; -------------------------------------------------------------------------- -; RESETD -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_ResetDist: - call TCommon_NewCondition - - mcLoadGameDataPtr ebx - cmp [ebx + TREKDATA.NENHERE], 0 - je .done - - mcZeroBits ecx - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - -.calc_dist: - movzx eax, [ebx + TREKDATA.SECTX] - movzx edx, byte [esi + ecx] - sub eax, edx - imul eax, eax - push eax - - movzx eax, [ebx + TREKDATA.SECTY] - movzx edx, byte [edi + ecx] - sub eax, edx - imul eax, eax - pop edx - add eax, edx - - call TCommon_FPU_Load_EAX - fsqrt - inc ecx - call TArray_SetDblKDist - - cmp cl, [ebx + TREKDATA.NENHERE] - jbe .calc_dist - -.done: - ret - -; -------------------------------------------------------------------------- -; SORTKL -; -------------------------------------------------------------------------- -virtual at 0 -loc30: - .nEnemies COUNT ? - .pKPower PDOUBLE ? - .pKDist PDOUBLE ? - .bSwitch BOOL ? - .pKX PBYTE ? - .pKY PBYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_SortKlingons: - mcBeginLocals loc30.size - - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.NENHERE], 1 - jbe .done - - lea eax, [esi + TREKDATA.KDIST] - lea ecx, [esi + TREKDATA.KPOWER] - lea edx, [esi + TREKDATA.KX] - lea ebx, [esi + TREKDATA.KY] - - mcStoreLocal loc30.pKDist, eax - mcStoreLocal loc30.pKPower, ecx - mcStoreLocal loc30.pKX, edx - mcStoreLocal loc30.pKY, ebx - - movzx ecx, [esi + TREKDATA.NENHERE] - dec ecx - mcStoreLocal loc30.nEnemies, ecx - -.L10: - mcZeroBits eax - mcStoreLocal loc30.bSwitch, eax - - mcZeroBits ecx - mcZeroBits edx - -.check_distance: - mcLoadLocal esi, loc30.pKDist - fld tbyte [esi + edx + 10] - fld tbyte [esi + edx] - mc_CMP_ST0_ST1 - jc .L20 - jz .L20 - ; - ; Swap items from all arrays - ; - fld tbyte [esi + edx + 10] - fld tbyte [esi + edx] - fstp tbyte [esi + edx + 10] - fstp tbyte [esi + edx] - - mcLoadLocal esi, loc30.pKPower - fld tbyte [esi + edx + 10] - fld tbyte [esi + edx] - fstp tbyte [esi + edx + 10] - fstp tbyte [esi + edx] - - mcLoadLocal esi, loc30.pKX - mov al, [esi + ecx] - xchg al, [esi + ecx + 1] - mov [esi + ecx], al - - mcLoadLocal esi, loc30.pKY - mov al, [esi + ecx] - xchg al, [esi + ecx + 1] - mov [esi + ecx], al - - inc [esp + loc30.bSwitch] - -.L20: - inc ecx - add edx, 10 - cmp ecx, [esp + loc30.nEnemies] - jb .check_distance - - cmp [esp + loc30.bSwitch], 0 - jne .L10 - -.done: - mcEndLocals loc30.size - ret - -; -------------------------------------------------------------------------- -; NEWCOND -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_NewCondition: - mcLoadGameDataPtr ebx - cmp [ebx + TREKDATA.CONDIT], CONDITION_DOCKED - je .done - mov [ebx + TREKDATA.CONDIT], CONDITION_GREEN - - fld [glb_dbl_1000] - fld [ebx + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jnc .check_enemies - - mov [ebx + TREKDATA.CONDIT], CONDITION_YELLOW - -.check_enemies: - call TArray_MyGalaxyPtr - cmp dword [ebx], 99 - ja .condition_red - - call TArray_MyNewStufPtr - cmp byte [ebx], 9 - ja .condition_red - -.done: - ret - -.condition_red: - mcLoadGameDataPtr ebx - mov [ebx + TREKDATA.CONDIT], CONDITION_RED - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_DropBlackHole: - call TRandom_Ranf - fld [glb_dbl_0dot89] - mc_CMP_ST0_ST1 - jc .drop - ret - -.drop: - mov al, CHAR_BLACK_HOLE - call TCommon_DropIn - ret - -; -------------------------------------------------------------------------- -; NEWQUAD -; -------------------------------------------------------------------------- -virtual at 0 -loc23: - .pTrekData PVOID ? - .nQUADNUM INT32 ? - .nPLAN INT32 ? - .nI INT32 ? - .nIX INT32 ? - .nIY INT32 ? - .nSKILL INT32 ? - .pKX PBYTE ? - .pKY PBYTE ? - .nKLHERE COUNT ? - .nNENHERE COUNT ? - .pKPOWER PDOUBLE ? - .nQuadValue INT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_NewQuad: - mcBeginLocals loc23.size - mcLoadGameDataPtr ebx - mcStoreLocal loc23.pTrekData, ebx - - mcZeroBits eax - dec eax - mcStoreMember TREKDATA.LANDED, al - - inc eax - mcStoreMember TREKDATA.BASEX, al - mcStoreMember TREKDATA.BASEY, al - mcStoreMember TREKDATA.KLHERE, al - mcStoreMember TREKDATA.COMHERE, al - mcStoreMember TREKDATA.PLNETX, al - mcStoreMember TREKDATA.PLNETY, al - mcStoreMember TREKDATA.ISHERE, al - mcStoreMember TREKDATA.IRHERE, al - mcStoreMember TREKDATA.IPLANET, al - mcStoreMember TREKDATA.NENHERE, al - mcStoreMember TREKDATA.NEUTZ, al - mcStoreMember TREKDATA.INORBIT, al - mcStoreMember TREKDATA.IENTESC, al - mcStoreMember TREKDATA.ITHERE, al - - inc eax - mcStoreMember TREKDATA.JUSTIN, al - dec eax - - cmp [ebx + TREKDATA.ISCATE], al - je .L5 - - mcStoreMember TREKDATA.ISCATE, al - inc [ebx + TREKDATA.IENTESC] - -.L5: - call TArray_MyGalaxyPtr - mov eax, [ebx] - mcStoreLocal loc23.nQUADNUM, eax - - cmp eax, 999 - ja .L70 - - mcLoad8bitsToReg32 ecx, 100 - mcZeroBits edx - div ecx - mcLoadLocal ebx, loc23.pTrekData - mcStoreMember TREKDATA.KLHERE, al - - call TArray_MyNewStufPtr - movzx eax, byte [ebx] - mcLoad8bitsToReg32 ecx, 10 - mcZeroBits edx - div ecx - mcLoadLocal ebx, loc23.pTrekData - mcStoreMember TREKDATA.IRHERE, al - mcStoreLocal loc23.nPLAN, edx - - mcLoadMember cl, TREKDATA.KLHERE - add cl, al - mcStoreMember TREKDATA.NENHERE, cl - - lea edi, [ebx + TREKDATA.QUAD] - mcLoad8bitsToReg32 ecx, 100 - mov al, CHAR_COSMOS - rep stosb - - mcLoadMember al, TREKDATA.SECTX - mcLoadMember dl, TREKDATA.SECTY - mcLoadMember cl, TREKDATA.SHIP - call TArray_QuadPtr - mov [ebx], cl - - fld [glb_dbl_0dot08] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .L17 - - mcLoadLocal ebx, loc23.pTrekData - mcLoadMemberRef esi, TREKDATA.PASSWD - mov edi, str_THOLIANX - call TString_AnsiEqual - jnc .L23 - -.L17: - call TRandom_TholianSect - mcLoadLocal ebx, loc23.pTrekData - mcStoreMember TREKDATA.ITHX, al - - call TRandom_TholianSect - mcLoadLocal ebx, loc23.pTrekData - mcStoreMember TREKDATA.ITHY, al - - mov dl, al - mcLoadMember al, TREKDATA.ITHX - call TArray_QuadPtr - cmp byte [ebx], CHAR_COSMOS - jne .L17 - - mov byte [ebx], CHAR_THOLIAN - mcLoadLocal edi, loc23.pTrekData - inc [edi + TREKDATA.ITHERE] - - mov cl, CHAR_WEB - mov ch, CHAR_COSMOS - mov al, 1 - mov dl, al - call TCommon_ReserveSector - - mov dl, 10 - call TCommon_ReserveSector - - mov al, 10 - call TCommon_ReserveSector - - mov dl, 1 - call TCommon_ReserveSector - -.L23: - ; - ; Klingons! - ; - mcLoadLocal ebx, loc23.pTrekData - movzx ecx, [ebx + TREKDATA.KLHERE] - mcStoreLocal loc23.nKLHERE, ecx - - imul eax, ecx, 100 - mcStoreLocal loc23.nQuadValue, eax - - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - mcLoad1 eax - mcStoreLocal loc23.pKX, esi - mcStoreLocal loc23.pKY, edi - mcStoreLocal loc23.nI, eax - - mcLoadMemberRef esi, TREKDATA.KPOWER - mcStoreLocal loc23.pKPOWER, esi - - movzx eax, [ebx + TREKDATA.SKILL] - mcStoreLocal loc23.nSKILL, eax - - cmp [esp + loc23.nQUADNUM], 100 - jb .L34 - - mcLoadLocal eax, loc23.nQuadValue - sub [esp + loc23.nQUADNUM], eax - -.put_klingon: - mov al, CHAR_KLINGON - call TCommon_DropIn - mcLoadLocal esi, loc23.pKX - mcLoadLocal edi, loc23.pKY - mcLoadLocal ecx, loc23.nI - dec ecx - mov [esi + ecx], al - mov [edi + ecx], dl - mcStoreLocal loc23.nIX, eax - mcStoreLocal loc23.nIY, edx - - call TRandom_Ranf - fld [glb_dbl_150] - fmulp - mcLoadLocal eax, loc23.nSKILL - imul eax, 25 - add eax, 300 - call TCommon_FPU_Load_EAX - faddp - - mcLoadLocal edi, loc23.pKPOWER - mcLoadLocal ecx, loc23.nI - dec ecx - imul ecx, 10 - fstp tbyte [edi + ecx] - - inc [esp + loc23.nI] - mcLoadLocal edx, loc23.nI - cmp edx, [esp + loc23.nKLHERE] - jbe .put_klingon - ; - ; Commander! - ; - mcLoadLocal ebx, loc23.pTrekData - cmp [ebx + TREKDATA.REMCOM], 0 - je .L32 - - mcLoadMember al, TREKDATA.QUADX - mcLoadMember dl, TREKDATA.QUADY - call TArray_FindCommander - jecxz .L32 - - mcLoadLocal eax, loc23.nIX - mcLoadLocal edx, loc23.nIY - call TArray_QuadPtr - mov byte [ebx], CHAR_COMMANDER - - mcLoadLocal eax, loc23.nSKILL - imul eax, 50 - add eax, 950 - call TCommon_FPU_Load_EAX - call TRandom_Ranf - fld [glb_dbl_400] - fmulp - faddp - mcLoadLocal ecx, loc23.nKLHERE - call TArray_SetDblKPower - - mcLoadLocal ebx, loc23.pTrekData - inc [ebx + TREKDATA.COMHERE] - -.L32: - ; - ; Super-Commander!! - ; - mcLoadLocal ebx, loc23.pTrekData - - mcLoadMember al, TREKDATA.QUADX - cmp al, [ebx + TREKDATA.ISX] - jne .L34 - - mcLoadMember dl, TREKDATA.QUADY - cmp dl, [ebx + TREKDATA.ISY] - jne .L34 - ; - ; He's here!! - ; - mcLoadLocal eax, loc23.nKLHERE - mcStoreLocal loc23.nI, eax - - cmp [ebx + TREKDATA.COMHERE], 0 - je .L33 - - dec [esp + loc23.nI] - mcLoadLocal esi, loc23.pKX - mcLoadLocal edi, loc23.pKY - mcLoadLocal ecx, loc23.nI - dec ecx - movzx eax, byte [esi + ecx] - movzx edx, byte [edi + ecx] - mcStoreLocal loc23.nIX, eax - mcStoreLocal loc23.nIY, edx - -.L33: - mcLoadLocal eax, loc23.nIX - mcLoadLocal edx, loc23.nIY - call TArray_QuadPtr - mov byte [ebx], CHAR_SCOM - - mcLoadLocal eax, loc23.nSKILL - imul eax, 125 - add eax, 1175 - call TCommon_FPU_Load_EAX - call TRandom_Ranf - fld [glb_dbl_400] - fmulp - faddp - mcLoadLocal ecx, loc23.nI - call TArray_SetDblKPower - - mcLoadLocal ebx, loc23.pTrekData - inc [ebx + TREKDATA.ISCATE] - inc [ebx + TREKDATA.ISHERE] - -.L34: - ; - ; Romulans! - ; - mcLoadLocal ebx, loc23.pTrekData - cmp [ebx + TREKDATA.IRHERE], 0 - je .L37 - - movzx eax, [ebx + TREKDATA.KLHERE] - inc eax - mcStoreLocal loc23.nI, eax - - movzx eax, [ebx + TREKDATA.NENHERE] - mcStoreLocal loc23.nNENHERE, eax - -.drop_a_romulan: - mov al, CHAR_ROMULAN - call TCommon_DropIn - - mcLoadLocal ecx, loc23.nI - dec ecx - mcLoadLocal esi, loc23.pKX - mcLoadLocal edi, loc23.pKY - mov [esi + ecx], al - mov [edi + ecx], dl - - mcLoadLocal eax, loc23.nSKILL - imul eax, 50 - add eax, 450 - call TCommon_FPU_Load_EAX - call TRandom_Ranf - fld [glb_dbl_400] - fmulp - faddp - - mcLoadLocal ecx, loc23.nI - call TArray_SetDblKPower - - inc [esp + loc23.nI] - mcLoadLocal edx, loc23.nI - cmp edx, [esp + loc23.nNENHERE] - jbe .drop_a_romulan - -.L37: - call TCommon_ResetDist - call TCommon_SortKlingons - ; - ; Starbase - ; - cmp [esp + loc23.nQUADNUM], 10 - jb .L50 - - sub [esp + loc23.nQUADNUM], 10 - mov al, CHAR_STARBASE - call TCommon_DropIn - mcLoadLocal ebx, loc23.pTrekData - mcStoreMember TREKDATA.BASEX, al - mcStoreMember TREKDATA.BASEY, dl - -.L50: - ; - ; Planet - ; - cmp [esp + loc23.nPLAN], 0 - je .L54 - - mcLoadLocal ebx, loc23.pTrekData - mcLoadMember al, TREKDATA.QUADX - mcLoadMember dl, TREKDATA.QUADY - call TArray_FindPlanet - mcStoreMember TREKDATA.IPLANET, cl - jecxz .L54 - - mov al, CHAR_PLANET - call TCommon_DropIn - mcLoadLocal ebx, loc23.pTrekData - mcStoreMember TREKDATA.PLNETX, al - mcStoreMember TREKDATA.PLNETY, dl - -.L54: - ; - ; Stars like dust!.. - ; - call TCommon_NewCondition - cmp [esp + loc23.nQUADNUM], 0 - je .L62 - - mcLoadLocal ecx, loc23.nQUADNUM - -.drop_star: - push ecx - mov al, CHAR_ASTERISK - call TCommon_DropIn - pop ecx - loop .drop_star - -.L62: - ; - ; Check for Neutral Zone - ; - mcLoadLocal ebx, loc23.pTrekData - mcZeroBits eax - cmp [ebx + TREKDATA.IRHERE], al - je .L66 - cmp [ebx + TREKDATA.KLHERE], al - jne .L66 - cmp [ebx + TREKDATA.BASEX], al - jne .L66 - - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jc .L64 - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 85 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 86 - call TConsole_Prout - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 87 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 88 - call TConsole_Prout - call TConsole_ScrollUp - -.L64: - mcLoadLocal ebx, loc23.pTrekData - inc [ebx + TREKDATA.NEUTZ] - -.L66: - ; - ; Check for THING!! - ; - mcLoadLocal ebx, loc23.pTrekData - cmp [ebx + TREKDATA.SHUTUP], 0 - jne .L67 - - mcLoadMember al, TREKDATA.THINGX - cmp al, [ebx + TREKDATA.QUADX] - jne .L67 - - mcLoadMember al, TREKDATA.THINGY - cmp al, [ebx + TREKDATA.QUADY] - jne .L67 - - mov al, CHAR_THING - call TCommon_DropIn - - mcLoadLocal ebx, loc23.pTrekData - mcZeroBits eax - mcStoreMember TREKDATA.THINGX, al - mcStoreMember TREKDATA.THINGY, al - - mov cl, DEV_SR_SENSORS - call TArray_IsDamaged - jc .L67 - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 89 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 90 - call TConsole_Prout - -.L67: - call TCommon_DropBlackHole - call TCommon_DropBlackHole - call TCommon_DropBlackHole - - mcLoadLocal ebx, loc23.pTrekData - cmp [ebx + TREKDATA.ITHERE], 0 - je .done - - mov ch, CHAR_WEB - mov cl, CHAR_COSMOS - mov al, 1 - mov dl, al - call TCommon_ReserveSector - - mov dl, 10 - call TCommon_ReserveSector - - mov al, 10 - call TCommon_ReserveSector - - mov dl, 1 - call TCommon_ReserveSector - jmp .done - -.L70: - ; - ; Quadrant contains supernova - ; - mcLoadLocal edi, loc23.pTrekData - add edi, TREKDATA.QUAD - mcLoad8bitsToReg32 ecx, 100 - mov al, CHAR_COSMOS - rep stosb - -.done: - mcEndLocals loc23.size - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc22: - .pBaseX PBYTE ? - .pBaseY PBYTE ? - .nBases COUNT ? - .iBase INDEX ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_PrintBaseQuads: - mcBeginLocals loc22.size - - mcLoadGameDataPtr ebx - mcLoadMemberRef esi, TREKDATA.BASEQX - mcLoadMemberRef edi, TREKDATA.BASEQY - movzx ecx, [ebx + TREKDATA.INBASE] - mcLoad1 eax - - mcStoreLocal loc22.pBaseX, esi - mcStoreLocal loc22.pBaseY, edi - mcStoreLocal loc22.nBases, ecx - mcStoreLocal loc22.iBase, eax - -.print_location: - mcLoadLocal esi, loc22.pBaseX - mcLoadLocal edi, loc22.pBaseY - mcLoadLocal ecx, loc22.iBase - - dec ecx - mov al, [esi + ecx] - mov dl, [edi + ecx] - mcZeroBits ecx - call TConsole_CramLoc - - mcLoadLocal ecx, loc22.iBase - cmp ecx, [esp + loc22.nBases] - je .done - - mcLoad8bitsToReg32 ecx, 53 - call TConsole_Cram - - inc [esp + loc22.iBase] - jmp .print_location - -.done: - mcEndLocals loc22.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_InitialMsg: - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - - mcLoad8bitsToReg32 ecx, 47 - call TConsole_Cram - mov cl, 1 - mcLoadGameDataPtr esi - fld [esi + TREKDATA.DATE] - push esi - call TConsole_CramFloat - call TConsole_ScrollUp - pop esi - - movzx eax, [esi + TREKDATA.INKLING] - movzx ecx, [esi + TREKDATA.NSCREM] - sub eax, ecx - mov cl, 5 - push esi - call TConsole_CramIntWidth - mcLoad8bitsToReg32 ecx, 48 - call TConsole_Prout - inc ecx - call TConsole_Prout - pop esi - - cmp [esi + TREKDATA.NSCREM], 0 - je .L25 - - mcLoad8bitsToReg32 ecx, 50 - push esi - call TConsole_Prout - pop esi - -.L25: - fld [esi + TREKDATA.INTIME] - call TCommon_FP_Truncate - mov cl, 5 - push esi - call TConsole_CramIntWidth - mcLoad8bitsToReg32 ecx, 51 - call TConsole_Prout - pop esi - - movzx eax, [esi + TREKDATA.INBASE] - mov cl, 5 - push esi - call TConsole_CramIntWidth - mcLoad8bitsToReg32 ecx, 52 - call TConsole_Cram - call TCommon_PrintBaseQuads - call TConsole_ScrollUp - call TConsole_ScrollUp - - mcLoad8bitsToReg32 ecx, 54 - call TConsole_Cram - pop esi - - mov cl, 1 - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - push esi - call TConsole_CramLoc - - mov al, ',' - call TConsole_PutChar - pop esi - - mov cl, 2 - mov al, [esi + TREKDATA.SECTX] - mov dl, [esi + TREKDATA.SECTY] - push esi - call TConsole_CramLoc - call TConsole_ScrollUp - - mcLoad8bitsToReg32 ecx, 55 - call TConsole_Cram - pop esi - - cmp [esi + TREKDATA.NSCREM], 0 - je .done - - mcLoad8bitsToReg32 ecx, 56 - call TConsole_Cram - -.done: - call TConsole_ScrollUp - call TConsole_ScrollUp - ret - -; -------------------------------------------------------------------------- -; Subroutine SETUP from original source -; -------------------------------------------------------------------------- -virtual at 0 -loc11: - .dbl_IDATE DOUBLE ? - .dbl_Reserved DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TCommon_Setup: - mcBeginLocals loc11.size - mcLoadGameDataPtr ebx - - mcStoreMember TREKDATA.SHIP, CHAR_ENTERPRISE - - fld [glb_dbl_5000] - fld st - fstp [ebx + TREKDATA.INENRG] - fstp [ebx + TREKDATA.ENERGY] - - fld [glb_dbl_2500] - fld st - fstp [ebx + TREKDATA.INSHLD] - fstp [ebx + TREKDATA.SHLD] - - fld [glb_dbl_4] - fld st - fstp [ebx + TREKDATA.INLSR] - fstp [ebx + TREKDATA.LSUPRES] - - mcStoreMember TREKDATA.INTORPS, 10 - mcStoreMember TREKDATA.TORPS, 10 - mcStoreMember TREKDATA.NPTUBES, 3 - - fld [glb_dbl_5] - fld [glb_dbl_25] - fstp [ebx + TREKDATA.WFACSQ] - fstp [ebx + TREKDATA.WARPFAC] - - call TRandom_Ranf - fld [glb_dbl_31] - fmulp - fld [glb_dbl_20] - faddp - fld [glb_dbl_100] - fmulp - fld st - fld st - fstp [ebx + TREKDATA.DATE] - fstp [ebx + TREKDATA.INDATE] - fstp [ebx + TREKDATA.DOCKDATE] - - call TRandom_IRan8 - mcStoreMember TREKDATA.QUADX, al - mcStoreMember TREKDATA.QUADY, dl - - call TRandom_IRan10 - mcStoreMember TREKDATA.SECTX, al - mcStoreMember TREKDATA.SECTY, dl - - mcStoreMember TREKDATA.ISCRAFT, 1 - mcStoreMember TREKDATA.ALIVE, 1 - mcStoreMember TREKDATA.LANDED, -1 - - fld [glb_dbl_0dot05] - fstp [ebx + TREKDATA.CRYPROB] - ; - ; Events - ; - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot5] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE1] - - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_1dot5] - fmulp - movzx ecx, [ebx + TREKDATA.REMCOM] - mov [glb_FPU_Int32], ecx - fild [glb_FPU_Int32] - fdivp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE2] - - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot5] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE3] - - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot3] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE4] - - fld [glb_dbl_1E38] - fld st - fld st - fstp [ebx + TREKDATA.FUTURE5] - fstp [ebx + TREKDATA.FUTURE6] - fstp [ebx + TREKDATA.FUTURE7] - - cmp [ebx + TREKDATA.NSCREM], 0 - je .allocate_objects - - fld [ebx + TREKDATA.DATE] - fld [glb_dbl_0dot2777] - faddp - fstp [ebx + TREKDATA.FUTURE6] - -.allocate_objects: - call TCommon_AllocateStars - call TCommon_AllocateBases - call TCommon_AllocateKlingons - call TCommon_AllocateCommanders - call TCommon_AllocatePlanets - call TCommon_AllocateRomulans - call TCommon_AllocateSuperCommander - call TCommon_AllocateThing - - call TCommon_InitialMsg - call TCommon_NewQuad - - mcEndLocals loc11.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TCommon.Inc b/programs/games/StarTrek/trunk/TCommon.Inc deleted file mode 100644 index 5c460dbd24..0000000000 --- a/programs/games/StarTrek/trunk/TCommon.Inc +++ /dev/null @@ -1,185 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TCommon.Inc -; DATE: October 4, 2008 -; -------------------------------------------------------------------------- - -DEV_SR_SENSORS = 1 -DEV_LR_SENSORS = 2 -DEV_PHASERS = 3 -DEV_PHOTON_TUBES = 4 -DEV_LIFE_SUPPORT = 5 -DEV_WARP_ENGINES = 6 -DEV_IMPULSE_ENGINES = 7 -DEV_SHIELDS = 8 -DEV_SUBSPACE_RADIO = 9 -DEV_SHUTTLE_CRAFT = 10 -DEV_COMPUTER = 11 -DEV_TRANSPORTER = 12 -DEV_SHIELD_CONTROL = 13 -DEV_DEATHRAY = 14 - -CONDITION_GREEN = 1 -CONDITION_RED = 2 -CONDITION_YELLOW = 3 -CONDITION_DOCKED = 4 - -virtual at 0 -TPlanet: - .planet_X BYTE ? - .planet_Y BYTE ? - .planet_CLASS BYTE ? - .planet_DILITHIUM BYTE ? - .planet_SCANNED BYTE ? - .size = $ -end virtual - -virtual at 0 -TREKDATA: - .CRYPROB DOUBLE ? - .DATE DOUBLE ? - .REMRES DOUBLE ? - .REMTIME DOUBLE ? - .KPOWER DOUBLES 20 - .KDIST DOUBLES 20 - .DAMAGE DOUBLES 14 - .INRESOR DOUBLE ? - .INTIME DOUBLE ? - .INENRG DOUBLE ? - .INSHLD DOUBLE ? - .INLSR DOUBLE ? - .INDATE DOUBLE ? - .ENERGY DOUBLE ? - .SHLD DOUBLE ? - .WARPFAC DOUBLE ? - .WFACSQ DOUBLE ? - .LSUPRES DOUBLE ? - .DIST DOUBLE ? - .DIREC DOUBLE ? - .TIME DOUBLE ? - .DOCKDATE DOUBLE ? - .DAMFAC DOUBLE ? - .FUTURE1 DOUBLE ? - .FUTURE2 DOUBLE ? - .FUTURE3 DOUBLE ? - .FUTURE4 DOUBLE ? - .FUTURE5 DOUBLE ? - .FUTURE6 DOUBLE ? - .FUTURE7 DOUBLE ? - .HEIGHT DOUBLE ? - ; - ; Integer variables - ; -align 4 - .GALAXY INTEGERS 64 - .STARCH INTEGERS 64 - .INSTAR INT32 ? - .REMKL BYTE ? - .REMCOM BYTE ? - .REMBASE BYTE ? - .STARKL BYTE ? - .BASEKL BYTE ? - .KILLK BYTE ? - .KILLC BYTE ? - .CX BYTES 10 - .CY BYTES 10 - .BASEQX BYTES 5 - .BASEQY BYTES 5 - .NEWSTUF BYTES 64 - .SCANNED BYTES 64 - .PLNETS BYTES (10 * TPlanet.size) - .ISX BYTE ? - .ISY BYTE ? - .KSTUF4 BYTE ? - .KSTUF5 BYTE ? - .NSCREM BYTE ? - .NROMKL BYTE ? - .NROMREM BYTE ? - .NSCKILL BYTE ? - .ICRYSTL BYTE ? - .NPLANKL BYTE ? - .QUAD BYTES 100 - .KX BYTES 20 - .KY BYTES 20 - .INKLING BYTE ? - .INBASE BYTE ? - .INCOM BYTE ? - .INTORPS BYTE ? - .SHLDUP BYTE ? - .CONDIT BYTE ? - .TORPS BYTE ? - .SHIP BYTE ? - .QUADX BYTE ? - .QUADY BYTE ? - .SECTX BYTE ? - .SECTY BYTE ? - .ITHX BYTE ? - .ITHY BYTE ? - .ITHERE BYTE ? - .LENGTH BYTE ? - .SKILL BYTE ? - .QTORPS BYTE ? - .NPTUBES BYTE ? - .PASSWD CHARS 12 - .BASEX BYTE ? - .BASEY BYTE ? - .KLHERE BYTE ? - .COMHERE BYTE ? - .CASUAL BYTE ? - .NHELP BYTE ? - .NKINKS BYTE ? - .IDIDIT BYTE ? - .KDIDIT BYTE ? - .KSHOT BYTE ? - .GAMEWON BYTE ? - .ALIVE BYTE ? - .JUSTIN BYTE ? - .RESTING BYTE ? - .ALLDONE BYTE ? - .SHLDCHG BYTE ? - .THINGX BYTE ? - .THINGY BYTE ? - .PLNETX BYTE ? - .PLNETY BYTE ? - .INORBIT BYTE ? - .LANDED BYTE ? - .IPLANET BYTE ? - .IMINE BYTE ? - .INPLAN BYTE ? - .NENHERE BYTE ? - .ISHERE BYTE ? - .NEUTZ BYTE ? - .IRHERE BYTE ? - .ICRAFT BYTE ? - .IENTESC BYTE ? - .ISCRAFT BYTE ? - .ISATB BYTE ? - .ISCATE BYTE ? - .IPHWHO BYTE ? - .BATX BYTE ? - .BATY BYTE ? - .ICSOS BYTE ? - .ISSOS BYTE ? - .ISUBDAM BYTE ? - .SHUTUP BYTE ? - .size = $ -end virtual - -virtual at 0 -TCommon: - .SNAP BYTE ? - .SNAPSHT BYTES TREKDATA.size - -align 16 - .GAMEDB BYTES TREKDATA.size - .size = $ -end virtual - -macro mcLoadGameDataPtr r32 -{ - mov r32, [glb_pGameData] -} - -PTCommon equ dd -PTGameData equ dd - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TConsole.Asm b/programs/games/StarTrek/trunk/TConsole.Asm deleted file mode 100644 index ec6a05538f..0000000000 --- a/programs/games/StarTrek/trunk/TConsole.Asm +++ /dev/null @@ -1,839 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TConsole.Asm -; DATE: September 21, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; CRAM3AS -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_Cram3Asterisks: - mcLoad8bitsToReg32 ecx, 181 - call TConsole_Cram - ret - -; -------------------------------------------------------------------------- -; CRAMSHP -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramShip: - mcLoadGameDataPtr ebx - mcLoadMember al, TREKDATA.SHIP - - mcOnRegEqu al, CHAR_ENTERPRISE, .good_ship - mcOnRegEqu al, CHAR_FQUEENE, .crappy_ship - ret - -.good_ship: - push 144 - jmp .dump - -.crappy_ship: - push 145 - -.dump: - pop ecx - call TConsole_Cram - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_ScrollUp: - pushad - - mov ebx, [glb_pConsole] - mov edi, ebx - lea esi, [edi + TLine.size] - mov ecx, TConsole.cons_LastRow - rep movsb - - lea edi, [ebx + TConsole.cons_LastRow] - mcZeroBits eax - mov ecx, TLine.size - rep stosb - - mcStoreMember TConsole.cons_CaretColumn, eax - - mov esi, eax - call TApp_RefreshMainWndRect - - mov al, 0Dh - call TLog_DumpChar - mov al, 0Ah - call TLog_DumpChar - - popad - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_RefreshCaretLine: - mcBeginLocals RECT.size - - mov esi, esp - invoke GetClientRect, [glb_MainWnd], esi - - mov eax, [esi + RECT.rc_Bottom] - sub eax, dword [glb_CharSize + SIZE.size_Height] - dec eax - mov [esi + RECT.rc_Top], eax - - call TApp_RefreshMainWndRect - - mcEndLocals RECT.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_Backspace: - mov ebx, [glb_pConsole] - cmp [ebx + TConsole.cons_CaretColumn], 0 - je .done - - dec [ebx + TConsole.cons_CaretColumn] - mcZeroBits eax - call TConsole_PutChar - - dec [ebx + TConsole.cons_CaretColumn] - call TConsole_RefreshCaretLine - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = character code -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_PutChar: - mov ebx, [glb_pConsole] - cmp [ebx + TConsole.cons_CaretColumn], CONSOLE_LAST_COL - jae .done - - mcLoadMember ecx, TConsole.cons_CaretColumn - inc [ebx + TConsole.cons_CaretColumn] - imul ecx, TCharacter.size - lea edi, [ebx + ecx + TConsole.cons_LastRow] - - mcLoadMember edx, TConsole.cons_ActiveColor - mov [edi + TCharacter.char_Symbol], al - mov [edi + TCharacter.char_Attribute], dl - - pushad - call TLog_DumpChar - popad - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = index of color -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_SetAttr: - cmp cl, CONSOLE_ATTRS - jae .done - - and ecx, 0FFh - push ebx - mov ebx, [glb_pConsole] - mcStoreMember TConsole.cons_ActiveColor, ecx - pop ebx - -.done: - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_SetGameMsgAttr: - mov cl, ATTR_GAME_MSG - call TConsole_SetAttr - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_SetCrewMsgAttr: - mov cl, ATTR_CREW_MSG - call TConsole_SetAttr - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = character code -; CL = number of characters -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_RepeatChar: - and ecx, 0FFh - -.next: - push ecx - call TConsole_PutChar - pop ecx - loop .next - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = number of characters -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_RepeatBlank: - mov al, CHAR_BLANK - call TConsole_RepeatChar - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = number of characters -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_RepeatAsterisk: - mov al, CHAR_ASTERISK - call TConsole_RepeatChar - ret - -; -------------------------------------------------------------------------- -; SUBROUTINE CRAM from original FORTRAN source -; -------------------------------------------------------------------------- -; Input: -; ECX = index of the message table -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_Cram: - call TMsgTable_GetItem - mcZeroBits eax - -.get_char: - lodsb - mcOnRegZero eax, .done - - call TConsole_PutChar - jmp .get_char - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = UNICODE text -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramWide: - mcZeroBits eax - -.get_char: - lodsw - mcOnRegZero eax, .done - - call TConsole_PutChar - jmp .get_char - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = ANSI text -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramAnsi: - mcZeroBits eax - -.get_char: - lodsb - mcOnRegZero eax, .done - - call TConsole_PutChar - jmp .get_char - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = index of the message table -; DL = field width -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramString: - movzx edx, dl - call TMsgTable_GetLength - - cmp eax, edx - jae .cram_and_exit - - sub edx, eax - push edx - call TConsole_Cram - - pop ecx - call TConsole_RepeatBlank - ret - -.cram_and_exit: - call TConsole_Cram - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = 1-based device index (like DEV_IMPULSE_ENGINES) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramDevice: - movzx ecx, cl - add ecx, 59 - call TConsole_Cram - ret - -; -------------------------------------------------------------------------- -; CRAMEN -; -------------------------------------------------------------------------- -; Input: -; AL = object symbol -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramEnemy: - pushad - - mov edi, glb_ObjectMap - mcLoad8bitsToReg32 ecx, 9 - mov edx, edi - repne scasb - jne .done - -.cram_it: - sub edi, edx - lea ecx, [edi + 202] - call TConsole_Cram - -.done: - popad - ret - -; -------------------------------------------------------------------------- -; CRMSENA -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate -; DL = Y coordinate -; CL = 1 for "QUADRANT", 2 for "SECTOR", 0 for none -; BL = Enemy character -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramEnemyAt: - push eax ecx edx - - mov al, bl - call TConsole_CramEnemy - - mov ecx, 257 - call TConsole_Cram - - pop edx ecx eax - call TConsole_CramLoc - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = sector X coordinate -; DL = sector Y coordinate -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramEnemyAtEx: - push ebx - call TArray_QuadPtr - mov bl, [ebx] - mov cl, 2 - call TConsole_CramEnemyAt - pop ebx - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = Int32 value to print -; CL = field width or zero (value is padded with blanks on the left side) -; -------------------------------------------------------------------------- -virtual at 0 -loc19: - .bufInt32 CHARS 12 - .nWidth COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramIntWidth: - mcBeginLocals loc19.size - - movzx ecx, cl - mcStoreLocal loc19.nWidth, ecx - - mcLoadLocalRef edi, loc19.bufInt32 - call TFormat_Int32 - - cmp [esp + loc19.nWidth], 0 - je .dump - - cmp [esp + loc19.nWidth], ecx - jbe .dump - - sub ecx, [esp + loc19.nWidth] - neg ecx - call TConsole_RepeatBlank - -.dump: - mcLoadLocalRef esi, loc19.bufInt32 - mcZeroBits eax - -.next: - lodsb - mcOnRegZero eax, .done - call TConsole_PutChar - jmp .next - -.done: - mcEndLocals loc19.size - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = Int32 value to print -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramInt: - pushad - mcZeroBits ecx - call TConsole_CramIntWidth - popad - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = message table index -; EAX = Int32 value to print -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramSinglePlural: - push eax ecx - call TConsole_CramInt - - mov al, CHAR_BLANK - call TConsole_PutChar - - pop ecx - call TConsole_Cram - - pop eax - cmp al, 1 - je .done - - mov al, 'S' - call TConsole_PutChar - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X coordinate -; DL = Y coordinate -; CL = KEY (1 - print "QUADRANT", 2 - print "SECTOR") -; -------------------------------------------------------------------------- -virtual at 0 -loc21: - .nIX INT32 ? - .nIY INT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramLoc: - mcBeginLocals loc21.size - - movzx eax, al - movzx edx, dl - mcStoreLocal loc21.nIX, eax - mcStoreLocal loc21.nIY, edx - - mcOnRegZero cl, .print_values - - add cl, 56 - movzx ecx, cl - call TConsole_Cram - -.print_values: - mov al, CHAR_BLANK - call TConsole_PutChar - - mcLoadLocal eax, loc21.nIX - call TConsole_CramInt - - mcLoad8bitsToReg32 ecx, 59 - call TConsole_Cram - - mcLoadLocal eax, loc21.nIY - call TConsole_CramInt - - mcEndLocals loc21.size - ret - -; -------------------------------------------------------------------------- -; Input: -; ST(0) = value to print -; CL = precision -; DL = field width or zero -; -------------------------------------------------------------------------- -virtual at 0 -loc20: - .bufDouble CHARS 16 - .nWidth COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramFloatWidth: - mcBeginLocals loc20.size - - movzx edx, dl - mcStoreLocal loc20.nWidth, edx - - mcLoadLocalRef edi, loc20.bufDouble - call TFormat_Double - - cmp [esp + loc20.nWidth], 0 - je .dump - - cmp [esp + loc20.nWidth], ecx - jbe .dump - - sub ecx, [esp + loc20.nWidth] - neg ecx - call TConsole_RepeatBlank - -.dump: - mcLoadLocalRef esi, loc20.bufDouble - mcZeroBits eax - -.next: - lodsb - mcOnRegZero eax, .done - call TConsole_PutChar - jmp .next - -.done: - mcEndLocals loc20.size - ret - -; -------------------------------------------------------------------------- -; Input: -; ST(0) = value to print -; CL = precision -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_CramFloat: - pushad - mcZeroBits edx - call TConsole_CramFloatWidth - popad - ret - -; -------------------------------------------------------------------------- -; SUBROUTINE PROUT from original FORTRAN source -; -------------------------------------------------------------------------- -; Input: -; ECX = index of the message table -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_Prout: - push ecx - call TConsole_Cram - call TConsole_ScrollUp - pop ecx - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = number of lines to skip -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_Skip: - movzx ecx, cl - -.skipping: - push ecx - call TConsole_ScrollUp - pop ecx - loop .skipping - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = index of the message table -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_ProutGameMsg: - push ecx - call TConsole_SetGameMsgAttr - pop ecx - call TConsole_Prout - ret - -; -------------------------------------------------------------------------- -; Input: -; CL = index of color -; Output: -; EAX = COLORREF at the specified index -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_GetColorAtIndex: - mcLoadRGB eax, 255, 0, 0 - cmp cl, CONSOLE_ATTRS - jae .done - - and ecx, 0FFh - mov ebx, [glb_pConsole] - mov eax, [ebx + 4*ecx + TConsole.cons_Attributes] - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; EDX = HDC -; EAX = Y coordinate -; ESI = address of TLine structure -; ECX = number of lines left in the loop -; -------------------------------------------------------------------------- -virtual at 0 -loc2: - .hDC HDC ? - .yText INT32 ? - .xText INT32 ? - .pTChar PTCharacter ? - .rgbNow COLORREF ? - .strOneChar WCHARS 2 - .nLinesLeft COUNT ? - .rect_Caret rb RECT.size - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_DrawLine: - mcBeginLocals loc2.size - - mcStoreLocal loc2.nLinesLeft, ecx - mcStoreLocal loc2.hDC, edx - mcStoreLocal loc2.yText, eax - mcStoreLocal loc2.pTChar, esi - - mcZeroBits eax - mcStoreLocal loc2.rgbNow, eax - inc eax - mcStoreLocal loc2.xText, eax - -.load_char: - mcLoadLocal esi, loc2.pTChar - cmp [esi + TCharacter.char_Symbol], 0 - je .draw_caret - - movzx eax, [esi + TCharacter.char_Symbol] - mov [esp + loc2.strOneChar], ax - - mov cl, [esi + TCharacter.char_Attribute] - call TConsole_GetColorAtIndex - - mcLoadLocal edi, loc2.hDC - cmp [esp + loc2.rgbNow], eax - je .draw_char - - mcStoreLocal loc2.rgbNow, eax - invoke SetTextColor, edi, eax - -.draw_char: - mov ebx, esp - lea esi, [ebx + loc2.strOneChar] - - invoke TextOut, edi, \ - [ebx + loc2.xText], \ - [ebx + loc2.yText], esi, 1 - - add [ebx + loc2.pTChar], TCharacter.size - - mov eax, dword [glb_CharSize + SIZE.size_Width] - add [ebx + loc2.xText], eax - jmp .load_char - -.draw_caret: - cmp [esp + loc2.nLinesLeft], 1 - jne .done - ; - ; Paint a rectangular caret - ; - mov ebx, esp - mcLoadMemberRef edi, loc2.rect_Caret - mcLoadMember edx, loc2.xText - mcLoadMember eax, loc2.yText - mov [edi + RECT.rc_Left], edx - mov [edi + RECT.rc_Top], eax - - mov esi, glb_CharSize - add edx, [esi + SIZE.size_Width] - add eax, [esi + SIZE.size_Height] - mov [edi + RECT.rc_Right], edx - mov [edi + RECT.rc_Bottom], eax - - mov cl, ATTR_PROMPT_VALUE - call TConsole_GetColorAtIndex - - invoke CreateSolidBrush, eax - mov esi, eax - mcLoadLocal edx, loc2.hDC - mcLoadLocalRef edi, loc2.rect_Caret - inc [edi + RECT.rc_Left] - inc [edi + RECT.rc_Right] - invoke FillRect, edx, edi, eax - invoke DeleteObject, esi - -.done: - mcEndLocals loc2.size - ret - -; -------------------------------------------------------------------------- -; Input: -; EDX = HDC -; -------------------------------------------------------------------------- -virtual at 0 -loc3: - .hDC HDC ? - .yText INT32 ? - .pLineOfChars PTLine ? - .nLines COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_DrawAllLines: - mcBeginLocals loc3.size - - mcStoreLocal loc3.hDC, edx - - mcLoad1 eax - mcStoreLocal loc3.yText, eax - - mov ebx, [glb_pConsole] - mcStoreLocal loc3.pLineOfChars, ebx - - mcLoad8bitsToReg32 ecx, CONSOLE_ROWS - mcStoreLocal loc3.nLines, ecx - -.paint_row: - mcLoadLocal edx, loc3.hDC - mcLoadLocal eax, loc3.yText - mcLoadLocal esi, loc3.pLineOfChars - mcLoadLocal ecx, loc3.nLines - call TConsole_DrawLine - - add [esp + loc3.pLineOfChars], TLine.size - - mov eax, dword [glb_CharSize + SIZE.size_Height] - add [esp + loc3.yText], eax - - dec [esp + loc3.nLines] - jnz .paint_row - - mcEndLocals loc3.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TConsole_Create: - invoke HeapAlloc, [glb_Allocator], HEAP_NO_SERIALIZE, TConsole.size - mov [glb_pConsole], eax - - mov edi, eax - mov ecx, TConsole.size - mcZeroBits eax - push edi - rep stosb - pop esi - ; - ; Init palette - ; - lea edi, [esi + TConsole.cons_Attributes] - - mcLoadRGB eax, 128, 191, 255 - stosd ; ATTR_GAME_MSG - - mcLoadRGB eax, 255, 255, 206 - stosd ; ATTR_CREW_MSG - - mcLoadRGB eax, 94, 174, 174 - stosd ; ATTR_KLINGON - - mcLoadRGB eax, 0, 176, 0 - stosd ; ATTR_ROMULAN - - mcLoadRGB eax, 192, 192, 192 - stosd ; ATTR_COSMOS - - mcLoadRGB eax, 255, 255, 255 - stosd ; ATTR_SHIP - - mcLoadRGB eax, 255, 255, 0 - stosd ; ATTR_STAR - - mcLoadRGB eax, 6, 131, 255 - stosd ; ATTR_BASE - - mcLoadRGB eax, 128, 128, 64 - stosd ; ATTR_THOLIAN - - mcLoadRGB eax, 128, 128, 128 - stosd ; ATTR_BLACK_HOLE - - mcLoadRGB eax, 230, 211, 157 - stosd ; ATTR_PLANET - - mcLoadRGB eax, 0, 128, 255 - stosd ; ATTR_REPORT_TEXT - - mcLoadRGB eax, 62, 158, 255 - stosd ; ATTR_REPORT_VALUE - - mcLoadRGB eax, 248, 108, 41 - stosd ; ATTR_GALAXY_EDGE - - mcLoadRGB eax, 149, 255, 202 - stosd ; ATTR_SHIP_QUAD - - mcLoadRGB eax, 174, 194, 247 - stosd ; ATTR_SCANNED_QUAD - - mcLoadRGB eax, 218, 191, 5 - stosd ; ATTR_SCAN_SCALE - - mcLoadRGB eax, 255, 170, 170 - stosd ; ATTR_HIT_DAMAGE - - mcLoadRGB eax, 181, 181, 106 - stosd ; ATTR_WEB - - mcLoadRGB eax, 46, 170, 43 - stosd ; ATTR_COND_GREEN - - mcLoadRGB eax, 255, 255, 130 - stosd ; ATTR_COND_YELLOW - - mcLoadRGB eax, 255, 73, 64 - stosd ; ATTR_COND_RED - - mcLoadRGB eax, 0, 155, 0 - stosd ; ATTR_PROMPT_TEXT - - mcLoadRGB eax, 73, 231, 69 - stosd ; ATTR_PROMPT_VALUE - - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TConsole.Inc b/programs/games/StarTrek/trunk/TConsole.Inc deleted file mode 100644 index 0564bf9a41..0000000000 --- a/programs/games/StarTrek/trunk/TConsole.Inc +++ /dev/null @@ -1,63 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TConsole.Inc -; DATE: September 21, 2008 -; -------------------------------------------------------------------------- - -CONSOLE_ROWS = 40 -CONSOLE_COLS = 80 -CONSOLE_ATTRS = 24 -CONSOLE_LAST_COL = (CONSOLE_COLS - 1) - -; -------------------------------------------------------------------------- -ATTR_GAME_MSG = 0 -ATTR_CREW_MSG = 1 -ATTR_KLINGON = 2 -ATTR_ROMULAN = 3 -ATTR_COSMOS = 4 -ATTR_SHIP = 5 -ATTR_STAR = 6 -ATTR_BASE = 7 -ATTR_THOLIAN = 8 -ATTR_BLACK_HOLE = 9 -ATTR_PLANET = 10 -ATTR_REPORT_TEXT = 11 -ATTR_REPORT_VALUE = 12 -ATTR_GALAXY_EDGE = 13 -ATTR_SHIP_QUAD = 14 -ATTR_SCANNED_QUAD = 15 -ATTR_SCAN_SCALE = 16 -ATTR_HIT_DAMAGE = 17 -ATTR_WEB = 18 -ATTR_COND_GREEN = 19 -ATTR_COND_YELLOW = 20 -ATTR_COND_RED = 21 -ATTR_PROMPT_TEXT = 22 -ATTR_PROMPT_VALUE = 23 - -; -------------------------------------------------------------------------- -virtual at 0 -TCharacter: - .char_Symbol db ? - .char_Attribute db ? - .size = $ -end virtual - -; -------------------------------------------------------------------------- -virtual at 0 -TLine: - .cons_Symbols rb (TCharacter.size * CONSOLE_COLS) - .size = $ -end virtual - -; -------------------------------------------------------------------------- -virtual at 0 -TConsole: - .cons_Rows rb (TLine.size * (CONSOLE_ROWS - 1)) - .cons_LastRow rb TLine.size - .cons_CaretColumn INDEX ? - .cons_ActiveColor INDEX ? - .cons_Attributes COLORREFS CONSOLE_ATTRS - .size = $ -end virtual - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TDock.Asm b/programs/games/StarTrek/trunk/TDock.Asm deleted file mode 100644 index e8856fdc08..0000000000 --- a/programs/games/StarTrek/trunk/TDock.Asm +++ /dev/null @@ -1,848 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TDock.Asm -; DATE: October 25, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; ABANDON -; -------------------------------------------------------------------------- -virtual at 0 -loc86: - .pTrekData PVOID ? - .nAttempts COUNT ? - .dbl_ShuttleDamage DOUBLE ? - .dbl_padding DOUBLE ? - .nBaseSectorX INT32 ? - .nBaseSectorY INT32 ? - .nFQSectorX INT32 ? - .nFQSectorY INT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TDock_Abandon: - mcBeginLocals loc86.size - - mcLoadGameDataPtr esi - mcStoreLocal loc86.pTrekData, esi - - mov cl, DEV_SHUTTLE_CRAFT - call TArray_GetDblDamage - fstp [esp + loc86.dbl_ShuttleDamage] - - fld [esp + loc86.dbl_ShuttleDamage] - fldz - mc_CMP_ST0_ST1 - jc .L10 - jz .L15 - - fld [esp + loc86.dbl_ShuttleDamage] - fld1 - fchs - mc_CMP_ST0_ST1 - jz .L6 - - mov ecx, 443 - call TConsole_ProutGameMsg - jmp .done - -.L6: - mov ecx, 444 - call TConsole_ProutGameMsg - jmp .done - -.L10: - mov ecx, 445 - call TConsole_ProutGameMsg - jmp .done - -.L15: - mcLoadLocal esi, loc86.pTrekData - cmp [esi + TREKDATA.LANDED], 1 - jne .check1 - -.must_be_aboard: - mov ecx, 675 - call TConsole_ProutGameMsg - jmp .done - -.check1: - cmp [esi + TREKDATA.ICRAFT], 1 - je .must_be_aboard - - cmp [esi + TREKDATA.ISCRAFT], 1 - je .L17 - - mov ecx, 674 - call TConsole_ProutGameMsg - jmp .done - -.L17: - call TConsole_ScrollUp - mov cl, ATTR_COND_RED - call TConsole_SetAttr - mov ecx, 676 - call TConsole_Prout - inc ecx - call TConsole_Prout - call TConsole_ScrollUp - - invoke Sleep, 800 - - mov ecx, 678 - call TConsole_ProutGameMsg - inc ecx - call TConsole_Prout - inc ecx - call TConsole_Prout - - mcLoadLocal esi, loc86.pTrekData - cmp [esi + TREKDATA.REMBASE], 0 - je .finished - - invoke Sleep, 800 - - call TConsole_ScrollUp - mov ecx, 681 - call TConsole_Prout - inc ecx - call TConsole_Prout - inc ecx - call TConsole_Prout - inc ecx - call TConsole_Prout - inc ecx - call TConsole_Prout - - mcLoadLocal esi, loc86.pTrekData - mcZeroBits eax - mov [esi + TREKDATA.ICRYSTL], al - mov [esi + TREKDATA.IMINE], al - mov [esi + TREKDATA.ISCATE], al - - movzx edx, [esi + TREKDATA.REMBASE] - call TRandom_IRan - mov ecx, eax - - mcLoadLocal ebx, loc86.pTrekData - mcLoadMemberRef esi, TREKDATA.BASEQX - mcLoadMemberRef edi, TREKDATA.BASEQY - mov al, [esi + ecx] - mov dl, [edi + ecx] - mcStoreMember TREKDATA.QUADX, al - mcStoreMember TREKDATA.QUADY, dl - -.L40: - mov al, 5 - mcStoreMember TREKDATA.SECTX, al - mcStoreMember TREKDATA.SECTY, al - - call TCommon_NewQuad - - mov al, 5 - mov dl, al - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - ; - ; Three attempts to put F.Q. beside the base - ; - mcLoad8bitsToReg32 eax, 3 - mcStoreLocal loc86.nAttempts, eax - - mcLoadLocal esi, loc86.pTrekData - movzx eax, [esi + TREKDATA.BASEX] - movzx edx, [esi + TREKDATA.BASEY] - mcStoreLocal loc86.nBaseSectorX, eax - mcStoreLocal loc86.nBaseSectorY, edx - -.attempt: - mcLoad8bitsToReg32 edx, 3 - call TRandom_IRan - dec eax - add eax, [esp + loc86.nBaseSectorX] - mcStoreLocal loc86.nFQSectorX, eax - call TPhotons_IsValidSector - jnc .next_attempt - - mcLoad8bitsToReg32 edx, 3 - call TRandom_IRan - dec eax - add eax, [esp + loc86.nBaseSectorY] - mcStoreLocal loc86.nFQSectorY, eax - call TPhotons_IsValidSector - jnc .next_attempt - - mcLoadLocal eax, loc86.nFQSectorX - mcLoadLocal edx, loc86.nFQSectorY - call TArray_QuadPtr - cmp byte [ebx], CHAR_COSMOS - je .L60 - -.next_attempt: - dec [esp + loc86.nAttempts] - jnz .attempt - jmp .L40 - -.L60: - mov byte [ebx], CHAR_FQUEENE - mcLoadLocal esi, loc86.pTrekData - mov [esi + TREKDATA.SHIP], CHAR_FQUEENE - mov [esi + TREKDATA.CONDIT], CONDITION_DOCKED - - mcLoadLocal eax, loc86.nFQSectorX - mcLoadLocal edx, loc86.nFQSectorY - mov [esi + TREKDATA.SECTX], al - mov [esi + TREKDATA.SECTY], dl - - lea edi, [esi + TREKDATA.DAMAGE] - mcLoad8bitsToReg32 ecx, 14 - -.clear_damages: - fldz - fstp tbyte [edi] - add edi, 10 - loop .clear_damages - - fld [glb_dbl_3000] - fld st - fstp [esi + TREKDATA.INENRG] - fstp [esi + TREKDATA.ENERGY] - - fld [glb_dbl_1250] - fld st - fstp [esi + TREKDATA.INSHLD] - fstp [esi + TREKDATA.SHLD] - - mov al, 6 - mov [esi + TREKDATA.INTORPS], al - mov [esi + TREKDATA.TORPS], al - - fld [glb_dbl_3] - fld st - fstp [esi + TREKDATA.INLSR] - fstp [esi + TREKDATA.LSUPRES] - - mov [esi + TREKDATA.SHLDUP], 0 - - fld [glb_dbl_5] - fstp [esi + TREKDATA.WARPFAC] - - fld [glb_dbl_25] - fstp [esi + TREKDATA.WFACSQ] - jmp .done - -.finished: - mov al, 9 - call TFinish_Main - -.done: - mcEndLocals loc86.size - ret - -; -------------------------------------------------------------------------- -; DREPORT -; -------------------------------------------------------------------------- -virtual at 0 -loc38: - .nJDAM INT32 ? - .pDAMAGE PDOUBLE ? - .nL INDEX ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TDock_DamageReport: - mcBeginLocals loc38.size - - mcZeroBits eax - mcStoreLocal loc38.nJDAM, eax - - inc eax - mcStoreLocal loc38.nL, eax - - mcLoadGameDataPtr esi - add esi, TREKDATA.DAMAGE - mcStoreLocal loc38.pDAMAGE, esi - -.check_device: - fldz - mcLoadLocal ebx, loc38.pDAMAGE - fld tbyte [ebx] - mc_CMP_ST0_ST1 - jc .L20 - jz .L20 - - cmp [esp + loc38.nJDAM], 0 - jne .L10 - - mov cl, ATTR_SCAN_SCALE - call TConsole_SetAttr - call TConsole_ScrollUp - mov ecx, 270 - call TConsole_Prout - mov ecx, 271 - call TConsole_Prout - inc [esp + loc38.nJDAM] - -.L10: - mov cl, 2 - call TConsole_RepeatBlank - - mov cl, ATTR_REPORT_TEXT - call TConsole_SetAttr - - mov dl, 22 - mcLoadLocal ecx, loc38.nL - add ecx, 59 - call TConsole_CramString - - mov cl, ATTR_REPORT_VALUE - call TConsole_SetAttr - - cmp [esp + loc38.nL], 14 - je .deathray - - mcLoadLocal esi, loc38.pDAMAGE - fld tbyte [esi] - fld [glb_dbl_0dot005] - faddp - mov cl, 2 - mov dl, 5 - call TConsole_CramFloatWidth - jmp .docked_value - -.deathray: - mov ecx, 269 - call TConsole_Cram - -.docked_value: - mcLoadLocal esi, loc38.pDAMAGE - fld tbyte [esi] - fld [glb_dbl_DOCKFAC] - fmulp - fld [glb_dbl_0dot005] - faddp - mov cl, 2 - mov dl, 10 - call TConsole_CramFloatWidth - call TConsole_ScrollUp - -.L20: - ; - ; Next device - ; - add [esp + loc38.pDAMAGE], 10 - inc [esp + loc38.nL] - cmp [esp + loc38.nL], 14 - jbe .check_device - - cmp [esp + loc38.nJDAM], 0 - jne .done - - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mov ecx, 268 - call TConsole_Prout - -.done: - call TConsole_ScrollUp - mcEndLocals loc38.size - ret - -; -------------------------------------------------------------------------- -; This function will check if sufficient time passed between dockings to -; prevent the cheating by docking a few times in a row and getting -; additional photon tubes, quantum charges, etc. -; -------------------------------------------------------------------------- -; Returns CF=1 if additional devices are allowed. -; -------------------------------------------------------------------------- -align PROC_ALIGN -TDock_IsTime4Goodies: - mcLoadGameDataPtr esi - - fld [esi + TREKDATA.DATE] - fld [esi + TREKDATA.DOCKDATE] - fsubp - fld [glb_dbl_0dot8] - mc_CMP_ST0_ST1 - - ret - -; -------------------------------------------------------------------------- -; Check if enhanced torpedoes available -; -------------------------------------------------------------------------- -align PROC_ALIGN -TDock_GetQuantumCharges: - call TDock_IsTime4Goodies - jnc .done - - mcLoadGameDataPtr esi - - cmp [esi + TREKDATA.QTORPS], 1 - je .done - cmp [esi + TREKDATA.SKILL], 5 - jb .done - - mcLoad8bitsToReg32 edx, 100 - call TRandom_IRan - inc eax - cmp eax, 25 - ja .done - - mcLoadGameDataPtr edi - inc [edi + TREKDATA.QTORPS] - - mcZeroBits ecx - cmp [edi + TREKDATA.SHIP], CHAR_ENTERPRISE - sete cl - mov al, 8 - shl al, cl - mov [edi + TREKDATA.TORPS], al - -.report: - call TConsole_SetCrewMsgAttr - mov ecx, 707 - call TConsole_Prout - -.done: - ret - -; -------------------------------------------------------------------------- -; Check if additional photon tubes were installed -; -------------------------------------------------------------------------- -align PROC_ALIGN -TDock_InstallTubes: - mcBeginLocals 4 - - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.SKILL], 5 - jb .done - - cmp [esi + TREKDATA.NPTUBES], 3 - ja .done - - mcLoad8bitsToReg32 edx, 100 - call TRandom_IRan - inc eax - cmp eax, 20 - ja .done - - call TRandom_Ranf - fld [glb_dbl_3] - fmulp - call TCommon_FP_Truncate - inc eax - mov [esp], eax - - mcLoadGameDataPtr edi - add [edi + TREKDATA.NPTUBES], al - - call TConsole_SetCrewMsgAttr - mov ecx, 701 - call TConsole_Cram - - mov eax, [esp] - call TConsole_CramInt - - mov ecx, 702 - call TConsole_Cram - - cmp dword [esp], 1 - je .skip - - mov al, 'S' - call TConsole_PutChar - -.skip: - mov ecx, 703 - call TConsole_Prout - -.done: - mcEndLocals 4 - ret - -; -------------------------------------------------------------------------- -; DOCK -; -------------------------------------------------------------------------- -align PROC_ALIGN -TDock_Main: - call TConsole_SetGameMsgAttr - - mcLoadGameDataPtr esi - mov [esi + TREKDATA.IDIDIT], 0 - - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - je .L30 - - cmp [esi + TREKDATA.INORBIT], 0 - jne .L40 - - cmp [esi + TREKDATA.BASEX], 0 - je .L5 - - mov al, [esi + TREKDATA.SECTX] - mov dl, [esi + TREKDATA.SECTY] - sub al, [esi + TREKDATA.BASEX] - sub dl, [esi + TREKDATA.BASEY] - movsx eax, al - movsx edx, dl - - call TCommon_AbsEAX - cmp eax, 1 - ja .L5 - - mov eax, edx - call TCommon_AbsEAX - cmp eax, 1 - jbe .L10 - -.L5: - call TConsole_CramShip - mov ecx, 264 - jmp .msg_end - -.L10: - mcLoadGameDataPtr edi - mov [edi + TREKDATA.CONDIT], CONDITION_DOCKED - - mov ecx, 265 - call TConsole_Prout - - call TDock_InstallTubes - call TDock_GetQuantumCharges - - mcLoadGameDataPtr edi - inc [edi + TREKDATA.IDIDIT] - - fld [edi + TREKDATA.INSHLD] - fstp [edi + TREKDATA.SHLD] - - fld [edi + TREKDATA.INLSR] - fstp [edi + TREKDATA.LSUPRES] - - cmp [edi + TREKDATA.QTORPS], 1 - je .check_power - - mov al, [edi + TREKDATA.INTORPS] - mov [edi + TREKDATA.TORPS], al - -.check_power: - fld [edi + TREKDATA.INENRG] - fld [edi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jc .refuel - ret - -.refuel: - fld [edi + TREKDATA.INENRG] - fstp [edi + TREKDATA.ENERGY] - ret - -.L30: - mov ecx, 266 - jmp .msg_end - -.L40: - mov ecx, 267 - -.msg_end: - call TConsole_Prout - - mcLoadGameDataPtr esi - fld [esi + TREKDATA.DATE] - fstp [esi + TREKDATA.DOCKDATE] - ret - -; -------------------------------------------------------------------------- -; HELP -; -------------------------------------------------------------------------- -virtual at 0 -loc49: - .pTrekData PVOID ? - .dbl_DIST DOUBLE ? - .dbl_XDIST DOUBLE ? - .dbl_TEMP1 DOUBLE ? - .dbl_TEMP2 DOUBLE ? - .dbl_PROBF DOUBLE ? - .nIX BYTE ? - .nIY BYTE ? - .nLINE INDEX ? - .nL INDEX ? - .nLL INDEX ? - .nSUM INT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TDock_Help: - mcBeginLocals loc49.size - - mcLoadGameDataPtr esi - mcStoreLocal loc49.pTrekData, esi - - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .L10 - - call TConsole_SetCrewMsgAttr - mov ecx, 562 - call TConsole_Prout - jmp .done - -.L10: - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jnc .L20 - - mov ecx, 563 - call TConsole_ProutGameMsg - jmp .done - -.L20: - mcLoadLocal esi, loc49.pTrekData - cmp [esi + TREKDATA.REMBASE], 0 - jne .L30 - - call TConsole_SetCrewMsgAttr - mov ecx, 564 - call TConsole_Prout - jmp .done - -.L30: - cmp [esi + TREKDATA.LANDED], 1 - jne .L31 - - call TConsole_SetGameMsgAttr - mov ecx, 565 - call TConsole_Cram - call TConsole_CramShip - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - jmp .done - -.L31: - cmp [esi + TREKDATA.ISCRAFT], 0 - jne .L32 - - mov ecx, 407 - call TConsole_ProutGameMsg - jmp .done - -.L32: - inc [esi + TREKDATA.NHELP] - cmp [esi + TREKDATA.BASEX], 0 - je .L40 - - mov al, [esi + TREKDATA.BASEX] - sub al, [esi + TREKDATA.SECTX] - movzx eax, al - imul eax, eax - - mov dl, [esi + TREKDATA.BASEY] - sub dl, [esi + TREKDATA.SECTY] - movzx edx, dl - imul edx, edx - - add eax, edx - call TCommon_FPU_Load_EAX - fsqrt - fstp [esp + loc49.dbl_DIST] - jmp .L60 - -.L40: - fld [glb_dbl_1000] - fstp [esp + loc49.dbl_DIST] - - movzx ecx, [esi + TREKDATA.REMBASE] - lea edi, [esi + TREKDATA.BASEQX] - lea ebx, [esi + TREKDATA.BASEQY] - mcZeroBits edx - -.check_base_distance: - mov al, [edi] - sub al, [esi + TREKDATA.QUADX] - movsx eax, al - imul eax, eax - mcStoreLocal loc49.nSUM, eax - - mov al, [ebx] - sub al, [esi + TREKDATA.QUADY] - movsx eax, al - imul eax, eax - add eax, [esp + loc49.nSUM] - - call TCommon_FPU_Load_EAX - fsqrt - fld [glb_dbl_Ten] - fmulp - fld st - fstp [esp + loc49.dbl_XDIST] - - fld [esp + loc49.dbl_DIST] - mc_CMP_ST0_ST1 - jc .next_base - - fld [esp + loc49.dbl_XDIST] - fstp [esp + loc49.dbl_DIST] - mcStoreLocal loc49.nLINE, edx - -.next_base: - inc edi - inc ebx - inc edx - loop .check_base_distance - - lea edi, [esi + TREKDATA.BASEQX] - lea ebx, [esi + TREKDATA.BASEQY] - mcLoadLocal ecx, loc49.nLINE - - mov al, [edi + ecx] - mov dl, [ebx + ecx] - mov [esi + TREKDATA.QUADX], al - mov [esi + TREKDATA.QUADY], dl - - inc [esi + TREKDATA.SHUTUP] - push esi - call TCommon_NewQuad - pop esi - dec [esi + TREKDATA.SHUTUP] - -.L60: - mov al, [esi + TREKDATA.SECTX] - mov dl, [esi + TREKDATA.SECTY] - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - - call TConsole_SetGameMsgAttr - mov ecx, 199 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal esi, loc49.pTrekData - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - call TConsole_CramLoc - mov ecx, 566 - call TConsole_Cram - call TConsole_CramShip - mov ecx, 567 - call TConsole_Prout - - mov esi, glb_dbl_0dot98 - mcLoadLocalRef edi, loc49.dbl_DIST - call TCommon_X_exp_Y - fld1 - fsubrp - fstp [esp + loc49.dbl_TEMP1] - - fld1 - fld [glb_dbl_3] - fdivp - fstp [esp + loc49.dbl_TEMP2] - - mcLoadLocalRef esi, loc49.dbl_TEMP1 - mcLoadLocalRef edi, loc49.dbl_TEMP2 - call TCommon_X_exp_Y - fstp [esp + loc49.dbl_PROBF] - - mcLoad1 eax - mcStoreLocal loc49.nL, eax - call TConsole_SetGameMsgAttr - -.attempt: - mov ecx, 567 - add ecx, [esp + loc49.nL] - call TConsole_Cram - - mov ecx, 571 - call TConsole_Cram - call TConsole_CramShip - mov ecx, 572 - call TConsole_Cram - invoke Sleep, 1200 - - call TRandom_Ranf - fld [esp + loc49.dbl_PROBF] - mc_CMP_ST0_ST1 - jc .L90 - -.L70: - mov ecx, 573 - call TConsole_Prout - - inc [esp + loc49.nL] - cmp [esp + loc49.nL], 3 - jbe .attempt - - mov al, 11 - call TFinish_Main - jmp .done - -.L90: - mcLoad1 eax - mcStoreLocal loc49.nLL, eax - - mcLoadLocal esi, loc49.pTrekData - -.find_adjacent_pos: - call TRandom_Ranf - fld [glb_dbl_3] - fmulp - call TCommon_FP_Truncate - add al, [esi + TREKDATA.BASEX] - dec eax - call TPhotons_IsValidSector - jnc .next_adjacent_try - mcStoreLocal loc49.nIX, al - - call TRandom_Ranf - fld [glb_dbl_3] - fmulp - call TCommon_FP_Truncate - add al, [esi + TREKDATA.BASEY] - dec eax - call TPhotons_IsValidSector - jnc .next_adjacent_try - mcStoreLocal loc49.nIY, al - - mcLoadLocal al, loc49.nIX - mcLoadLocal dl, loc49.nIY - call TArray_QuadPtr - cmp byte [ebx], CHAR_COSMOS - je .L110 - -.next_adjacent_try: - inc [esp + loc49.nLL] - cmp [esp + loc49.nLL], 5 - jbe .find_adjacent_pos - jmp .L70 - -.L110: - push ebx - mov ecx, 574 - call TConsole_Prout - pop ebx - - mcLoadLocal esi, loc49.pTrekData - mcLoadLocal al, loc49.nIX - mcLoadLocal dl, loc49.nIY - mov [esi + TREKDATA.SECTX], al - mov [esi + TREKDATA.SECTY], dl - - mov al, [esi + TREKDATA.SHIP] - mov byte [ebx], al - - call TCommon_ResetDist - call TCommon_SortKlingons - call TDock_Main - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mov ecx, 575 - call TConsole_Prout - -.done: - mcEndLocals loc49.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TEvents.Asm b/programs/games/StarTrek/trunk/TEvents.Asm deleted file mode 100644 index 597bef67e1..0000000000 --- a/programs/games/StarTrek/trunk/TEvents.Asm +++ /dev/null @@ -1,1931 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TEvents.Asm -; DATE: October 18, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; EDI = address of INT32 value -; -------------------------------------------------------------------------- -; This helper function will limit the offset stored at EDI to one quadrant. -; -------------------------------------------------------------------------- -align PROC_ALIGN -TEvents_Helper1: - cmp dword [edi], 1 - jg .set_to_one - cmp dword [edi], -1 - jl .set_to_neg_one - ret - -.set_to_one: - mcLoad1 eax - stosd - ret - -.set_to_neg_one: - mcLoadNeg1 eax - stosd - ret - -; -------------------------------------------------------------------------- -; SCOM -; -------------------------------------------------------------------------- -virtual at 0 -loc33: - .pTrekData PVOID ? - .pIWHERE PVOID ? - .arr_BASEQX BYTES 8 - .arr_BASEQY BYTES 8 - .arr_BDIST DOUBLES 8 - .nDistance INT32 ? - .nIFINDIT INT32 ? - .nIWHICHB INT32 ? - .nI INT32 ? - .nREMBASE INT32 ? - .bSwapped BOOL ? - .iDELTX INT32 ? - .iDELTY INT32 ? - .iQX INT32 ? - .iQY INT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TEvents_MoveSuperCommander: - mcBeginLocals loc33.size - - mcLoadGameDataPtr ebx - mcStoreLocal loc33.pTrekData, ebx - - cmp [ebx + TREKDATA.REMBASE], 0 - jle .L60 - ; - ; Fill local arrays with base coordinates - ; - lea esi, [ebx + TREKDATA.BASEQX] - lea edi, [esp + loc33.arr_BASEQX] - mcZeroBits ecx - mov cl, 5 - rep movsb - - lea esi, [ebx + TREKDATA.BASEQY] - lea edi, [esp + loc33.arr_BASEQY] - mov cl, 5 - rep movsb - ; - ; Calculate distances to super-commander quadrant - ; - mcLoadMember cl, TREKDATA.REMBASE - mcStoreLocal loc33.nREMBASE, ecx - lea esi, [esp + loc33.arr_BASEQX] - lea edi, [esp + loc33.arr_BASEQY] - lea edx, [esp + loc33.arr_BDIST] - -.next_base: - mov al, [esi] - sub al, [ebx + TREKDATA.ISX] - movsx eax, al - imul eax, eax - mcStoreLocal loc33.nDistance, eax - - mov al, [edi] - sub al, [ebx + TREKDATA.ISY] - movsx eax, al - imul eax, eax - add eax, [esp + loc33.nDistance] - - call TCommon_FPU_Load_EAX - fsqrt - fstp tbyte [edx] - - inc esi - inc edi - add edx, 10 - loop .next_base - ; - ; Now, sort all three local base arrays by distance - ; - cmp [ebx + TREKDATA.REMBASE], 1 - jbe .L4 - -.bubble_sort: - mcZeroBits eax - mcStoreLocal loc33.bSwapped, eax - - movzx ecx, [ebx + TREKDATA.REMBASE] - dec ecx - - lea esi, [esp + loc33.arr_BASEQX] - lea edi, [esp + loc33.arr_BASEQY] - lea edx, [esp + loc33.arr_BDIST] - -.sort_pair: - fld tbyte [edx + 10] - fld tbyte [edx] - mc_CMP_ST0_ST1 - jc .next_pair - jz .next_pair - - inc [esp + loc33.bSwapped] - - mov al, [esi] - xchg al, [esi + 1] - mov [esi], al - - mov al, [edi] - xchg al, [edi + 1] - mov [edi], al - - fld tbyte [edx + 10] - fld tbyte [edx] - fstp tbyte [edx + 10] - fstp tbyte [edx] - -.next_pair: - inc esi - inc edi - add edx, 10 - loop .sort_pair - - cmp [esp + loc33.bSwapped], 0 - jne .bubble_sort - -.L4: - ; - ; Look for nearest base without a COMMANDER, no Enterprise, - ; not too many klingons and not under attack. - ; - mcZeroBits eax - mcStoreLocal loc33.nIFINDIT, eax - mcStoreLocal loc33.nIWHICHB, eax - - inc eax - mcStoreLocal loc33.nI, eax - -.load_base_quad: - mcLoadLocalRef esi, loc33.arr_BASEQX - mcLoadLocalRef edi, loc33.arr_BASEQY - mcLoadLocal ecx, loc33.nI - dec ecx - mov al, [esi + ecx] - mov dl, [edi + ecx] - - mcLoadLocal ebx, loc33.pTrekData - cmp al, [ebx + TREKDATA.QUADX] - jne .check_battle_quad - cmp dl, [ebx + TREKDATA.QUADY] - je .check_next_base - -.check_battle_quad: - cmp al, [ebx + TREKDATA.BATX] - jne .check_klingon_count - cmp dl, [ebx + TREKDATA.BATY] - je .check_next_base - -.check_klingon_count: - call TArray_GetGalaxyValue - cmp ecx, 899 - ja .check_next_base - - cmp [ebx + TREKDATA.REMCOM], 0 - jle .L10 - ; - ; Check AL,DL quadrant against array of commanders - ; - mcLoadMemberRef esi, TREKDATA.CX - mcLoadMemberRef edi, TREKDATA.CY - movzx ecx, [ebx + TREKDATA.REMCOM] - -.check_this_commander: - cmp al, [esi] - jne .next_commander - - cmp dl, [edi] - je .quad_with_commander - -.next_commander: - inc esi - inc edi - loop .check_this_commander - - mcLoadLocal eax, loc33.nI - mcStoreLocal loc33.nIWHICHB, eax - jmp .L10 - -.quad_with_commander: - cmp [esp + loc33.nIFINDIT], 2 - je .check_next_base - - mcLoad8bitsToReg32 eax, 2 - mcStoreLocal loc33.nIFINDIT, eax - - mcLoadLocal eax, loc33.nI - mcStoreLocal loc33.nIWHICHB, eax - -.check_next_base: - inc [esp + loc33.nI] - mcLoadLocal ecx, loc33.nI - cmp ecx, [esp + loc33.nREMBASE] - jbe .load_base_quad - - cmp [esp + loc33.nIFINDIT], 0 - je .done - -.L10: - ; - ; Base found! (1-based index is stored in loc33.nIWHICHB) - ; - mcLoadLocal ebx, loc33.pTrekData - mcLoadLocal ecx, loc33.nIWHICHB - dec ecx - mcLoadLocalRef esi, loc33.arr_BASEQX - mcLoadLocalRef edi, loc33.arr_BASEQY - mov al, [esi + ecx] - mov dl, [edi + ecx] - sub al, [ebx + TREKDATA.ISX] - sub dl, [ebx + TREKDATA.ISY] - movsx eax, al - movsx edx, dl - mcStoreLocal loc33.iDELTX, eax - mcStoreLocal loc33.iDELTY, edx - - mcLoadLocalRef edi, loc33.iDELTX - call TEvents_Helper1 - - mcLoadLocalRef edi, loc33.iDELTY - call TEvents_Helper1 - ; - ; Attempt first to move in both directions - ; - movzx eax, [ebx + TREKDATA.ISX] - movzx edx, [ebx + TREKDATA.ISY] - add eax, [esp + loc33.iDELTX] - add edx, [esp + loc33.iDELTY] - mcStoreLocal loc33.iQX, eax - mcStoreLocal loc33.iQY, edx - - mov eax, .L23 - mcStoreLocal loc33.pIWHERE, eax - jmp .L15 - -.goto_IWHERE: - jmp [esp + loc33.pIWHERE] - -.L15: - ; - ; Make checks on possible destination quadrant - ; - mcLoadLocal eax, loc33.iQX - mcLoadLocal edx, loc33.iQY - - cmp edx, 1 - jl .goto_IWHERE - cmp edx, 8 - jg .goto_IWHERE - cmp eax, 1 - jl .goto_IWHERE - cmp eax, 8 - jg .goto_IWHERE - - mcLoadLocal ebx, loc33.pTrekData - cmp al, [ebx + TREKDATA.QUADX] - jne .check_klingons - cmp dl, [ebx + TREKDATA.QUADY] - je .goto_IWHERE - -.check_klingons: - call TArray_GetGalaxyValue - cmp ecx, 899 - ja .goto_IWHERE - ; - ; Go ahead and move SUPER-COMMANDER! - ; - mov al, [ebx + TREKDATA.ISX] - mov dl, [ebx + TREKDATA.ISY] - mov esi, ebx - call TArray_GalaxyPtr - sub dword [ebx], 100 - - mcLoadLocal eax, loc33.iQX - mcLoadLocal edx, loc33.iQY - mov [esi + TREKDATA.ISX], al - mov [esi + TREKDATA.ISY], dl - call TArray_GalaxyPtr - add dword [ebx], 100 - - cmp [esi + TREKDATA.ISCATE], 0 - je .L40 - ; - ; SUPER-COMMANDER left current quadrant - ; - mcZeroBits eax - mov [esi + TREKDATA.ISCATE], al - mov [esi + TREKDATA.ISATB], al - mov [esi + TREKDATA.ISHERE], al - mov [esi + TREKDATA.IENTESC], al - - fld [glb_dbl_1E38] - fstp [esi + TREKDATA.FUTURE7] - ; - ; Find S.C. index in KX,KY arrays - ; - lea edi, [esi + TREKDATA.KX] - lea ebx, [esi + TREKDATA.KY] - movzx ecx, [esi + TREKDATA.NENHERE] - - mcZeroBits eax - mcStoreLocal loc33.nI, eax - -.find_scom_in_quad: - inc [esp + loc33.nI] - mov al, [edi] - mov dl, [ebx] - - push ebx - call TArray_QuadPtr - mov eax, ebx - pop ebx - - cmp byte [eax], CHAR_SCOM - je .L22 - - inc edi - inc ebx - loop .find_scom_in_quad - jmp .L40 - -.L22: - mov byte [eax], CHAR_COSMOS - mcLoadLocal ecx, loc33.nI - call TArray_Leave - call TCommon_SortKlingons - jmp .L40 - -.L23: - ; - ; Try some other maneuvers - ; - cmp [esp + loc33.iDELTX], 0 - je .L30 - cmp [esp + loc33.iDELTY], 0 - je .L30 - ; - ; Try moving just in X direction - ; - mcLoadLocal ebx, loc33.pTrekData - movzx eax, [ebx + TREKDATA.ISY] - mcStoreLocal loc33.iQY, eax - - mov edx, .L25 - mcStoreLocal loc33.pIWHERE, edx - jmp .L15 - -.L25: - ; - ; Then try moving just in Y direction - ; - mcLoadLocal ebx, loc33.pTrekData - movzx eax, [ebx + TREKDATA.ISX] - movzx edx, [ebx + TREKDATA.ISY] - add edx, [esp + loc33.iDELTY] - mcStoreLocal loc33.iQX, eax - mcStoreLocal loc33.iQY, edx - - mov edx, .L300 - mcStoreLocal loc33.pIWHERE, edx - jmp .L15 - -.L30: - ; - ; Attempt angle move - ; - cmp [esp + loc33.iDELTX], 0 - jne .L35 - - mcLoadLocal ebx, loc33.pTrekData - movzx eax, [ebx + TREKDATA.ISX] - inc eax - mcStoreLocal loc33.iQX, eax - - mov edx, .L32 - mcStoreLocal loc33.pIWHERE, edx - jmp .L15 - -.L32: - mcLoadLocal ebx, loc33.pTrekData - movzx eax, [ebx + TREKDATA.ISX] - dec eax - mcStoreLocal loc33.iQX, eax - - mov edx, .L300 - mcStoreLocal loc33.pIWHERE, edx - jmp .L15 - -.L35: - mcLoadLocal ebx, loc33.pTrekData - movzx eax, [ebx + TREKDATA.ISY] - inc eax - mcStoreLocal loc33.iQY, eax - - mov edx, .L36 - mcStoreLocal loc33.pIWHERE, edx - jmp .L15 - -.L36: - mcLoadLocal ebx, loc33.pTrekData - movzx eax, [ebx + TREKDATA.ISY] - dec eax - mcStoreLocal loc33.iQY, eax - - mov edx, .L300 - mcStoreLocal loc33.pIWHERE, edx - jmp .L15 - -.L40: - ; - ; SUPER-COMMANDER has moved - check/report situation - ; - mcLoadLocal ebx, loc33.pTrekData - movzx ecx, [ebx + TREKDATA.INPLAN] - mcLoadMemberRef esi, TREKDATA.PLNETS - mcLoadMember al, TREKDATA.ISX - mcLoadMember dl, TREKDATA.ISY - -.check_planet: - cmp al, [esi + TPlanet.planet_X] - jne .next_planet - cmp dl, [esi + TPlanet.planet_Y] - jne .next_planet - - cmp [esi + TPlanet.planet_DILITHIUM], 1 - jne .L45 - jmp .scom_destroys_planet - -.next_planet: - add esi, TPlanet.size - loop .check_planet - jmp .L45 - -.scom_destroys_planet: - push eax - mov edi, esi - mov cl, TPlanet.size - mcZeroBits eax - rep stosb - pop eax - - call TArray_NewStufPtr - dec byte [ebx] - - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jc .L45 - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 212 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 213 - call TConsole_Cram - - mcLoadLocal ebx, loc33.pTrekData - mcLoadMember al, TREKDATA.ISX - mcLoadMember dl, TREKDATA.ISY - mov cl, 1 - call TConsole_CramLoc - - mcLoad8bitsToReg32 ecx, 214 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 215 - call TConsole_Prout - -.L45: - ; - ; Check for a base - ; - mcLoadLocal ebx, loc33.pTrekData - cmp [ebx + TREKDATA.REMBASE], 0 - jle .L60 - - movzx ecx, [ebx + TREKDATA.REMBASE] - mcLoadMemberRef esi, TREKDATA.BASEQX - mcLoadMemberRef edi, TREKDATA.BASEQY - mcLoadMember al, TREKDATA.ISX - mcLoadMember dl, TREKDATA.ISY - -.verify_scom_at_base: - cmp al, [esi] - jne .verify_next_base - cmp dl, [edi] - jne .verify_next_base - - cmp al, [ebx + TREKDATA.BATX] - jne .L80 - cmp dl, [ebx + TREKDATA.BATY] - jne .L80 - -.verify_next_base: - inc esi - inc edi - loop .verify_scom_at_base - ; - ; Check for intelligence report - ; - call TRandom_Ranf - fld [glb_dbl_0dot2] - mc_CMP_ST0_ST1 - jc .done - - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jc .done - - mcLoadLocal ebx, loc33.pTrekData - mcLoadMember al, TREKDATA.ISX - mcLoadMember dl, TREKDATA.ISY - call TArray_GetStarChartValue - cmp ecx, 0 - jg .done - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 216 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 217 - call TConsole_Cram - - mcLoadLocal ebx, loc33.pTrekData - mcLoadMember al, TREKDATA.ISX - mcLoadMember dl, TREKDATA.ISY - mov cl, 1 - call TConsole_CramLoc - - mcLoad8bitsToReg32 ecx, 154 - call TConsole_Prout - jmp .done - -.L60: - mcLoadLocal edi, loc33.pTrekData - fld [glb_dbl_1E38] - fstp [edi + TREKDATA.FUTURE6] - jmp .done - -.L80: - ; - ; Attack a base - ; - mcLoadLocal ebx, loc33.pTrekData - mov [ebx + TREKDATA.ISATB], 1 - - call TRandom_Ranf - fld st - faddp - fld1 - faddp - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE7] - - cmp [ebx + TREKDATA.BATX], 0 - je .cry_sos - ; - ; FUTURE7 += FUTURE5-DATE - ; - fld [ebx + TREKDATA.FUTURE5] - fld [ebx + TREKDATA.DATE] - fsubp - fld [ebx + TREKDATA.FUTURE7] - faddp - fstp [ebx + TREKDATA.FUTURE7] - -.cry_sos: - mov al, CHAR_SCOM - call TEvents_SOS - -.L300: -.done: - mcEndLocals loc33.size - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = X quadrant -; DL = Y quadrant -; ESI = points to TREKDATA object -; Output: -; CF=1 - base was removed -; -------------------------------------------------------------------------- -; Find the base in BASEQX,BASEQY arrays and overwrite its coordinates with -; the last entry from these arrays. Do not decrement REMBASE! It is done -; outside of this function. -; -------------------------------------------------------------------------- -align PROC_ALIGN -TEvents_RemoveThisBase: - lea ebx, [esi + TREKDATA.BASEQX] - lea edi, [esi + TREKDATA.BASEQY] - movzx ecx, [esi + TREKDATA.REMBASE] - -.check_base_coords: - cmp al, [ebx] - jne .next_base - - cmp dl, [edi] - je .base_found - -.next_base: - inc ebx - inc edi - loop .check_base_coords - clc - ret - -.base_found: - push ebx - push edi - - lea ecx, [esi + TREKDATA.BASEQX] - lea edx, [esi + TREKDATA.BASEQY] - movzx eax, [esi + TREKDATA.REMBASE] - dec eax - - mov bl, [edx + eax] - pop esi - mov [esi], bl - - mov bl, [ecx + eax] - pop esi - mov [esi], bl - stc - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = points to TREKDATA object -; Output: -; CF=1 if quadrant BATX,BATY contains a COMMANDER -; -------------------------------------------------------------------------- -align PROC_ALIGN -TEvents_VerifyBattleQuad: - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - - lea ebx, [esi + TREKDATA.CX] - lea edi, [esi + TREKDATA.CY] - - movzx ecx, [esi + TREKDATA.REMCOM] - -.check_commander: - cmp al, [ebx] - jne .next_commander - - cmp dl, [edi] - je .verified - -.next_commander: - inc ebx - inc edi - loop .check_commander - - clc - ret - -.verified: - stc - ret - -; -------------------------------------------------------------------------- -; SOS -; -------------------------------------------------------------------------- -; Input: -; AL = which commander is attacking the base -; -------------------------------------------------------------------------- -virtual at 0 -loc34: - .pTrekData PVOID ? - .nESC BYTE ? - .nIX BYTE ? - .nIY BYTE ? - .bRadioDamaged BYTE ? - .dbl_DDAY DOUBLE ? - .dbl_reserved DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TEvents_SOS: - mcBeginLocals loc34.size - mcStoreLocal loc34.nESC, al - -@@: - mcLoadGameDataPtr ebx - mcStoreLocal loc34.pTrekData, ebx - - mcZeroBits eax - mcStoreLocal loc34.bRadioDamaged, al - - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - adc [esp + loc34.bRadioDamaged], 0 - - cmp [esp + loc34.nESC], CHAR_SCOM - je .L20 - - mov [ebx + TREKDATA.ICSOS], 0 - cmp [esp + loc34.bRadioDamaged], 0 - jne .done - - inc [ebx + TREKDATA.ICSOS] - mcLoadMember al, TREKDATA.BATX - mcLoadMember dl, TREKDATA.BATY - mcStoreLocal loc34.nIX, al - mcStoreLocal loc34.nIY, dl - - fld [ebx + TREKDATA.FUTURE5] - fstp [esp + loc34.dbl_DDAY] - jmp .L30 - -.L20: - mov [ebx + TREKDATA.ISSOS], 0 - cmp [esp + loc34.bRadioDamaged], 0 - jne .done - - inc [ebx + TREKDATA.ISSOS] - mcLoadMember al, TREKDATA.ISX - mcLoadMember dl, TREKDATA.ISY - mcStoreLocal loc34.nIX, al - mcStoreLocal loc34.nIY, dl - - fld [ebx + TREKDATA.FUTURE7] - fstp [esp + loc34.dbl_DDAY] - -.L30: - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - - mcLoad8bitsToReg32 ecx, 218 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal al, loc34.nIX - mcLoadLocal dl, loc34.nIY - call TConsole_CramLoc - call TConsole_ScrollUp - - mcLoad8bitsToReg32 ecx, 219 - call TConsole_Cram - - mcLoadLocal al, loc34.nESC - call TConsole_CramEnemy - - mcLoad8bitsToReg32 ecx, 220 - call TConsole_Prout - - mcLoad8bitsToReg32 ecx, 221 - call TConsole_Cram - - mov cl, 1 - fld [esp + loc34.dbl_DDAY] - call TConsole_CramFloat - - mcLoad8bitsToReg32 ecx, 222 - call TConsole_Prout - - mcLoadLocal esi, loc34.pTrekData - cmp [esi + TREKDATA.RESTING], 0 - je .done - - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 223 - call TConsole_Prout - - mcLoad8bitsToReg32 ecx, 224 - call TGame_JA - jnc .done - - mcLoadLocal edi, loc34.pTrekData - dec [edi + TREKDATA.RESTING] - -.done: - mcEndLocals loc34.size - ret - -; -------------------------------------------------------------------------- -; Output: -; ECX = 1-based index of a COMMANDER or zero -; -------------------------------------------------------------------------- -; This function finds a quadrant where COMMANDER+BASE, but -; no Enterprise and no SUPER COMMANDER. -; -------------------------------------------------------------------------- -virtual at 0 -loc32: - ; - ; These are not changing - ; - .pBASEQX PBYTE ? - .pBASEQY PBYTE ? - ; - ; These are incrementing at the end of outer loop - ; - .pCX PBYTE ? - .pCY PBYTE ? - .nCommanderIndex INDEX ? - ; - ; Loop limits - ; - .nCommanders COUNT ? - .nBases COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TEvents_FindCmdrAtBase: - mcBeginLocals loc32.size - mcLoadGameDataPtr ebx - - movzx ecx, [ebx + TREKDATA.REMBASE] - movzx edx, [ebx + TREKDATA.REMCOM] - mcStoreLocal loc32.nBases, ecx - mcStoreLocal loc32.nCommanders, edx - - mcLoad1 eax - mcStoreLocal loc32.nCommanderIndex, eax - - mcLoadMemberRef esi, TREKDATA.CX - mcLoadMemberRef edi, TREKDATA.CY - mcStoreLocal loc32.pCX, esi - mcStoreLocal loc32.pCY, edi - - mcLoadMemberRef esi, TREKDATA.BASEQX - mcLoadMemberRef edi, TREKDATA.BASEQY - mcStoreLocal loc32.pBASEQX, esi - mcStoreLocal loc32.pBASEQY, edi - -.load_commander_quad: - mcLoadLocal esi, loc32.pCX - mcLoadLocal edi, loc32.pCY - mov al, [esi] - mov dl, [edi] - - cmp al, [ebx + TREKDATA.ISX] - jne .check_against_ship - cmp dl, [ebx + TREKDATA.ISY] - je .next_commander - -.check_against_ship: - cmp al, [ebx + TREKDATA.QUADX] - jne .check_against_all_bases - cmp dl, [ebx + TREKDATA.QUADY] - je .next_commander - -.check_against_all_bases: - mcLoadLocal esi, loc32.pBASEQX - mcLoadLocal edi, loc32.pBASEQY - mcLoadLocal ecx, loc32.nBases - -.check_against_base: - cmp al, [esi] - jne .next_base - - cmp dl, [edi] - je .commander_located - -.next_base: - inc esi - inc edi - loop .check_against_base - -.next_commander: - inc [esp + loc32.nCommanderIndex] - mcLoadLocal ecx, loc32.nCommanderIndex - cmp ecx, [esp + loc32.nCommanders] - ja .ret_zero - - inc [esp + loc32.pCX] - inc [esp + loc32.pCY] - jmp .load_commander_quad - -.commander_located: - mcLoadLocal ecx, loc32.nCommanderIndex - jmp .done - -.ret_zero: - mcZeroBits ecx - -.done: - mcEndLocals loc32.size - ret - -; -------------------------------------------------------------------------- -; EVENTS -; -------------------------------------------------------------------------- -virtual at 0 -loc31: - .pTrekData PVOID ? - .bICTBEAM BOOL ? - .bISTRACT BOOL ? - .nLINE INDEX ? - .nL INDEX ? - .nI INDEX ? - .nYANK INT32 ? - .dbl_DATEMIN DOUBLE ? - .dbl_XTIME DOUBLE ? - .dbl_REPAIR DOUBLE ? - .dbl_Reserved DOUBLE ? - .iXHOLD BYTE ? - .iYHOLD BYTE ? - .nDamage_3_and_4 BYTE ? - .byte_Reserved BYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TEvents_Main: - mcBeginLocals loc31.size - - mcLoadGameDataPtr edx - mcStoreLocal loc31.pTrekData, edx - - mcZeroBits eax - mcStoreLocal loc31.bICTBEAM, eax - mcStoreLocal loc31.bISTRACT, eax - -.L10: - mcZeroBits eax - mcStoreLocal loc31.nLINE, eax - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - ; - ; Pick earliest event - ; - fld [esi + TREKDATA.DATE] - fld [esi + TREKDATA.TIME] - faddp - fstp [esp + loc31.dbl_DATEMIN] - - mcLoad8bitsToReg32 ecx, 7 - lea edi, [esi + TREKDATA.FUTURE1] - - mcLoad1 eax - mcStoreLocal loc31.nL, eax - -.check_event: - fld tbyte [edi] - fld [esp + loc31.dbl_DATEMIN] - mc_CMP_ST0_ST1 - jc .L20 - - mcLoadLocal eax, loc31.nL - mcStoreLocal loc31.nLINE, eax - - fld tbyte [edi] - fstp [esp + loc31.dbl_DATEMIN] - -.L20: - add edi, 10 - inc [esp + loc31.nL] - loop .check_event - - fld [esp + loc31.dbl_DATEMIN] - fld [esi + TREKDATA.DATE] - fsubp - fstp [esp + loc31.dbl_XTIME] - - fld [esp + loc31.dbl_DATEMIN] - fstp [esi + TREKDATA.DATE] - ; - ; Deplete Federation Resources - ; - movzx eax, [esi + TREKDATA.REMCOM] - movzx edx, [esi + TREKDATA.REMKL] - shl eax, 2 - add eax, edx - call TCommon_FPU_Load_EAX - fld [esp + loc31.dbl_XTIME] - fmulp - fld [esi + TREKDATA.REMRES] - fsubrp - fld st - fstp [esi + TREKDATA.REMRES] - - fild [glb_FPU_Int32] - fdivp - fld st - fstp [esi + TREKDATA.REMTIME] - - fldz - mc_CMP_ST0_ST1 - jc .L30 - - mov al, 2 - -.finished: - call TFinish_Main - jmp .done - -.L30: - ; - ; Verify Life Support is OK - ; - mov cl, DEV_LIFE_SUPPORT - call TArray_IsDamaged - jnc .L50 - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - je .L50 - - fld [esi + TREKDATA.LSUPRES] - fld [esp + loc31.dbl_XTIME] - mc_CMP_ST0_ST1 - jc .L40 - jz .L40 - - fld [esi + TREKDATA.LSUPRES] - mov cl, DEV_LIFE_SUPPORT - call TArray_GetDblDamage - mc_CMP_ST0_ST1 - jc .L40 - jz .L40 - - mov al, 3 - jmp .finished - -.L40: - mcLoadLocal esi, loc31.pTrekData - fld [esi + TREKDATA.LSUPRES] - fld [esp + loc31.dbl_XTIME] - fsubp - fstp [esi + TREKDATA.LSUPRES] - - mov cl, DEV_LIFE_SUPPORT - call TArray_GetDblDamage - fld [esp + loc31.dbl_XTIME] - mc_CMP_ST0_ST1 - jc .L50 - - mcLoadLocal esi, loc31.pTrekData - fld [esi + TREKDATA.INLSR] - fstp [esi + TREKDATA.LSUPRES] - -.L50: - ; - ; Fix devices... - ; - fld [esp + loc31.dbl_XTIME] - fstp [esp + loc31.dbl_REPAIR] - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .fix_devices - - fld [esp + loc31.dbl_XTIME] - fld [glb_dbl_DOCKFAC] - fdivp - fstp [esp + loc31.dbl_REPAIR] - -.fix_devices: - lea ebx, [esi + TREKDATA.DAMAGE] - mcLoad8bitsToReg32 ecx, 13 - -.fix_it: - fldz - fld tbyte [ebx] - mc_CMP_ST0_ST1 - jz .L60 - - fld tbyte [ebx] - fld [esp + loc31.dbl_REPAIR] - fsubp - fstp tbyte [ebx] - - fldz - fld tbyte [ebx] - mc_CMP_ST0_ST1 - jnc .L60 - - fldz - fstp tbyte [ebx] - -.L60: - add ebx, 10 - loop .fix_it - ; - ; Jump to event IF (LINE != 0) - ; - fld [esi + TREKDATA.TIME] - fld [esp + loc31.dbl_XTIME] - fsubp - fstp [esi + TREKDATA.TIME] - - cmp [esp + loc31.nLINE], 0 - je .L5000 - - mcLoadLocal eax, loc31.nLINE - mcOnRegEqu eax, 1, .L100 - mcOnRegEqu eax, 2, .L200 - mcOnRegEqu eax, 3, .L300 - mcOnRegEqu eax, 4, .L400 - mcOnRegEqu eax, 5, .L500 - mcOnRegEqu eax, 6, .L600 - mcOnRegEqu eax, 7, .L700 - - ;int 3 - jmp .done ; Something is broken in the code! - -.L100: - ; - ; Supernova! - ; - mcZeroBits eax - mcZeroBits edx - call TNova_SuperNova - - mcLoadLocal ebx, loc31.pTrekData - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot5] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE1] - - call TArray_MyGalaxyPtr - cmp dword [ebx], 1000 - je .done - jmp .L10 - -.L200: - ; - ; Tractor Beam! - ; - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.REMCOM], 0 - je .L220 - - cmp [esp + loc31.bISTRACT], 0 - jne .L210 - - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - je .L210 - ; - ; Select a Commander who will beam - ; - movzx edx, [esi + TREKDATA.REMCOM] - call TRandom_IRan - mcStoreLocal loc31.nI, eax - - mcLoadLocal esi, loc31.pTrekData - movzx ecx, [esi + TREKDATA.QUADX] - movzx edx, [esi + TREKDATA.QUADY] - - movzx ebx, [esi + eax + TREKDATA.CX] - sub ebx, ecx - imul ebx, ebx - mcStoreLocal loc31.nYANK, ebx - - movzx ebx, [esi + eax + TREKDATA.CY] - sub ebx, edx - imul ebx, ebx - add [esp + loc31.nYANK], ebx - - movzx eax, [esi + TREKDATA.JUSTIN] - add eax, [esp + loc31.nYANK] - mcOnRegZero eax, .L210 - - cmp [esp + loc31.bISTRACT], 0 - je .L201 - -.L20010: - mcLoadLocal esi, loc31.pTrekData - movzx ecx, [esi + TREKDATA.QUADX] - movzx edx, [esi + TREKDATA.QUADY] - - movzx ebx, [esi + TREKDATA.ISX] - sub ebx, ecx - imul ebx, ebx - mcStoreLocal loc31.nYANK, ebx - - movzx ebx, [esi + TREKDATA.ISY] - sub ebx, edx - imul ebx, ebx - add [esp + loc31.nYANK], ebx - -.L201: - mcLoadLocal eax, loc31.nYANK - call TCommon_FPU_Load_EAX - fsqrt - fld [glb_dbl_0dot1777777777] - fmulp - mcLoadLocal edi, loc31.pTrekData - fstp [edi + TREKDATA.TIME] - - inc [esp + loc31.bICTBEAM] - - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - call TConsole_Cram3Asterisks - call TConsole_CramShip - mcLoad8bitsToReg32 ecx, 191 - call TConsole_Prout - - mov al, 14 - mov cl, 1 - call TNova_AutomaticOverride - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - - cmp [esi + TREKDATA.ICRAFT], 1 - jne .L203 - - mov al, 18 - jmp .finished - -.L203: - cmp [esi + TREKDATA.ISCRAFT], 0 - jne .L204 - - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 192 - call TConsole_Prout - inc ecx - call TConsole_Prout - - mov cl, DEV_SHUTTLE_CRAFT - fld [glb_dbl_Ten] - fchs - call TArray_SetDblDamage - - mcLoadLocal edi, loc31.pTrekData - mov [edi + TREKDATA.ISCRAFT], -1 - -.L204: - cmp [esp + loc31.bISTRACT], 0 - je .L205 - - mcLoadLocal ebx, loc31.pTrekData - mcLoadMember al, TREKDATA.ISX - mcLoadMember dl, TREKDATA.ISY - mcStoreMember TREKDATA.QUADX, al - mcStoreMember TREKDATA.QUADY, dl - jmp .L206 - -.L205: - mcLoadLocal ebx, loc31.pTrekData - mcLoadLocal ecx, loc31.nI - mov al, [ebx + ecx + TREKDATA.CX] - mov dl, [ebx + ecx + TREKDATA.CY] - mcStoreMember TREKDATA.QUADX, al - mcStoreMember TREKDATA.QUADY, dl - -.L206: - call TRandom_IRan10 - mcLoadLocal ebx, loc31.pTrekData - mcStoreMember TREKDATA.SECTX, al - mcStoreMember TREKDATA.SECTY, dl - - mcLoad8bitsToReg32 ecx, 194 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal ebx, loc31.pTrekData - mcLoadMember al, TREKDATA.QUADX - mcLoadMember dl, TREKDATA.QUADY - call TConsole_CramLoc - - mcLoad8bitsToReg32 ecx, 53 - call TConsole_Cram - - mov cl, 2 - mcLoadLocal ebx, loc31.pTrekData - mcLoadMember al, TREKDATA.SECTX - mcLoadMember dl, TREKDATA.SECTY - call TConsole_CramLoc - call TConsole_ScrollUp - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.RESTING], 0 - je .check_shields - - dec [esi + TREKDATA.RESTING] - - mcLoad8bitsToReg32 ecx, 195 - call TConsole_ProutGameMsg - -.check_shields: - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - jne .L208 - - mov cl, DEV_SHIELDS - call TArray_IsDamaged - jc .no_shields - - mcLoadLocal esi, loc31.pTrekData - fld [esi + TREKDATA.SHLD] - fldz - mc_CMP_ST0_ST1 - jc .L207 - -.no_shields: - mcLoad8bitsToReg32 ecx, 196 - call TConsole_ProutGameMsg - jmp .L208 - -.L207: - call TShields_Up - - mcLoadLocal ebx, loc31.pTrekData - mcZeroBits eax - mcStoreMember TREKDATA.SHLDCHG, al - -.L208: - call TCommon_NewQuad - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.REMCOM], 0 - jle .L220 - -.L210: - mcLoadLocal ebx, loc31.pTrekData - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_1dot5] - fmulp - movzx eax, [ebx + TREKDATA.REMCOM] - call TCommon_FPU_Load_EAX - fdivp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fld [ebx + TREKDATA.TIME] - faddp - fstp [ebx + TREKDATA.FUTURE2] - jmp .L10 - -.L220: - fld [glb_dbl_1E38] - mcLoadLocal edi, loc31.pTrekData - fstp [edi + TREKDATA.FUTURE2] - jmp .L10 - -.L300: - ; - ; Snapshot of Universe (for Time Warp)! - ; - mov esi, [glb_pCommon] - inc [esi + TCommon.SNAP] - lea edi, [esi + TCommon.SNAPSHT] - add esi, TCommon.GAMEDB - mov ecx, TREKDATA.size - rep movsb - - mcLoadLocal ebx, loc31.pTrekData - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot5] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE3] - jmp .L10 - -.L400: - ; - ; Commander attacks starbase! - ; - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.REMCOM], 0 - je .disable_com_at_base - - cmp [esi + TREKDATA.REMBASE], 0 - jne .L410 - -.disable_com_at_base: - fld [glb_dbl_1E38] - fld st - mcLoadLocal edi, loc31.pTrekData - fstp [edi + TREKDATA.FUTURE4] - fstp [edi + TREKDATA.FUTURE5] - jmp .L10 - -.L410: - ; - ; Find a quadrant where COMMANDER+BASE, but - ; no Enterprise and no SUPER COMMANDER. - ; - call TEvents_FindCmdrAtBase - mcOnRegNotZero ecx, .L430 - - mcLoadLocal ebx, loc31.pTrekData - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot3] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE4] - - fld [glb_dbl_1E38] - fstp [ebx + TREKDATA.FUTURE5] - jmp .L10 - -.L430: - mcLoadGameDataPtr esi - dec ecx - mov al, [esi + ecx + TREKDATA.CX] - mov dl, [esi + ecx + TREKDATA.CY] - mov [esi + TREKDATA.BATX], al - mov [esi + TREKDATA.BATY], dl - - call TRandom_Ranf - fld [glb_dbl_3] - fmulp - fld1 - faddp - fld [esi + TREKDATA.DATE] - faddp - fstp [esi + TREKDATA.FUTURE5] - - cmp [esi + TREKDATA.ISATB], 0 - je .L431 - ; - ; FUTURE(5) += FUTURE(7)-DATE - ; - fld [esi + TREKDATA.FUTURE7] - fld [esi + TREKDATA.DATE] - fsubp - fld [esi + TREKDATA.FUTURE5] - faddp - fstp [esi + TREKDATA.FUTURE5] - -.L431: - fld [esi + TREKDATA.INTIME] - fld [glb_dbl_0dot3] - fmulp - call TCommon_ExpRan - fld [esi + TREKDATA.FUTURE5] - faddp - fstp [esi + TREKDATA.FUTURE4] - - mov al, CHAR_COMMANDER - call TEvents_SOS - jmp .L10 - -.L500: - ; - ; Commander destroys a starbase! - ; - mcLoadLocal edi, loc31.pTrekData - fld [glb_dbl_1E38] - fstp [edi + TREKDATA.FUTURE5] - -.L502: - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.ISATB], 2 - jne .L505 - - mov al, [esi + TREKDATA.ISX] - mov dl, [esi + TREKDATA.ISY] - call TArray_GetGalaxyValue - mov eax, ecx - mcZeroBits edx - mcLoad8bitsToReg32 ecx, 100 - div ecx - cmp edx, 10 - jb .done - - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - mcStoreLocal loc31.iXHOLD, al - mcStoreLocal loc31.iYHOLD, dl - - mov al, [esi + TREKDATA.ISX] - mov dl, [esi + TREKDATA.ISY] - mov [esi + TREKDATA.BATX], al - mov [esi + TREKDATA.BATY], dl - jmp .L520 - -.L505: - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.REMCOM], 0 - je .L515 - cmp [esi + TREKDATA.REMBASE], 0 - je .L515 - - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - call TArray_GetGalaxyValue - mov eax, ecx - mcZeroBits edx - mcLoad8bitsToReg32 ecx, 100 - div ecx - cmp edx, 10 - jb .L515 - - call TEvents_VerifyBattleQuad - jc .L520 - -.L515: - mcLoadLocal edi, loc31.pTrekData - mcZeroBits eax - mov [edi + TREKDATA.BATX], al - mov [edi + TREKDATA.BATY], al - jmp .L10 - -.L520: - mcLoadLocal esi, loc31.pTrekData - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - call TArray_StarChartPtr - - cmp dword [ebx], -1 - jne .L5201 - - mcZeroBits eax - mov [ebx], eax - -.L5201: - cmp dword [ebx], 1000 - jb .L5202 - - sub dword [ebx], 10 - -.L5202: - mcLoadLocal esi, loc31.pTrekData - mov al, [esi + TREKDATA.BATX] - cmp al, [esi + TREKDATA.QUADX] - jne .L545 - - mov dl, [esi + TREKDATA.BATY] - cmp dl, [esi + TREKDATA.QUADY] - jne .L545 - ; - ; Base is destroyed with ship present! - ; - mov al, [esi + TREKDATA.BASEX] - mov dl, [esi + TREKDATA.BASEY] - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - - mcZeroBits eax - mov [esi + TREKDATA.BASEX], al - mov [esi + TREKDATA.BASEY], al - - call TCommon_NewCondition - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 197 - call TConsole_Prout - jmp .L550 - -.L545: - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jc .L550 - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.REMBASE], 1 - je .L550 - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 198 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 199 - call TConsole_Cram - - mcLoadLocal esi, loc31.pTrekData - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - mov cl, 1 - call TConsole_CramLoc - - mcLoad8bitsToReg32 ecx, 200 - call TConsole_Prout - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.ISATB], 2 - jne .L547 - - mcLoad8bitsToReg32 ecx, 201 - call TConsole_Prout - jmp .L550 - -.L547: - mcLoad8bitsToReg32 ecx, 202 - call TConsole_Prout - -.L550: - ; - ; Remove starbase from Galaxy - ; - mcLoadLocal esi, loc31.pTrekData - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - call TArray_GalaxyPtr - sub dword [ebx], 10 - - cmp [esi + TREKDATA.REMBASE], 1 - jle .L580 - - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - call TEvents_RemoveThisBase - -.L580: - mcLoadLocal esi, loc31.pTrekData - dec [esi + TREKDATA.REMBASE] - cmp [esi + TREKDATA.ISATB], 2 - jne .L515 - ; - ; Reinstate a COMMANDER's base attack - ; - mcLoadLocal al, loc31.iXHOLD - mcLoadLocal dl, loc31.iYHOLD - mov [esi + TREKDATA.BATX], al - mov [esi + TREKDATA.BATY], dl - mov [esi + TREKDATA.ISATB], 0 - jmp .L10 - -.L600: - ; - ; Super-Commander moves! - ; - mcLoadLocal esi, loc31.pTrekData - fld [esi + TREKDATA.DATE] - fld [glb_dbl_0dot2777] - faddp - fstp [esi + TREKDATA.FUTURE6] - - movzx eax, [esi + TREKDATA.IENTESC] - add eax, [esp + loc31.bISTRACT] - mcOnRegNotZero eax, .L10 - - cmp [esi + TREKDATA.ISATB], 1 - je .L10 - - cmp [esi + TREKDATA.ISCATE], 1 - jne .move_scom - - cmp [esi + TREKDATA.JUSTIN], 1 - jne .L10 - -.move_scom: - call TEvents_MoveSuperCommander - jmp .L10 - -.L700: - ; - ; Super-Commander destroys base! - ; - mcLoadLocal edi, loc31.pTrekData - fld [glb_dbl_1E38] - fstp [edi + TREKDATA.FUTURE7] - mov [edi + TREKDATA.ISATB], 2 - jmp .L502 - -.L5000: - ; - ; Check with spy to see if SUPER COMMANDER - ; will tractor beam the ship - ; - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.NSCREM], 0 - je .done - - mcLoadLocal eax, loc31.bICTBEAM - add eax, [esp + loc31.bISTRACT] - mcOnRegNotZero eax, .done - - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - je .done - cmp [esi + TREKDATA.ISATB], 1 - je .done - cmp [esi + TREKDATA.ISCATE], 1 - je .done - - cmp [esi + TREKDATA.IENTESC], 0 - jne .L5100 - - fld [glb_dbl_2500] - fld [esi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jnc .L5001 - - cmp [esi + TREKDATA.TORPS], 4 - jae .L5001 - - fld [glb_dbl_1250] - fld [esi + TREKDATA.SHLD] - mc_CMP_ST0_ST1 - jc .L5100 - -.L5001: - mcZeroBits eax - mcStoreLocal loc31.nDamage_3_and_4, al - - mov cl, DEV_PHASERS - call TArray_IsDamaged - adc [esp + loc31.nDamage_3_and_4], 0 - - mov cl, DEV_PHOTON_TUBES - call TArray_IsDamaged - adc [esp + loc31.nDamage_3_and_4], 0 - - cmp [esp + loc31.nDamage_3_and_4], 2 - jne .L5002 - - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.TORPS], 4 - jb .L5100 - -.L5002: - mov cl, DEV_SHIELDS - call TArray_IsDamaged - jnc .done - - mcLoadLocal esi, loc31.pTrekData - fld [glb_dbl_3000] - fld [esi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jc .L5003 - - mov cl, DEV_PHASERS - call TArray_IsDamaged - jnc .done - -.L5003: - mcLoadLocal esi, loc31.pTrekData - cmp [esi + TREKDATA.TORPS], 5 - jb .L5100 - - mov cl, DEV_PHOTON_TUBES - call TArray_IsDamaged - jnc .done - -.L5100: - call TRandom_Ranf - fld [glb_dbl_0dot65] - mc_CMP_ST0_ST1 - jc .done - - inc [esp + loc31.bISTRACT] - jmp .L20010 - -.done: - mcEndLocals loc31.size - ret - -; -------------------------------------------------------------------------- -; MOVETHO -; -------------------------------------------------------------------------- -virtual at 0 -loc90: - .pTrekData PVOID ? - .nIDX BYTE ? - .nIDY BYTE ? - .nDeltaX BYTE ? - .nDeltaY BYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TEvents_MoveTholian: - mcBeginLocals loc90.size - - mcLoadGameDataPtr esi - mcStoreLocal loc90.pTrekData, esi - - cmp [esi + TREKDATA.ITHERE], 0 - je .done - cmp [esi + TREKDATA.JUSTIN], 1 - je .done - - mcZeroBits eax - mcStoreLocal loc90.nDeltaX, al - mcStoreLocal loc90.nDeltaY, al - - mov al, [esi + TREKDATA.ITHX] - mov dl, [esi + TREKDATA.ITHY] - - mcOnRegEqu al, 1, .ITHX_is_1 - mcOnRegEqu al, 10, .ITHX_is_10 - jmp .get_rid_of_tholian - -.ITHX_is_1: - mcOnRegEqu dl, 1, .L10 - mcOnRegEqu dl, 10, .L20 - jmp .get_rid_of_tholian - -.ITHX_is_10: - mcOnRegEqu dl, 10, .L30 - mcOnRegEqu dl, 1, .L40 - -.get_rid_of_tholian: - mov [esi + TREKDATA.ITHERE], 0 - ;int 3 - jmp .done - ; - ; Set destination sector - ; -.L10: - mov [esp + loc90.nIDX], 1 - mov [esp + loc90.nIDY], 10 - inc [esp + loc90.nDeltaY] - jmp .L50 - -.L20: - mov [esp + loc90.nIDX], 10 - mov [esp + loc90.nIDY], 10 - inc [esp + loc90.nDeltaX] - jmp .L50 - -.L30: - mov [esp + loc90.nIDX], 10 - mov [esp + loc90.nIDY], 1 - dec [esp + loc90.nDeltaY] - jmp .L50 - -.L40: - mov [esp + loc90.nIDX], 1 - mov [esp + loc90.nIDY], 1 - dec [esp + loc90.nDeltaX] - -.L50: - ; - ; Make sure destination is empty or web occupies it - ; - mcLoadLocal al, loc90.nIDX - mcLoadLocal dl, loc90.nIDY - call TArray_QuadPtr - - mov al, [ebx] - mcOnRegEqu al, CHAR_COSMOS, .move - mcOnRegNotEqu al, CHAR_WEB, .done - -.move: - ; - ; Leave a web where Tholian is now - ; - mcLoadLocal esi, loc90.pTrekData - mov al, [esi + TREKDATA.ITHX] - mov dl, [esi + TREKDATA.ITHY] - call TArray_QuadPtr - - mov cl, [ebx] - mcOnRegEqu cl, CHAR_COSMOS, .put_web - mcOnRegNotEqu cl, CHAR_THOLIAN, .add_deltas - -.put_web: - mov byte [ebx], CHAR_WEB - -.add_deltas: - mcLoadLocal al, loc90.nDeltaX - mcLoadLocal dl, loc90.nDeltaY - mcLoadLocal esi, loc90.pTrekData - add [esi + TREKDATA.ITHX], al - add [esi + TREKDATA.ITHY], dl - ; - ; Check if Tholian arrived into destination sector - ; - mov al, [esi + TREKDATA.ITHX] - mov dl, [esi + TREKDATA.ITHY] - - cmp al, [esp + loc90.nIDX] - jne .move - cmp dl, [esp + loc90.nIDY] - jne .move - ; - ; Check if web around quadrant is complete - ; - call TArray_IsWebComplete - jc .tholian_leaves - - mcLoadLocal al, loc90.nIDX - mcLoadLocal dl, loc90.nIDY - call TArray_QuadPtr - mov byte [ebx], CHAR_THOLIAN - jmp .done - -.tholian_leaves: - mcLoadLocal esi, loc90.pTrekData - mcZeroBits eax - mov [esi + TREKDATA.ITHERE], al - mov [esi + TREKDATA.ITHX], al - mov [esi + TREKDATA.ITHY], al - - mov ecx, 664 - call TConsole_ProutGameMsg - - mov al, CHAR_BLACK_HOLE - call TCommon_DropIn - -.done: - mcEndLocals loc90.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TFinish.Asm b/programs/games/StarTrek/trunk/TFinish.Asm deleted file mode 100644 index fb03cd9645..0000000000 --- a/programs/games/StarTrek/trunk/TFinish.Asm +++ /dev/null @@ -1,551 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TFinish.Asm -; DATE: October 13, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; FINISH -; -------------------------------------------------------------------------- -; Input: -; AL = game ending code -; -------------------------------------------------------------------------- -virtual at 0 -loc47: - .pTrekData PVOID ? - .bIGotIt BOOL ? - .nEndCode INT32 ? - .dbl_DateDiff DOUBLE ? - .dbl_RateMax DOUBLE ? - .dbl_PerDate DOUBLE ? - .dbl_Goodies DOUBLE ? - .dbl_Baddies DOUBLE ? - .dbl_Advantage DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TFinish_Main: - mcBeginLocals loc47.size - - movzx eax, al - mcStoreLocal loc47.nEndCode, eax - - invoke Sleep, 1000 - - mcLoadGameDataPtr edi - mcStoreLocal loc47.pTrekData, edi - inc [edi + TREKDATA.ALLDONE] - - mcZeroBits eax - mcStoreLocal loc47.bIGotIt, eax - - call TConsole_ScrollUp - call TConsole_ScrollUp - call TConsole_ScrollUp - mov cl, ATTR_SHIP - call TConsole_SetAttr - - mov ecx, 477 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal esi, loc47.pTrekData - fld [esi + TREKDATA.DATE] - call TConsole_CramFloat - - mov ecx, 478 - call TConsole_Prout - call TConsole_ScrollUp - - mcLoadLocal eax, loc47.nEndCode - mcOnRegEqu eax, 1, .L100 - mcOnRegEqu eax, 2, .L200 - mcOnRegEqu eax, 3, .L300 - mcOnRegEqu eax, 4, .L400 - mcOnRegEqu eax, 5, .L500 - mcOnRegEqu eax, 6, .L600 - mcOnRegEqu eax, 7, .L700 - mcOnRegEqu eax, 8, .L800 - mcOnRegEqu eax, 9, .L900 - mcOnRegEqu eax, 10, .L1000 - mcOnRegEqu eax, 11, .L1100 - mcOnRegEqu eax, 12, .L5000 - mcOnRegEqu eax, 13, .L1300 - mcOnRegEqu eax, 14, .L1400 - mcOnRegEqu eax, 15, .L1500 - mcOnRegEqu eax, 16, .L1600 - mcOnRegEqu eax, 17, .L1700 - mcOnRegEqu eax, 18, .L1800 - mcOnRegEqu eax, 21, .L2100 - mcOnRegEqu eax, 22, .L2200 - - ;int 3 - jmp .done - -.L100: - mcLoadLocal esi, loc47.pTrekData - cmp [esi + TREKDATA.NROMREM], 0 - je .L105 - - movzx eax, [esi + TREKDATA.NROMREM] - push eax - - mov ecx, 479 - call TConsole_Cram - pop eax - call TConsole_CramInt - mov ecx, 480 - call TConsole_Prout - call TConsole_ScrollUp - -.L105: - mov ecx, 481 - call TConsole_Prout - mov ecx, 482 - call TConsole_Prout - - mcLoadLocal esi, loc47.pTrekData - mov [esi + TREKDATA.GAMEWON], 1 - - cmp [esi + TREKDATA.ALIVE], 0 - je .L130 - cmp [esi + TREKDATA.BASEKL], 0 - jne .L130 - cmp [esi + TREKDATA.SHIP], CHAR_ENTERPRISE - jne .L130 - - movzx eax, [esi + TREKDATA.STARKL] - imul eax, 5 - - movzx ecx, [esi + TREKDATA.CASUAL] - add eax, ecx - - movzx ecx, [esi + TREKDATA.NPLANKL] - imul ecx, 10 - add eax, ecx - - movzx ecx, [esi + TREKDATA.NHELP] - imul ecx, 45 - add eax, ecx - - cmp eax, 100 - jae .L130 - - fld [glb_dbl_5] - fld [esi + TREKDATA.DATE] - fld [esi + TREKDATA.INDATE] - fsubp - fld st - fstp [esp + loc47.dbl_DateDiff] - mc_CMP_ST0_ST1 - jc .L110 - - mov al, [esi + TREKDATA.SKILL] - call TCommon_LoadByteIntoFPU - fld [glb_dbl_0dot1] - fmulp - inc al - call TCommon_LoadByteIntoFPU - fmulp - fld [glb_dbl_0dot1] - faddp - fstp [esp + loc47.dbl_RateMax] - - mov al, [esi + TREKDATA.KILLK] - add al, [esi + TREKDATA.KILLC] - add al, [esi + TREKDATA.NSCKILL] - fld [esp + loc47.dbl_DateDiff] - fdivp - fstp [esp + loc47.dbl_PerDate] - - fld [esp + loc47.dbl_RateMax] - fld [esp + loc47.dbl_PerDate] - mc_CMP_ST0_ST1 - jc .L130 - -.L110: - call TConsole_ScrollUp - mov ecx, 483 - call TConsole_Prout - - mcLoadLocal esi, loc47.pTrekData - cmp [esi + TREKDATA.SKILL], 4 - je .L120 - cmp [esi + TREKDATA.SKILL], 5 - je .L125 - - mov ecx, 484 - call TConsole_Cram - - mov ecx, 484 - mcLoadLocal esi, loc47.pTrekData - movzx eax, [esi + TREKDATA.SKILL] - add ecx, eax - call TConsole_Prout - - mov ecx, 488 - call TConsole_Prout - jmp .L130 - -.L120: - mov ecx, 489 - call TConsole_Prout - inc [esp + loc47.bIGotIt] - - call TConsole_ScrollUp - mov ecx, 490 - call TConsole_Prout - mov ecx, 491 - call TConsole_Prout - mov ecx, 492 - call TConsole_Prout - jmp .L130 - -.L125: - call TConsole_ScrollUp - mov ecx, 493 - call TConsole_Prout - - call TConsole_ScrollUp - mov ecx, 494 - call TConsole_Prout - - mov ecx, 495 - call TConsole_Prout - mov ecx, 495 - call TConsole_Prout - mov ecx, 495 - call TConsole_Prout - mov ecx, 496 - call TConsole_Prout - call TConsole_ScrollUp - - mov ecx, 497 - call TConsole_Prout - - inc [esp + loc47.bIGotIt] - -.L130: - call TConsole_ScrollUp - mov ecx, 498 - call TConsole_Prout - call TGame_Score - - cmp [esp + loc47.bIGotIt], 0 - je .done - - call TApp_PlaqueProcessor - jmp .done - -.L200: - mov ecx, 499 - call TConsole_Prout - mov ecx, 500 - call TConsole_Prout - call TConsole_ScrollUp - - mov ecx, 501 - call TConsole_Prout - mov ecx, 502 - call TConsole_Prout - - mcLoadLocal esi, loc47.pTrekData - movzx eax, [esi + TREKDATA.REMKL] - movzx edx, [esi + TREKDATA.INKLING] - imul eax, 3 - cmp eax, edx - ja .L210 - - mov ecx, 503 - call TConsole_Prout - - mcLoadLocal esi, loc47.pTrekData - mov [esi + TREKDATA.ALIVE], 0 - -.score_and_return: - call TGame_Score - jmp .done - -.L210: - mov ecx, 504 - call TConsole_Prout - call TConsole_ScrollUp - mov ecx, 498 - call TConsole_Prout - jmp .score_and_return - -.L300: - mov ecx, 505 - call TConsole_Prout - mov ecx, 506 - call TConsole_Prout - -.L310: - call TConsole_ScrollUp - mov ecx, 507 - call TConsole_Prout - jmp .L5000 - -.L400: - mov ecx, 508 - call TConsole_Prout - jmp .L310 - -.L500: - mov ecx, 509 - call TConsole_Cram - call TConsole_CramShip - mov ecx, 510 - call TConsole_Prout - - call TConsole_ScrollUp - mov ecx, 511 - call TConsole_Prout - jmp .L5000 - -.L600: - mov ecx, 512 - call TConsole_Prout - mov ecx, 513 - call TConsole_Prout - call TConsole_ScrollUp - mov ecx, 514 - call TConsole_Prout - jmp .score_and_return - -.L700: - mov ecx, 515 - call TConsole_Prout - -.L705: - mov ecx, 516 - call TConsole_Prout - jmp .L5000 - -.L800: - mov ecx, 509 - call TConsole_Cram - call TConsole_CramShip - mov ecx, 517 - call TConsole_Prout - mov ecx, 518 - call TConsole_Prout - jmp .L5000 - -.L900: - mov ecx, 519 - call TConsole_Prout - mov ecx, 520 - call TConsole_Prout - mov ecx, 521 - call TConsole_Prout - mov ecx, 522 - call TConsole_Prout - jmp .L5000 - -.L1000: - mov ecx, 523 - call TConsole_Prout - jmp .L5000 - -.L1100: - mov ecx, 524 - call TConsole_Prout - mov ecx, 525 - call TConsole_Prout - jmp .L5000 - -.L1300: - mov ecx, 526 - call TConsole_Prout - mov ecx, 527 - call TConsole_Prout - jmp .L1410 - -.L1400: - mcLoadLocal esi, loc47.pTrekData - movzx ecx, [esi + TREKDATA.IPLANET] - call TArray_PlanetPtr - mov al, [edi + TPlanet.planet_CLASS] - mcOnRegNotEqu al, 1, .L1401 - - mov ecx, 528 - call TConsole_Prout - mov ecx, 529 - call TConsole_Prout - call TConsole_ScrollUp - mov ecx, 530 - call TConsole_Prout - jmp .L1410 - -.L1401: - push eax - mov ecx, 531 - call TConsole_Prout - mov ecx, 532 - call TConsole_Cram - pop eax - add al, 'L' - call TConsole_PutChar - mov ecx, 533 - call TConsole_Prout - mov ecx, 534 - call TConsole_Prout - mov ecx, 535 - call TConsole_Prout - -.L1410: - call TConsole_ScrollUp - mov ecx, 536 - call TConsole_Prout - call TConsole_CramShip - mov ecx, 537 - call TConsole_Prout - jmp .L5000 - -.L1500: - mov ecx, 538 - call TConsole_Prout - jmp .L705 - -.L1600: - mov ecx, 539 - call TConsole_Prout - call TConsole_ScrollUp - - mov ecx, 540 - call TConsole_Cram - call TConsole_CramShip - call TConsole_ScrollUp - - mov ecx, 541 - call TConsole_Prout - jmp .L5000 - -.L1700: - mov ecx, 542 - call TConsole_Prout - jmp .L1600 - -.L1800: - mov ecx, 543 - call TConsole_Prout - mov ecx, 544 - call TConsole_Prout - call TConsole_ScrollUp - mov ecx, 545 - call TConsole_Prout - jmp .L1410 - -.L2100: - mov ecx, 546 - call TConsole_Prout - mov ecx, 547 - call TConsole_Prout - jmp .L5000 - -.L2200: - mov ecx, 548 - call TConsole_Prout - mov ecx, 549 - call TConsole_Prout - jmp .L705 - -.L5000: - call TConsole_ScrollUp - mcLoadLocal esi, loc47.pTrekData - mov [esi + TREKDATA.ALIVE], 0 - - mcZeroBits edx - mcZeroBits eax - mov al, CHAR_FQUEENE - cmp [esi + TREKDATA.SHIP], CHAR_ENTERPRISE - cmove edx, eax - mov [esi + TREKDATA.SHIP], dl - - cmp [esi + TREKDATA.REMKL], 0 - je .L5050 - - fld [esi + TREKDATA.REMRES] - fld [esi + TREKDATA.INRESOR] - fdivp - fstp [esp + loc47.dbl_Goodies] - - mov al, [esi + TREKDATA.REMCOM] - add al, al - add al, [esi + TREKDATA.REMKL] - call TCommon_LoadByteIntoFPU - - mov al, [esi + TREKDATA.INCOM] - add al, al - add al, [esi + TREKDATA.INKLING] - call TCommon_LoadByteIntoFPU - - fdivp - fstp [esp + loc47.dbl_Baddies] - - fld [esp + loc47.dbl_Goodies] - fld [esp + loc47.dbl_Baddies] - fdivp - fstp [esp + loc47.dbl_Advantage] - - call TRandom_Ranf - fld [glb_dbl_0dot5] - fmulp - fld1 - faddp - fld [esp + loc47.dbl_Advantage] - mc_CMP_ST0_ST1 - jc .L5020 - - mov ecx, 550 - call TConsole_Prout - mov ecx, 551 - call TConsole_Prout - - call TRandom_Ranf - fld [glb_dbl_3] - faddp - fld [esp + loc47.dbl_Advantage] - mc_CMP_ST0_ST1 - jc .L5010 - - mov ecx, 552 - call TConsole_Prout - call TConsole_ScrollUp - mov ecx, 555 - call TConsole_Prout - jmp .L5030 - -.L5010: - mov ecx, 553 - call TConsole_Prout - jmp .L5030 - -.L5020: - mov ecx, 554 - call TConsole_Prout - jmp .L5030 - -.L5050: - mov ecx, 556 - call TConsole_Prout - mov ecx, 557 - call TConsole_Prout - mov ecx, 558 - call TConsole_Prout - mov ecx, 559 - call TConsole_Prout - - mcLoadLocal ebx, loc47.pTrekData - mov [ebx + TREKDATA.GAMEWON], 1 - mov [ebx + TREKDATA.ALIVE], 0 - -.L5030: - call TGame_Score - -.done: - mcEndLocals loc47.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TFormat.Asm b/programs/games/StarTrek/trunk/TFormat.Asm deleted file mode 100644 index 3a0b14d579..0000000000 --- a/programs/games/StarTrek/trunk/TFormat.Asm +++ /dev/null @@ -1,155 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TFormat.Asm -; DATE: October 7, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; EDI = ANSI buffer -; EAX = value to format -; Output: -; ECX = length of text -; NOTE: -; All registers are safe -; -------------------------------------------------------------------------- -virtual at 0 -loc18: - .buffer CHARS 12 - .nChars INT32 ? - .bSigned BOOL ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TFormat_Int32: - push edx eax esi edi - mcBeginLocals loc18.size - - mcLoadLocalRef esi, loc18.nChars - mcLoad8bitsToReg32 ecx, 10 - mcZeroBits edx - mcStoreLocal loc18.nChars, edx - mcStoreLocal loc18.bSigned, edx - - add eax, edx - jns .div_10 - - neg eax - inc [esp + loc18.bSigned] - -.div_10: - mcZeroBits edx - div ecx - add dl, '0' - dec esi - mov [esi], dl - inc [esp + loc18.nChars] - mcOnRegNotZero eax, .div_10 - - cmp [esp + loc18.bSigned], 0 - je .copy - - dec esi - mov byte [esi], '-' - inc [esp + loc18.nChars] - -.copy: - mcLoadLocal ecx, loc18.nChars - push ecx - rep movsb - - stosb - pop ecx - - mcEndLocals loc18.size - pop edi esi eax edx - ret - -; -------------------------------------------------------------------------- -; Input: -; ST(0) = value to format -; EDI = ANSI buffer -; CL = number of digits after dot -; Output: -; ECX = length of text -; -------------------------------------------------------------------------- -virtual at 0 -loc17: - .dbl_Value DOUBLE ? - .buf_AllDigits CHARS 10 - .nValue INT32 ? - .nDigits INT32 ? - .pszBuffer PCHAR ? - .bSigned BOOL ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TFormat_Double: - push eax ebx esi edi - mcBeginLocals loc17.size - -.prepare: - mcStoreLocal loc17.pszBuffer, edi - movzx ecx, cl - mcStoreLocal loc17.nDigits, ecx - - fld1 - -.make_factor: - fld [glb_dbl_Ten] - fmulp - loop .make_factor - - fmulp - frndint - - call TCommon_FP_Truncate - mcStoreLocal loc17.nValue, eax - - mcLoadLocalRef edi, loc17.buf_AllDigits - call TFormat_Int32 - - cmp ecx, [esp + loc17.nDigits] - ja .print_all - - mcLoadLocal ebx, loc17.pszBuffer - mov byte [ebx], '0' - mov byte [ebx + 1], '.' - je .copy_all_at_EBX - - mov al, [edi] - mov byte [ebx + 2], '0' - mov byte [ebx + 3], al - mov byte [ebx + 4], 0 - jmp .done - -.copy_all_at_EBX: - mov esi, edi - lea edi, [ebx + 2] - inc ecx - rep movsb - jmp .done - -.print_all: - mov esi, edi - mcLoadLocal edi, loc17.pszBuffer - sub ecx, [esp + loc17.nDigits] - rep movsb - - mov al, '.' - stosb - - mov ecx, [esp + loc17.nDigits] - inc ecx - rep movsb - -.done: - mcLoadLocal esi, loc17.pszBuffer - call TCmdBuf_AnsiStrLen - - mcEndLocals loc17.size - pop edi esi ebx eax - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TGame.Asm b/programs/games/StarTrek/trunk/TGame.Asm deleted file mode 100644 index 34eb0b76d1..0000000000 --- a/programs/games/StarTrek/trunk/TGame.Asm +++ /dev/null @@ -1,2420 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TGame.Asm -; DATE: September 28, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; WAIT -; -------------------------------------------------------------------------- -virtual at 0 -loc48: - .pTrekData PVOID ? - .dbl_TEMP DOUBLE ? - .dbl_ANUM DOUBLE ? - .dbl_AITEM2 DOUBLE ? - .dbl_ DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Wait: - mcBeginLocals loc48.size - - mcLoadGameDataPtr esi - mcStoreLocal loc48.pTrekData, esi - - mov [esi + TREKDATA.IDIDIT], 0 - -.L10: - call TCmdBuf_Scan - - fld [ebx + TCmdBuf.cmdbuf_FNUM] - fstp [esp + loc48.dbl_ANUM] - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - jne .L20 - - mov ecx, 560 - call TGame_Prompt - jmp .L10 - -.L20: - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L60 - - fldz - fld [esp + loc48.dbl_ANUM] - mc_CMP_ST0_ST1 - jc .done - jz .done - - mcLoadLocal esi, loc48.pTrekData - fld [esi + TREKDATA.REMTIME] - fld [esp + loc48.dbl_ANUM] - mc_CMP_ST0_ST1 - jnc .verify - - cmp [esi + TREKDATA.NENHERE], 0 - je .L30 - -.verify: - mcLoad8bitsToReg32 ecx, 158 - call TGame_JA - jnc .done - -.L30: - mcLoadLocal esi, loc48.pTrekData - inc [esi + TREKDATA.RESTING] - - fld [esp + loc48.dbl_ANUM] - fstp [esp + loc48.dbl_AITEM2] - -.L40: - fldz - fld [esp + loc48.dbl_ANUM] - mc_CMP_ST0_ST1 - jc .stop_rest - jz .stop_rest - -.still_resting: - mcLoadLocal esi, loc48.pTrekData - cmp [esi + TREKDATA.RESTING], 0 - je .L50 - - fld [esp + loc48.dbl_ANUM] - fstp [esp + loc48.dbl_TEMP] - - cmp [esi + TREKDATA.NENHERE], 0 - je .set_time - - call TRandom_Ranf - fld1 - faddp - fld [esp + loc48.dbl_ANUM] - call TCommon_FPU_Min - fstp [esp + loc48.dbl_TEMP] - -.set_time: - fld [esp + loc48.dbl_TEMP] - mcLoadLocal edi, loc48.pTrekData - fstp [edi + TREKDATA.TIME] - - fld [esp + loc48.dbl_ANUM] - fld [edi + TREKDATA.TIME] - mc_CMP_ST0_ST1 - jnc .check_tholian - - call TAttack_Main - -.check_tholian: - mcLoadLocal esi, loc48.pTrekData - cmp [esi + TREKDATA.NENHERE], 0 - jne .call_events - - call TEvents_MoveTholian - -.call_events: - mcLoadLocal esi, loc48.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - - call TEvents_Main - - mcLoadLocal edi, loc48.pTrekData - mov [edi + TREKDATA.IDIDIT], 1 - - cmp [edi + TREKDATA.ALLDONE], 0 - jne .done - - fld [esp + loc48.dbl_ANUM] - fld [esp + loc48.dbl_TEMP] - fsubp - fstp [esp + loc48.dbl_ANUM] - - call TArray_MyGalaxyPtr - cmp dword [ebx], 1000 - jne .L40 - - mcLoadLocal esi, loc48.pTrekData - mov [esi + TREKDATA.RESTING], 0 - - fldz - fstp [esi + TREKDATA.TIME] - jmp .L55 - -.stop_rest: - mcLoadLocal esi, loc48.pTrekData - mov [esi + TREKDATA.RESTING], 0 - -.L50: - call TConsole_SetGameMsgAttr - mcLoadLocal esi, loc48.pTrekData - fld [esi + TREKDATA.REMTIME] - mov cl, 2 - call TConsole_CramFloat - mov ecx, 561 - call TConsole_Prout - -.L55: - mcLoadLocal esi, loc48.pTrekData - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .done - ; - ; Repair Death Ray! - ; - fld [glb_dbl_9dot99] - fld [esp + loc48.dbl_AITEM2] - fld [esp + loc48.dbl_ANUM] - fsubp - mc_CMP_ST0_ST1 - jc .done - - fldz - mov cl, DEV_DEATHRAY - call TArray_SetDblDamage - jmp .done - -.L60: - call TMove_BegPardon - -.done: - mcEndLocals loc48.size - ret - -; -------------------------------------------------------------------------- -; GAME -; -------------------------------------------------------------------------- -virtual at 0 -loc42: - .pTrekData PVOID ? - .nKILLTOT COUNT ? - .nDESTBAS COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Report: - mcBeginLocals loc42.size - - mcLoadGameDataPtr eax - mcStoreLocal loc42.pTrekData, eax - - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - - mov ecx, 309 - call TConsole_Cram - - mcLoadLocal esi, loc42.pTrekData - mov al, [esi + TREKDATA.LENGTH] - mcOnRegEqu al, 1, .short_game - mcOnRegEqu al, 2, .medium_game - mcOnRegEqu al, 4, .long_game - -.assertion_failed: - ;int 3 - jmp .done - -.short_game: - push 74 - jmp .print_length - -.medium_game: - push 75 - jmp .print_length - -.long_game: - push 76 - -.print_length: - pop ecx - call TConsole_Cram - - mov al, CHAR_BLANK - call TConsole_PutChar - - mcLoadLocal esi, loc42.pTrekData - movzx eax, [esi + TREKDATA.SKILL] - cmp al, 1 - jb .assertion_failed - cmp al, 5 - ja .assertion_failed - - lea ecx, [eax + 12] - call TConsole_Cram - - mov ecx, 310 - call TConsole_Prout - - mcLoadLocal esi, loc42.pTrekData - cmp [esi + TREKDATA.IDIDIT], 0 - je .L110 - - mov ecx, 311 - call TConsole_Cram - - mcLoadLocal esi, loc42.pTrekData - add esi, TREKDATA.PASSWD - mcZeroBits eax - -.get_char: - lodsb - mcOnRegZero eax, .end_of_password - - call TConsole_PutChar - jmp .get_char - -.end_of_password: - mov ecx, 312 - call TConsole_Prout - -.L110: - mcLoadLocal esi, loc42.pTrekData - mov al, [esi + TREKDATA.KILLK] - add al, [esi + TREKDATA.KILLC] - add al, [esi + TREKDATA.NSCKILL] - - movzx eax, al - mcStoreLocal loc42.nKILLTOT, eax - call TConsole_CramInt - - mov ecx, 313 - call TConsole_Cram - - mcLoad8bitsToReg32 ecx, 204 - mcLoadLocal esi, loc42.pTrekData - movzx eax, [esi + TREKDATA.INKLING] - call TConsole_CramSinglePlural - - mov ecx, 314 - mcZeroBits eax - cmp [esp + loc42.nKILLTOT], 1 - sete al - add ecx, eax - call TConsole_Cram - - mcLoad8bitsToReg32 ecx, 205 - mcLoadLocal esi, loc42.pTrekData - movzx eax, [esi + TREKDATA.KILLC] - call TConsole_CramSinglePlural - - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - - mcLoadLocal esi, loc42.pTrekData - cmp [esi + TREKDATA.SKILL], 2 - jbe .L200 - - mov ecx, 316 - call TConsole_Cram - - mcLoadLocal esi, loc42.pTrekData - cmp [esi + TREKDATA.NSCREM], 1 - jne .scom_news - - mov ecx, 317 - call TConsole_Cram - -.scom_news: - mov ecx, 318 - call TConsole_Prout - -.L200: - mcLoadLocal esi, loc42.pTrekData - mov al, [esi + TREKDATA.INBASE] - sub al, [esi + TREKDATA.REMBASE] - movzx eax, al - mcStoreLocal loc42.nDESTBAS, eax - mcOnRegZero eax, .L210 - - mov ecx, 319 - call TConsole_CramSinglePlural - mov ecx, 320 - call TConsole_Cram - -.L210: - mcLoadLocal esi, loc42.pTrekData - mov ecx, 319 - movzx eax, [esi + TREKDATA.REMBASE] - call TConsole_CramSinglePlural - - cmp [esp + loc42.nDESTBAS], 0 - je .end_of_bases - - mov ecx, 321 - call TConsole_Cram - -.end_of_bases: - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - - mcLoadLocal esi, loc42.pTrekData - cmp [esi + TREKDATA.ICSOS], 0 - je .L240 - - fld [esi + TREKDATA.FUTURE5] - fld [glb_dbl_1E38] - mc_CMP_ST0_ST1 - jc .L240 - jz .L240 - - cmp [esi + TREKDATA.REMCOM], 0 - je .L240 - cmp [esi + TREKDATA.REMBASE], 0 - je .L240 - cmp [esi + TREKDATA.BATX], 0 - je .L240 - cmp [esi + TREKDATA.BATY], 0 - je .L240 - - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - call TArray_GetGalaxyValue - mcLoad8bitsToReg32 eax, 100 - xchg eax, ecx - mcZeroBits edx - div ecx - cmp edx, 10 - jb .L240 - - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - movzx ecx, [esi + TREKDATA.REMCOM] - lea edi, [esi + TREKDATA.CY] - add esi, TREKDATA.CX - -.find_commander: - cmp al, [esi] - jne .next_commander - cmp dl, [edi] - je .L221 - -.next_commander: - inc esi - inc edi - loop .find_commander - jmp .L240 - -.L221: - mov ecx, 322 - call TConsole_Cram - - mcLoadLocal esi, loc42.pTrekData - mov al, [esi + TREKDATA.BATX] - mov dl, [esi + TREKDATA.BATY] - mov cl, 1 - call TConsole_CramLoc - - mov ecx, 323 - call TConsole_Prout - - mov ecx, 324 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal esi, loc42.pTrekData - fld [esi + TREKDATA.FUTURE5] - call TConsole_CramFloat - - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - -.L240: - mcLoadLocal esi, loc42.pTrekData - cmp [esi + TREKDATA.ISSOS], 0 - je .L245 - cmp [esi + TREKDATA.ISATB], 1 - jne .L245 - - mov ecx, 322 - call TConsole_Cram - - mcLoadLocal esi, loc42.pTrekData - mov al, [esi + TREKDATA.ISX] - mov dl, [esi + TREKDATA.ISY] - mov cl, 1 - call TConsole_CramLoc - - mov ecx, 325 - call TConsole_Prout - - mov ecx, 324 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal esi, loc42.pTrekData - fld [esi + TREKDATA.FUTURE7] - call TConsole_CramFloat - - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - -.L245: - mcLoadLocal esi, loc42.pTrekData - cmp [esi + TREKDATA.ISUBDAM], 0 - je .L249 - - mov ecx, 328 - call TConsole_Cram - - mov cl, DEV_SUBSPACE_RADIO - call TArray_GetDblDamage - fldz - mcZeroBits eax - mc_CMP_ST0_ST1 - setz al - lea ecx, [eax + 326] - call TConsole_Cram - - mov ecx, 329 - call TConsole_Prout - mov ecx, 330 - call TConsole_Prout - -.L249: - mcLoadLocal esi, loc42.pTrekData - cmp [esi + TREKDATA.CASUAL], 0 - je .L250 - - movzx eax, [esi + TREKDATA.CASUAL] - call TConsole_CramInt - - mov ecx, 331 - call TConsole_Prout - -.L250: - mcLoadLocal esi, loc42.pTrekData - cmp [esi + TREKDATA.NHELP], 0 - je .L260 - - movzx eax, [esi + TREKDATA.NHELP] - mov ecx, 332 - call TConsole_CramSinglePlural - - mov ecx, 333 - call TConsole_Cram - call TConsole_ScrollUp - -.L260: - call TConsole_ScrollUp - -.done: - mcEndLocals loc42.size - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = value in range [1..8] -; Output: -; CF=TRUE if value is in range -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_IsValidQuadrant: - cmp eax, 1 - jb .failed - cmp eax, 8 - ja .failed - - stc - ret - -.failed: - clc - ret - -; -------------------------------------------------------------------------- -; GETFN -; -------------------------------------------------------------------------- -; Input: -; ESI = PCHAR - buffer to store the name into -; -------------------------------------------------------------------------- -virtual at 0 -loc88: - .pszBuffer PCHAR ? - .nAskThreeTimes COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_GetFileName: - mcBeginLocals loc88.size - mcStoreLocal loc88.pszBuffer, esi - - mcLoad8bitsToReg32 eax, 3 - mcStoreLocal loc88.nAskThreeTimes, eax - -.L40: - call TCmdBuf_Scan - mov al, [ebx + TCmdBuf.cmdbuf_KEY] - mcOnRegEqu al, CMD_TOKEN_EOL, .L75 - mcOnRegNotEqu al, CMD_TOKEN_ALPHA, .L100 - - call TCmdBuf_AnsiStrLen - cmp ecx, 27 - ja .too_long - - mcLoadLocal edi, loc88.pszBuffer - call TString_AnsiCopy - - dec edi - mov esi, str_TRK - call TString_AnsiCopy - jmp .done - -.too_long: - mov ecx, 668 - call TConsole_ProutGameMsg - jmp .ask - -.L75: - dec [esp + loc88.nAskThreeTimes] - jz .L100 - -.ask: - mov ecx, 665 - call TGame_Prompt - jmp .L40 - -.L100: - mcLoadLocal esi, loc88.pszBuffer - mov byte [esi], 0 - -.done: - mcEndLocals loc88.size - ret - -; -------------------------------------------------------------------------- -; SCORE -; -------------------------------------------------------------------------- -virtual at 0 -loc57: - .pTrekData PVOID ? - .dbl_TIMUSED DOUBLE ? - .dbl_PERDATE DOUBLE ? - .dbl_ITHPERD DOUBLE ? - .dbl_pad_1 DOUBLE ? - .nISCORE INT32 ? - .nIWON INT32 ? - .nIDIED INT32 ? - .nKLSHIP INT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Score: - mcBeginLocals loc57.size - - mcLoadGameDataPtr esi - mcStoreLocal loc57.pTrekData, esi - - fld [esi + TREKDATA.DATE] - fld [esi + TREKDATA.INDATE] - fsubp - fstp [esp + loc57.dbl_TIMUSED] - - fld [esp + loc57.dbl_TIMUSED] - fldz - mc_CMP_ST0_ST1 - jz .recalc_time_used - - cmp [esi + TREKDATA.REMKL], 0 - je .calc_per_date - -.recalc_time_used: - fld [esp + loc57.dbl_TIMUSED] - fld [glb_dbl_5] - call TCommon_FPU_Max - fstp [esp + loc57.dbl_TIMUSED] - -.calc_per_date: - mov al, [esi + TREKDATA.KILLC] - add al, [esi + TREKDATA.KILLK] - add al, [esi + TREKDATA.NSCKILL] - call TCommon_LoadByteIntoFPU - fld [esp + loc57.dbl_TIMUSED] - fdivp - fld st - fstp [esp + loc57.dbl_PERDATE] - fstp [glb_dbl_KlingonsPerDate] - - fld [esp + loc57.dbl_PERDATE] - fld [glb_dbl_500] - fmulp - fld [glb_dbl_0dot5] - faddp - fstp [esp + loc57.dbl_ITHPERD] - - mcZeroBits eax - mcStoreLocal loc57.nIWON, eax - - cmp [esi + TREKDATA.GAMEWON], 0 - je .check_ship - - movzx eax, [esi + TREKDATA.SKILL] - imul eax, 100 - mcStoreLocal loc57.nIWON, eax - -.check_ship: - mov al, [esi + TREKDATA.SHIP] - mcOnRegEqu al, CHAR_ENTERPRISE, .killed_zero_ships - mcOnRegEqu al, CHAR_FQUEENE, .killed_one_ship - mcOnRegZero al, .killed_two_ships - - ;int 3 - jmp .done - -.killed_zero_ships: - push 0 - jmp .store_killed_ships - -.killed_one_ship: - push 1 - jmp .store_killed_ships - -.killed_two_ships: - push 2 - -.store_killed_ships: - pop edx - mcStoreLocal loc57.nKLSHIP, edx - - mcZeroBits eax - cmp [esi + TREKDATA.ALIVE], 0 - jne .I_died - - add eax, 200 - -.I_died: - mcStoreLocal loc57.nIDIED, eax - - cmp [esi + TREKDATA.GAMEWON], 0 - jne .calc_total_score - - mov [esi + TREKDATA.NROMREM], 0 - -.calc_total_score: - movzx eax, [esi + TREKDATA.KILLK] - imul eax, 10 - mcStoreLocal loc57.nISCORE, eax - - movzx eax, [esi + TREKDATA.KILLC] - imul eax, 50 - add [esp + loc57.nISCORE], eax - - fld [esp + loc57.dbl_ITHPERD] - call TCommon_FP_Truncate - add [esp + loc57.nISCORE], eax - - mcLoadLocal eax, loc57.nIWON - add [esp + loc57.nISCORE], eax - - mcLoadLocal eax, loc57.nIDIED - sub [esp + loc57.nISCORE], eax - - movzx eax, [esi + TREKDATA.BASEKL] - imul eax, 100 - sub [esp + loc57.nISCORE], eax - - mcLoadLocal eax, loc57.nKLSHIP - imul eax, 100 - sub [esp + loc57.nISCORE], eax - - movzx eax, [esi + TREKDATA.NHELP] - imul eax, 45 - sub [esp + loc57.nISCORE], eax - - movzx eax, [esi + TREKDATA.STARKL] - imul eax, 5 - sub [esp + loc57.nISCORE], eax - - movzx eax, [esi + TREKDATA.CASUAL] - sub [esp + loc57.nISCORE], eax - - movzx eax, [esi + TREKDATA.NROMKL] - imul eax, 20 - add [esp + loc57.nISCORE], eax - - movzx eax, [esi + TREKDATA.NSCKILL] - imul eax, 200 - add [esp + loc57.nISCORE], eax - - movzx eax, [esi + TREKDATA.NPLANKL] - imul eax, 10 - sub [esp + loc57.nISCORE], eax - - movzx eax, [esi + TREKDATA.NROMREM] - add [esp + loc57.nISCORE], eax - ; - ; Report all that... - ; - mov cl, ATTR_REPORT_TEXT - call TConsole_SetAttr - call TConsole_ScrollUp - mov ecx, 632 - call TConsole_Prout - call TConsole_ScrollUp - - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.NROMKL], 0 - je .L1 - - movzx eax, [esi + TREKDATA.NROMKL] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 633 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.NROMKL] - imul eax, 20 - mov cl, 10 - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L1: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.NROMREM], 0 - je .L5 - - movzx eax, [esi + TREKDATA.NROMREM] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 634 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.NROMREM] - mov cl, 10 - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L5: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.KILLK], 0 - je .L10 - - movzx eax, [esi + TREKDATA.KILLK] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 635 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.KILLK] - imul eax, 10 - mov cl, 10 - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L10: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.KILLC], 0 - je .L12 - - movzx eax, [esi + TREKDATA.KILLC] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 636 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.KILLC] - imul eax, 50 - mov cl, 10 - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L12: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.NSCKILL], 0 - je .L15 - - movzx eax, [esi + TREKDATA.NSCKILL] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 637 - call TConsole_Prout - -.L15: - fld [esp + loc57.dbl_ITHPERD] - fldz - mc_CMP_ST0_ST1 - jz .L20 - - fld [esp + loc57.dbl_PERDATE] - mov cl, 2 - mov dl, 6 - call TConsole_CramFloatWidth - - mov ecx, 638 - call TConsole_Cram - - fld [esp + loc57.dbl_ITHPERD] - call TCommon_FP_Truncate - mov cl, 10 - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L20: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.STARKL], 0 - je .L30 - - movzx eax, [esi + TREKDATA.STARKL] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 639 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.STARKL] - imul eax, 5 - mov cl, 10 - neg eax - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L30: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.NPLANKL], 0 - je .L32 - - movzx eax, [esi + TREKDATA.NPLANKL] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 640 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.NPLANKL] - imul eax, 10 - mov cl, 10 - neg eax - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L32: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.BASEKL], 0 - je .L35 - - movzx eax, [esi + TREKDATA.BASEKL] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 641 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.BASEKL] - imul eax, 100 - mov cl, 10 - neg eax - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L35: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.NHELP], 0 - je .L40 - - movzx eax, [esi + TREKDATA.NHELP] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 642 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.NHELP] - imul eax, 45 - mov cl, 10 - neg eax - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L40: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.CASUAL], 0 - je .L45 - - movzx eax, [esi + TREKDATA.CASUAL] - mov cl, 6 - call TConsole_CramIntWidth - - mov ecx, 643 - call TConsole_Cram - - mcLoadLocal esi, loc57.pTrekData - movzx eax, [esi + TREKDATA.CASUAL] - mov cl, 10 - neg eax - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L45: - cmp [esp + loc57.nKLSHIP], 0 - je .L50 - - mov cl, 6 - mcLoadLocal eax, loc57.nKLSHIP - call TConsole_CramIntWidth - - mov ecx, 644 - call TConsole_Cram - - mcLoadLocal eax, loc57.nKLSHIP - imul eax, 100 - mov cl, 10 - neg eax - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L50: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.ALIVE], 0 - jne .L60 - - mov ecx, 645 - call TConsole_Prout - -.L60: - mcLoadLocal esi, loc57.pTrekData - cmp [esi + TREKDATA.GAMEWON], 0 - je .L70 - - mov ecx, 646 - call TConsole_Cram - - movzx ecx, [esi + TREKDATA.SKILL] - add ecx, 646 - call TConsole_Cram - - mcLoadLocal eax, loc57.nIWON - mov cl, 25 - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.L70: - call TConsole_ScrollUp - - mov ecx, 652 - call TConsole_Cram - - mcLoadLocal eax, loc57.nISCORE - mov [glb_Score], eax - mov cl, 10 - call TConsole_CramIntWidth - call TConsole_ScrollUp - -.done: - mcEndLocals loc57.size - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = index of the message table -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Prompt: - push ebx - - push ecx - mov cl, ATTR_PROMPT_TEXT - call TConsole_SetAttr - pop ecx - - call TConsole_Cram - call TConsole_RefreshCaretLine - lock dec [glb_GameThreadBusy] - -.check_if_cmd_complete: - mcZeroBits eax - lock add [glb_GameThreadBusy], eax - jnz .done - - invoke Sleep, eax - jmp .check_if_cmd_complete - -.done: - pop ebx - ret - -; -------------------------------------------------------------------------- -; JA -; -------------------------------------------------------------------------- -; Input: -; ECX = prompt text index -; Output: -; CF=1 if user answered "YES" -; -------------------------------------------------------------------------- -virtual at 0 -loc27: - .nMsgIndex INDEX ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_JA: - mcBeginLocals loc27.size - mcStoreLocal loc27.nMsgIndex, ecx - -.ask: - mcLoadLocal ecx, loc27.nMsgIndex - call TGame_Prompt - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .ask - - mcLoad8bitsToReg32 ecx, 159 - call TCmdBuf_Crop - jc .return_yes - - mcLoad8bitsToReg32 ecx, 122 - call TCmdBuf_Crop - jc .return_no - - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 160 - call TConsole_Prout - call TConsole_ScrollUp - jmp .ask - -.return_yes: - mcEndLocals loc27.size - stc - ret - -.return_no: - mcEndLocals loc27.size - clc - ret - -; -------------------------------------------------------------------------- -; FREEZE -; -------------------------------------------------------------------------- -; glb_bEmExit = 0 means normal freezing -; glb_bEmExit = 1 means freezing into EMSAVE.TRK -; -------------------------------------------------------------------------- -virtual at 0 -loc89: - .strFileName CHARS 32 - .hFile HANDLE ? - .dwSize COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Freeze: - mcBeginLocals loc89.size - - mcLoadGameDataPtr edi - mov [edi + TREKDATA.IDIDIT], 0 - - cmp [glb_bEmExit], 1 - je .emergency_exit - -.ask_fname: - mcLoadLocalRef esi, loc89.strFileName - call TGame_GetFileName - - cmp byte [esp], 0 - je .L920 - - invoke GetFileAttributes, esp - mcOnRegEqu eax, -1, .save - - mov cl, ATTR_PROMPT_TEXT - call TConsole_SetAttr - - mov ecx, 669 - call TConsole_Cram - - mov esi, esp - call TConsole_CramAnsi - - mov ecx, 670 - call TGame_JA - jnc .ask_fname - jmp .save - -.emergency_exit: - mov esi, str_EmSaveGame - mov edi, esp - call TString_AnsiCopy - -.save: - mcZeroBits eax - mcStoreLocal loc89.dwSize, eax - - mov esi, esp - invoke CreateFileAnsi, esi, GENERIC_WRITE, 0, 0,\ - CREATE_ALWAYS, FILE_FLAG_SEQ_SCAN, 0 - - mcStoreLocal loc89.hFile, eax - mcOnRegEqu eax, -1, .L920 - - mov esi, [glb_pCommon] - mov ecx, TCommon.size - mcLoadLocal ebx, loc89.hFile - mcLoadLocalRef edi, loc89.dwSize - invoke WriteFile, ebx, esi, ecx, edi, 0 - - invoke CloseHandle, ebx - - mov ecx, TCommon.size - cmp [edi], ecx - jne .L920 - -.file_stored: - mcLoadGameDataPtr edi - inc [edi + TREKDATA.IDIDIT] - - mov ecx, 666 - call TConsole_ProutGameMsg - jmp .done - -.L920: - mov ecx, 667 - call TConsole_ProutGameMsg - -.done: - mcEndLocals loc89.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Prelim: - mcLoad8bitsToReg32 ecx, 92 - call TConsole_ProutGameMsg - dec ecx - call TConsole_Prout - - mcLoad1 ecx - call TConsole_Prout - - mcLoad8bitsToReg32 ecx, 91 - call TConsole_Prout - inc ecx - call TConsole_Prout - dec ecx - call TConsole_Prout - - mov ecx, 654 - call TConsole_Prout - inc ecx - call TConsole_Prout - inc ecx - call TConsole_Prout - - mcLoad8bitsToReg32 ecx, 91 - call TConsole_Prout - - mov ecx, 657 - call TConsole_Prout - inc ecx - call TConsole_Prout - - mcLoad8bitsToReg32 ecx, 91 - call TConsole_Prout - - mov ecx, 659 - call TConsole_Prout - inc ecx - call TConsole_Prout - inc ecx - call TConsole_Prout - inc ecx - call TConsole_Prout - - mcLoad8bitsToReg32 ecx, 91 - call TConsole_Prout - call TConsole_Prout - - mov ecx, 663 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 92 - call TConsole_Prout - - mov cl, 5 - call TConsole_Skip - ret - -; -------------------------------------------------------------------------- -; ESI = points to file name -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_CutTheExtension: - mov edi, esi - mov al, '.' - mcLoadNeg1 ecx - repne scasb - dec edi - mov byte [edi], 0 - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc101: - .fileInfo rb WIN32_FIND_DATA.size - .hFind HANDLE ? - .nFilesPerLine COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_ListFrozenGames: - mcBeginLocals loc101.size - - invoke FindFirstFile, str_FileMask, esp - mcStoreLocal loc101.hFind, eax - mcOnRegEqu eax, -1, .done - - mov cl, ATTR_SCAN_SCALE - call TConsole_SetAttr - call TConsole_ScrollUp - mov ecx, 709 - call TConsole_Prout - call TConsole_ScrollUp - mov [esp + loc101.nFilesPerLine], 4 - -.list_that_file: - mov eax, [esp + WIN32_FIND_DATA.dwAttr] - test eax, FILE_ATTR_DIR - jnz .next - - mov cl, 2 - call TConsole_RepeatBlank - - lea esi, [esp + WIN32_FIND_DATA.strName] - call TGame_CutTheExtension - call TConsole_CramWide - - dec [esp + loc101.nFilesPerLine] - jnz .next - - mov [esp + loc101.nFilesPerLine], 4 - call TConsole_ScrollUp - -.next: - mcLoadLocal edx, loc101.hFind - invoke FindNextFile, edx, esp - mcOnRegNotZero eax, .list_that_file - - call TConsole_ScrollUp - - cmp [esp + loc101.nFilesPerLine], 4 - je .done - - call TConsole_ScrollUp - -.done: - mcEndLocals loc101.size - ret - -; -------------------------------------------------------------------------- -; THAW -; -------------------------------------------------------------------------- -virtual at 0 -loc87: - .fileName CHARS 32 - .hFile HANDLE ? - .dwSize COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Thaw: - mcBeginLocals loc87.size - - mcLoadGameDataPtr edi - mov [edi + TREKDATA.IDIDIT], 0 - -.ask_fname: - mov esi, esp - call TGame_GetFileName - - cmp byte [esp], 0 - je .L800 - - invoke GetFileAttributes, esp - mcOnRegEqu eax, -1, .no_such_file - - mov esi, esp - invoke CreateFileAnsi, esi, GENERIC_READ, 0, 0,\ - OPEN_EXISTING, FILE_FLAG_SEQ_SCAN, 0 - - mcStoreLocal loc87.hFile, eax - mcOnRegEqu eax, -1, .L800 - - mov esi, [glb_pCommon] - mov ecx, TCommon.size - mcLoadLocal ebx, loc87.hFile - mcLoadLocalRef edi, loc87.dwSize - mov dword [edi], 0 - invoke ReadFile, ebx, esi, ecx, edi, 0 - - invoke CloseHandle, ebx - - mov ecx, TCommon.size - cmp [edi], ecx - jne .L800 - - mov ecx, 671 - call TConsole_ProutGameMsg - jmp .done - -.no_such_file: - mov esi, esp - mov edi, str_CmdListGames - call TString_AnsiEqual - jc .list_all_files - - mov ecx, 673 - call TConsole_ProutGameMsg - jmp .ask_fname - -.list_all_files: - call TGame_ListFrozenGames - jmp .ask_fname - -.L800: - ; - ; Game was not loaded - ; - mcLoadGameDataPtr edi - add edi, TREKDATA.PASSWD - mov byte [edi], 0 - - mov ecx, 672 - call TConsole_ProutGameMsg - -.done: - mcEndLocals loc87.size - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = token for hashing and initializing the RNG -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_InitTournament: - mcZeroBits eax - mcZeroBits edx - -.next_char: - mov dl, [esi] - inc esi - mcOnRegZero edx, .seed_RNG_with_EAX - - shl eax, 5 - xor al, dl - jmp .next_char - -.seed_RNG_with_EAX: - call TRandom_Seed - - mcLoadGameDataPtr ebx - mcLoadNeg1 eax - mcStoreMember TREKDATA.THINGX, al - mcStoreMember TREKDATA.THINGY, al - ret - -; -------------------------------------------------------------------------- -; Output: -; ECX = TRUE if FROZEN game is selected -; -------------------------------------------------------------------------- -virtual at 0 -loc10: - .bFrozen BOOL ? - .pszToken PCHAR ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Choose: - mcBeginLocals loc10.size - - mcZeroBits eax - mcLoadGameDataPtr edi - mov ecx, TREKDATA.size - rep stosb - -.L5: - mcZeroBits eax - mcStoreLocal loc10.bFrozen, eax - - mcLoad8bitsToReg32 ecx, 3 - call TGame_Prompt - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .L5 - - mcLoad8bitsToReg32 ecx, 10 - call TCmdBuf_Crop - jc .L9 - - mcLoad8bitsToReg32 ecx, 11 - call TCmdBuf_Crop - jc .L100 - - mcLoad8bitsToReg32 ecx, 12 - call TCmdBuf_Crop - jc .L200 - jmp .L5 - -.L9: - mcZeroBits eax - mcLoadGameDataPtr ebx - mcStoreMember TREKDATA.SKILL, al - mcStoreMember TREKDATA.LENGTH, al - -.L10: - call TCmdBuf_Scan - mcStoreLocal loc10.pszToken, esi - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_ALPHA - jne .L20 - ; - ; Check for different kinds of games - ; - mcZeroBits eax - mov ebx, [glb_pGameData] - mcStoreMember TREKDATA.KSTUF5, al - - mcLoad8bitsToReg32 ecx, 74 - call TCmdBuf_Crop - jnc .check_medium - - mov [ebx + TREKDATA.LENGTH], 1 - -.check_medium: - mcLoad8bitsToReg32 ecx, 75 - call TCmdBuf_Crop - jnc .check_long - - mov [ebx + TREKDATA.LENGTH], 2 - -.check_long: - mcLoad8bitsToReg32 ecx, 76 - call TCmdBuf_Crop - jnc .check_novice - - mov [ebx + TREKDATA.LENGTH], 4 - -.check_novice: - mcLoad8bitsToReg32 ecx, 13 - call TCmdBuf_Crop - jnc .check_fair - - mov [ebx + TREKDATA.SKILL], 1 - -.check_fair: - mcLoad8bitsToReg32 ecx, 14 - call TCmdBuf_Crop - jnc .check_good - - mov [ebx + TREKDATA.SKILL], 2 - -.check_good: - mcLoad8bitsToReg32 ecx, 15 - call TCmdBuf_Crop - jnc .check_expert - - mov [ebx + TREKDATA.SKILL], 3 - -.check_expert: - mcLoad8bitsToReg32 ecx, 16 - call TCmdBuf_Crop - jnc .check_emeritus - - mov [ebx + TREKDATA.SKILL], 4 - mov [ebx + TREKDATA.KSTUF5], 1 - -.check_emeritus: - mcLoad8bitsToReg32 ecx, 17 - call TCmdBuf_Crop - jnc .check_both_entered - - mov [ebx + TREKDATA.SKILL], 5 - mov [ebx + TREKDATA.KSTUF5], 2 - -.check_both_entered: - cmp [ebx + TREKDATA.LENGTH], 0 - je .L10 - cmp [ebx + TREKDATA.SKILL], 0 - je .L10 - jmp .L30 - -.L20: - mov ebx, [glb_pGameData] - cmp [ebx + TREKDATA.LENGTH], 0 - jne .L25 - - mcLoad8bitsToReg32 ecx, 4 - call TGame_Prompt - jmp .L10 - -.L25: - cmp [ebx + TREKDATA.SKILL], 0 - jne .L30 - - mcLoad8bitsToReg32 ecx, 5 - call TGame_Prompt - jmp .L10 - -.L30: - ; - ; Read in secret password - ; - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - jne .L40 - -.ask_password: - mcLoad8bitsToReg32 ecx, 6 - call TGame_Prompt - jmp .L30 - -.L40: - call TCmdBuf_AnsiStrLen - cmp ecx, 8 - ja .ask_password - - mov edi, [glb_pGameData] - push edi - add edi, TREKDATA.PASSWD - inc ecx - rep movsb - pop edi - ; - ; Use parameters to generate initial game values - ; - mov al, [edi + TREKDATA.SKILL] - call TCommon_LoadByteIntoFPU - fld [glb_dbl_0dot5] - fmulp - fstp [edi + TREKDATA.DAMFAC] - - mcLoad8bitsToReg32 edx, 3 - call TRandom_IRan - add eax, 2 - mov [edi + TREKDATA.REMBASE], al - - mcLoad8bitsToReg32 edx, 6 - call TRandom_IRan - add eax, 5 - mov [edi + TREKDATA.INPLAN], al - - call TRandom_Ranf - fld [glb_dbl_2] - faddp - mov al, [edi + TREKDATA.SKILL] - call TCommon_LoadByteIntoFPU - fmulp - call TCommon_FP_Truncate - mov [edi + TREKDATA.NROMREM], al - - movzx eax, [edi + TREKDATA.SKILL] - mcZeroBits edx - mcLoad8bitsToReg32 ecx, 3 - div ecx - mov [edi + TREKDATA.NSCREM], al - - mov al, [edi + TREKDATA.LENGTH] - call TCommon_LoadByteIntoFPU - fld [glb_dbl_7] - fmulp - fld st - fstp [edi + TREKDATA.REMTIME] - fstp [edi + TREKDATA.INTIME] - - call TRandom_Ranf - fld st - faddp ; 2*RANF(0) - - mov al, [edi + TREKDATA.SKILL] - call TCommon_LoadByteIntoFPU - fsubrp ; SKILL - 2*RANF(0) - - fld1 - faddp ; SKILL - 2*RAND(0) + 1.0 - - fild [glb_FPU_Int32] - fmulp ; (SKILL - 2*RANF(0) + 1.0)*SKILL - - fld [glb_dbl_0dot1] - fmulp ; (SKILL - 2*RANF(0) + 1.0)*SKILL*0.1 - - fld [glb_dbl_0dot15] - faddp ; RATE = ... + 0.15 - - fld st - faddp - fld [edi + TREKDATA.INTIME] - fmulp - call TCommon_FP_Truncate - mov [edi + TREKDATA.REMKL], al - mov [edi + TREKDATA.INKLING], al - - call TCommon_LoadByteIntoFPU - call TRandom_Ranf - fmulp - fld [glb_dbl_0dot0625] - fmulp - call TCommon_FP_Truncate - add al, [edi + TREKDATA.SKILL] - - cmp al, 10 - jbe .store_commander_count - - mov al, 10 - -.store_commander_count: - mov [edi + TREKDATA.INCOM], al - mov [edi + TREKDATA.REMCOM], al - - shl al, 2 - add al, [edi + TREKDATA.INKLING] - call TCommon_LoadByteIntoFPU - fld [edi + TREKDATA.INTIME] - fmulp - fld st - fstp [edi + TREKDATA.REMRES] - fstp [edi + TREKDATA.INRESOR] - - cmp [edi + TREKDATA.INKLING], 50 - jbe .store_initial_base_count - - inc [edi + TREKDATA.REMBASE] - -.store_initial_base_count: - mov al, [edi + TREKDATA.REMBASE] - mov [edi + TREKDATA.INBASE], al - jmp .done - -.L100: - ; - ; Process a tournament request - ; - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .ask_tnumber - - call TGame_InitTournament - jmp .L9 - -.ask_tnumber: - mcLoad8bitsToReg32 ecx, 7 - call TGame_Prompt - jmp .L100 - -.L200: - ; - ; Frozen game requested - ; - call TGame_Thaw - mov esi, [glb_pGameData] - cmp [esi + TREKDATA.PASSWD], 0 - je .L5 - ; - ; Game loaded - ; - inc [esp + loc10.bFrozen] - mov ebx, [glb_pGameData] - mcZeroBits eax - mov [ebx + TREKDATA.THINGX], al - mov [ebx + TREKDATA.THINGY], al - - lea esi, [ebx + TREKDATA.QUAD] - mcLoad8bitsToReg32 ecx, 100 - -.erase_things: - cmp byte [esi], CHAR_THING - jne .no_thing - - mov byte [esi], CHAR_COSMOS - -.no_thing: - inc esi - loop .erase_things - - mov [ebx + TREKDATA.IDIDIT], 1 - call TGame_Report - -.done: - mcLoadLocal ecx, loc10.bFrozen - mcEndLocals loc10.size - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_ListAllCommands: - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 8 - call TConsole_Prout - - mcLoad8bitsToReg32 edx, 8 - mcLoad8bitsToReg32 ecx, 76 - -.next: - inc ecx - push edx - call TConsole_Prout - pop edx - dec edx - jnz .next - - call TConsole_ScrollUp - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc99: - .OldSectX BYTE ? - .OldSectY BYTE ? - .NewSectX BYTE ? - .NewSectY BYTE ? - .CharEnemy BYTE ? - .__align_1 BYTE ? - .__align_2 BYTE ? - .__align_3 BYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_DbgMoveEnemy: - mcBeginLocals loc99.size - - mov ecx, 714 - call TGame_Prompt - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .done - - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc99.OldSectX, al - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .done - - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc99.OldSectY, al - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .done - - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc99.NewSectX, al - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .done - - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc99.NewSectY, al - - movzx eax, [esp + loc99.NewSectX] - call TPhotons_IsValidSector - jnc .done - - movzx eax, [esp + loc99.NewSectY] - call TPhotons_IsValidSector - jnc .done - - mcLoadGameDataPtr ebx - mcZeroBits ecx - mcLoadMember cl, TREKDATA.NENHERE - jecxz .done - - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - - mcLoadLocal al, loc99.OldSectX - mcLoadLocal dl, loc99.OldSectY - -.check_sector: - cmp al, [esi] - jne .next - - cmp dl, [edi] - je .move_klingon - -.next: - inc esi - inc edi - loop .check_sector - jmp .done - -.move_klingon: - mcLoadLocal al, loc99.NewSectX - mcLoadLocal dl, loc99.NewSectY - - mov [esi], al - mov [edi], dl - - mcLoadLocal al, loc99.OldSectX - mcLoadLocal dl, loc99.OldSectY - call TArray_QuadPtr - - mov al, [ebx] - mov byte [ebx], CHAR_COSMOS - mcStoreLocal loc99.CharEnemy, al - - mcLoadLocal al, loc99.NewSectX - mcLoadLocal dl, loc99.NewSectY - call TArray_QuadPtr - mcLoadLocal al, loc99.CharEnemy - mov [ebx], al - - call TCommon_SortKlingons - -.done: - mcEndLocals loc99.size - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc98: - .ShipQuadX BYTE ? - .ShipQuadY BYTE ? - .__align_1 BYTE ? - .__align_2 BYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_DbgMoveShip: - mcBeginLocals loc98.size - - mov ecx, 168 - call TGame_Prompt - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .done - - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - call TGame_IsValidQuadrant - jnc .done - mcStoreLocal loc98.ShipQuadX, al - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .done - - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - call TGame_IsValidQuadrant - jnc .done - mcStoreLocal loc98.ShipQuadY, al - - mcLoadGameDataPtr esi - cmp al, [esi + TREKDATA.QUADY] - jne .move_ship - - mov al, [esi + TREKDATA.QUADX] - cmp [esp + loc98.ShipQuadX], al - je .done - -.move_ship: - mcLoadLocal al, loc98.ShipQuadX - mcLoadLocal dl, loc98.ShipQuadY - - mov [esi + TREKDATA.QUADX], al - mov [esi + TREKDATA.QUADY], dl - - call TCommon_NewQuad - -.done: - mcEndLocals loc98.size - ret - -; -------------------------------------------------------------------------- -; PROGRAM STARTRK from original FORTRAN source -; -------------------------------------------------------------------------- -align PROC_ALIGN -TGame_Thread: - mcProlog - call TGame_Prelim - -.L10: - call TGame_Choose - mcOnRegNotZero ecx, .L15 - - call TCommon_Setup - -.L15: - mov [glb_MOVED], 0 - -.L20: - mov esi, [glb_pGameData] - cmp [esi + TREKDATA.ALLDONE], 0 - jne .L9999 - -.reset_before_cmd: - mcZeroBits eax - mov [esi + TREKDATA.JUSTIN], al - mov [esi + TREKDATA.KDIDIT], al - - fldz - fstp [esi + TREKDATA.TIME] - - mcLoad8bitsToReg32 ecx, 2 - call TGame_Prompt - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .L20 - - mcLoad8bitsToReg32 ecx, 18 - call TCmdBuf_Crop - jc .L100 - - mcLoad8bitsToReg32 ecx, 26 - call TCmdBuf_Crop - jc .L200 - - mcLoad8bitsToReg32 ecx, 20 - call TCmdBuf_Crop - jc .L300 - - mcLoad8bitsToReg32 ecx, 24 - call TCmdBuf_Crop - jc .L400 - - mcLoad8bitsToReg32 ecx, 19 - call TCmdBuf_Crop - jc .L500 - - mcLoad8bitsToReg32 ecx, 28 - call TCmdBuf_Crop - jc .L600 - - mcLoad8bitsToReg32 ecx, 32 - call TCmdBuf_Crop - jc .L700 - - mcLoad8bitsToReg32 ecx, 34 - call TCmdBuf_Crop - jc .L800 - - mcLoad8bitsToReg32 ecx, 30 - call TCmdBuf_Crop - jc .L900 - - mcLoad8bitsToReg32 ecx, 23 - call TCmdBuf_Crop - jc .L1000 - - mcLoad8bitsToReg32 ecx, 31 - call TCmdBuf_Crop - jc .L1100 - - mcLoad8bitsToReg32 ecx, 27 - call TCmdBuf_Crop - jc .L1200 - - mcLoad8bitsToReg32 ecx, 22 - call TCmdBuf_Crop - jc .L1300 - - mcLoad8bitsToReg32 ecx, 36 - call TCmdBuf_Crop - jc .L1400 - - mcLoad8bitsToReg32 ecx, 37 - call TCmdBuf_Crop - jc .L1450 - - mcLoad8bitsToReg32 ecx, 38 - call TCmdBuf_Crop - jc .L1500 - - mcLoad8bitsToReg32 ecx, 39 - call TCmdBuf_Crop - jc .L1550 - - mcLoad8bitsToReg32 ecx, 40 - call TCmdBuf_Crop - jc .L1600 - - mcLoad8bitsToReg32 ecx, 41 - call TCmdBuf_Crop - jc .L1650 - - mcLoad8bitsToReg32 ecx, 42 - call TCmdBuf_Crop - jc .L1670 - - mcLoad8bitsToReg32 ecx, 43 - call TCmdBuf_Crop - jc .L1680 - - mcLoad8bitsToReg32 ecx, 45 - call TCmdBuf_Crop - jc .L1685 - - mcLoad8bitsToReg32 ecx, 46 - call TCmdBuf_Crop - jc .L1690 - ; - ; Non-abbreviated commands (checking) - ; - mcLoad8bitsToReg32 ecx, 21 - call TCmdBuf_Crop - jc .L1700 - - mcLoad8bitsToReg32 ecx, 33 - call TCmdBuf_Crop - jc .L9000 - - mcLoad8bitsToReg32 ecx, 25 - call TCmdBuf_Crop - jc .L1900 - - mcLoad8bitsToReg32 ecx, 29 - call TCmdBuf_Crop - jc .L2000 - - mcLoad8bitsToReg32 ecx, 35 - call TCmdBuf_Crop - jc .L2100 - - mcLoad8bitsToReg32 ecx, 44 - call TCmdBuf_Crop - jc .L2200 - - mov ecx, 708 - call TCmdBuf_Crop - jc .L2300 - ; - ; Get help, mon! - ; - call TGame_ListAllCommands - jmp .L20 - -.L100: - call TSrScan_Main - jmp .L20 - -.L200: - call TLrScan_Main - jmp .L20 - -.L300: - call TPhasers_Main - -.L305: - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.IDIDIT], 0 - je .L20 - -.L310: - call TAttack_Main - -.L320: - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.KDIDIT], 0 - jne .L2500 - jmp .L15 - -.L400: - call TPhotons_Main - -.L410: - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.IDIDIT], 0 - je .L20 - - mov [glb_MOVED], 0 - jmp .L2500 - -.L500: - cmp [glb_MOVED], 0 - je .L510 - -.L505: - mov [glb_MOVED], 2 - -.L510: - call TMove_Warp - -.L520: - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.IDIDIT], 0 - jne .L521 - - cmp [glb_MOVED], 2 - jne .L521 - - dec [glb_MOVED] - -.L521: - cmp [esi + TREKDATA.IDIDIT], 0 - je .L20 - - cmp [glb_MOVED], 2 - jne .L522 - - cmp [esi + TREKDATA.JUSTIN], 0 - jne .L522 - - call TAttack_Main - -.L522: - mov [glb_MOVED], 1 - jmp .L2500 - -.L600: - call TShields_Main - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.IDIDIT], 0 - je .L20 - - call TAttack_Main - mcLoadGameDataPtr esi - mov [esi + TREKDATA.SHLDCHG], 0 - jmp .L320 - -.L700: - call TDock_Main - jmp .L305 - -.L800: - call TDock_DamageReport - jmp .L20 - -.L900: - call TChart_Main - jmp .L20 - -.L1000: - cmp [glb_MOVED], 0 - jne .L505 - - call TImpulse_Main - jmp .L520 - -.L1100: - call TGame_Wait - jmp .L410 - -.L1200: - call TChart_SetWarp - jmp .L20 - -.L1300: - call TSrScan_Status - jmp .L20 - -.L1400: - call TPlanet_Sensor - -.skip_before_prompt: - call TConsole_ScrollUp - jmp .L20 - -.L1450: - call TPlanet_Orbit - jmp .L410 - -.L1500: - call TPlanet_Beam - jmp .L20 - -.L1550: - call TPlanet_Mine - jmp .L410 - -.L1600: - call TPlanet_Crystal - jmp .L20 - -.L1650: - call TPlanet_Galileo - jmp .L410 - -.L1670: - call TPlanet_Main - jmp .skip_before_prompt - -.L1680: - call TSrScan_Request - jmp .L20 - -.L1685: - inc [glb_bEmExit] - call TGame_Freeze - jmp .quit_now_fast - -.L1690: - mcLoadGameDataPtr edi - mov [edi + TREKDATA.IDIDIT], 0 - - call TGame_Report - jmp .L20 - ; - ; Non-abbreviated commands (executing) - ; -.L1700: - mov cl, 21 - call TCmdBuf_VerifyToken - jnc .L20 - - call TDock_Help - jmp .L20 - -.L9000: - mov cl, 33 - call TCmdBuf_VerifyToken - jnc .L20 - jmp .L9001 - -.L1900: - mov cl, 25 - call TCmdBuf_VerifyToken - jnc .L20 - - call TDock_Abandon - jmp .L20 - -.L2000: - mov cl, 29 - call TCmdBuf_VerifyToken - jnc .L20 - - call TApp_SelfDestruct - jmp .L20 - -.L2100: - mov cl, 35 - call TCmdBuf_VerifyToken - jnc .L20 - - call TGame_Freeze - - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.IDIDIT], 1 - je .L9999 - jmp .L20 - -.L2200: - mov cl, 44 - call TCmdBuf_VerifyToken - jnc .L20 - - call TPlanet_DeathRay - jmp .L305 - -.L2300: - mov ecx, 708 - call TCmdBuf_VerifyToken_ECX - jnc .L20 - - call TLrScan_Log - jmp .L20 - -.L2500: - ; - ; After command which may use time invoke events module - ; - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.ALLDONE], 0 - jne .L9999 - - fld [esi + TREKDATA.TIME] - fldz - mc_CMP_ST0_ST1 - jz .L2501 - - call TEvents_Main - - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.ALLDONE], 0 - jne .L9999 - -.L2501: - call TArray_MyGalaxyPtr - cmp dword [ebx], 1000 - jne .L2510 - - mov al, 16 - mcZeroBits ecx - call TNova_AutomaticOverride - - mcZeroBits eax - mov [glb_MOVED], al - jmp .L2500 - -.L2510: - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.NENHERE], 0 - jne .L2511 - - call TEvents_MoveTholian - -.L2511: - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.KDIDIT], 1 - je .L15 - cmp [esi + TREKDATA.NENHERE], 0 - je .L15 - - cmp [glb_MOVED], 0 - je .L310 - cmp [esi + TREKDATA.JUSTIN], 1 - je .L310 - jmp .L20 - -.L9001: - call TGame_Score - -.L9999: - call TConsole_ScrollUp - call TConsole_ScrollUp - call TPlanet_Stars - call TConsole_ScrollUp - - mov ecx, 474 - call TGame_JA - jnc .end_game - - mov cl, 40 - call TConsole_Skip - jmp .L10 - -.end_game: - call TConsole_ScrollUp - mov ecx, 475 - call TConsole_ProutGameMsg - mov ecx, 476 - call TConsole_Prout - call TConsole_ScrollUp - - mov ecx, 653 - call TGame_Prompt - -.quit_now_fast: - invoke PostMessage, [glb_MainWnd], WM_CLOSE, 0, 0 - - mcEpilog - ret 4 - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TImpulse.Asm b/programs/games/StarTrek/trunk/TImpulse.Asm deleted file mode 100644 index 7c422169d2..0000000000 --- a/programs/games/StarTrek/trunk/TImpulse.Asm +++ /dev/null @@ -1,158 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TImpulse.Asm -; DATE: November 9, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; IMPULSE -; -------------------------------------------------------------------------- -virtual at 0 -loc50: - .pTrekData PVOID ? - .dbl_POWER DOUBLE ? - .__padded__ BYTES 2 - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TImpulse_Main: - mcBeginLocals loc50.size - - mcLoadGameDataPtr esi - mcStoreLocal loc50.pTrekData, esi - - mov [esi + TREKDATA.IDIDIT], 0 - - mov cl, DEV_IMPULSE_ENGINES - call TArray_IsDamaged - jc .L40 - - fld [glb_dbl_30] - fld [esi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jc .L5 - jz .L5 - - call TMove_GetCourseDistance - - mcLoadLocal esi, loc50.pTrekData - fldz - fld [esi + TREKDATA.DIREC] - mc_CMP_ST0_ST1 - jc .done - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_100] - fmulp - fld [glb_dbl_20] - faddp - fstp [esp + loc50.dbl_POWER] - - fld [esi + TREKDATA.ENERGY] - fld [esp + loc50.dbl_POWER] - mc_CMP_ST0_ST1 - jc .L20 - -.L5: - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mov ecx, 576 - call TConsole_Prout - mov ecx, 577 - call TConsole_Prout - - mcLoadLocal esi, loc50.pTrekData - fld [glb_dbl_30] - fld [esi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jnc .L10 - - mov ecx, 578 - call TConsole_Prout - jmp .done - -.L10: - mov ecx, 579 - call TConsole_Prout - - mcLoadLocal esi, loc50.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [glb_dbl_20] - fsubp - fld [glb_dbl_0dot01] - fmulp - fld [glb_dbl_0dot05] - fsubp - - mov cl, 1 - call TConsole_CramFloat - - mov ecx, 580 - call TConsole_Prout - jmp .done - -.L20: - mcLoadLocal esi, loc50.pTrekData - fld [esi + TREKDATA.DIST] - fld [glb_dbl_0dot095] - fdivp - fstp [esi + TREKDATA.TIME] - - fld [esi + TREKDATA.REMTIME] - fld [esi + TREKDATA.TIME] - mc_CMP_ST0_ST1 - jc .L30 - - call TConsole_SetCrewMsgAttr - mov ecx, 581 - call TConsole_Prout - mov ecx, 582 - call TConsole_Prout - mov ecx, 583 - call TConsole_Prout - - mcLoad8bitsToReg32 ecx, 158 - call TGame_JA - jnc .done - -.L30: - call TMove_Move - mcLoadLocal esi, loc50.pTrekData - inc [esi + TREKDATA.IDIDIT] - - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_100] - fmulp - fld [glb_dbl_20] - faddp - fld [esi + TREKDATA.ENERGY] - fsubrp - fstp [esi + TREKDATA.ENERGY] - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_0dot095] - fdivp - fstp [esi + TREKDATA.TIME] - - fld [esi + TREKDATA.ENERGY] - fldz - mc_CMP_ST0_ST1 - jc .done - - mov al, 4 - call TFinish_Main - jmp .done - -.L40: - call TConsole_ScrollUp - mov ecx, 584 - call TConsole_ProutGameMsg - -.done: - mcEndLocals loc50.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TLog.Asm b/programs/games/StarTrek/trunk/TLog.Asm deleted file mode 100644 index b5925ca251..0000000000 --- a/programs/games/StarTrek/trunk/TLog.Asm +++ /dev/null @@ -1,143 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TLog.Asm -; DATE: February 21, 2009 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLog_Create: - invoke HeapAlloc, [glb_Allocator], HEAP_NO_SERIALIZE, TLog.size - mov [glb_pLog], eax - - mov edi, eax - mcZeroBits eax - - mov [edi + TLog.nRemainChars], eax - mov [edi + TLog.nStoredChars], eax - mov [edi + TLog.pCurrentBufPos], eax - - invoke VirtualAlloc, 0, MAX_LOG_ROOM, MEM_COMMIT or MEM_RESERVE, PAGE_READWRITE - mov [edi + TLog.pBuffer], eax - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLog_Enable: - invoke CreateFile, str_LogFileName, GENERIC_WRITE, \ - 0, 0, CREATE_ALWAYS, FILE_FLAG_SEQ_SCAN, 0 - - invoke CloseHandle, eax - - mov edi, [glb_pLog] - mcZeroBits eax - mov edx, MAX_LOG_ROOM - mov ebx, [edi + TLog.pBuffer] - - mov [edi + TLog.nRemainChars], edx - mov [edi + TLog.nStoredChars], eax - mov [edi + TLog.pCurrentBufPos], ebx - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLog_Backspace: - cmp [glb_LogEnabled], 1 - je .do_it - ret - -.do_it: - mov esi, [glb_pLog] - cmp [esi + TLog.nStoredChars], 0 - je .print_backspace - - dec [esi + TLog.nStoredChars] - dec [esi + TLog.pCurrentBufPos] - inc [esi + TLog.nRemainChars] - ret - -.print_backspace: - mov al, '\' - call TLog_DumpChar - mov al, 'B' - call TLog_DumpChar - mov al, 'S' - call TLog_DumpChar - mov al, 'P' - call TLog_DumpChar - mov al, '\' - call TLog_DumpChar - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLog_Disable: - cmp [glb_LogEnabled], 1 - je .do_it - ret - -.do_it: - call TLog_Flush - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLog_Flush: - mov esi, [glb_pLog] - mov ecx, [esi + TLog.nStoredChars] - jecxz .done - - invoke CreateFile, str_LogFileName, GENERIC_WRITE, \ - 0, 0, OPEN_EXISTING, FILE_FLAG_SEQ_SCAN, 0 - - mov ebx, eax - invoke SetFilePointer, eax, 0, 0, 2 - - invoke WriteFile, ebx, [esi + TLog.pBuffer], [esi + TLog.nStoredChars], glb_FPU_Int32, 0 - invoke CloseHandle, ebx - - mcZeroBits eax - mov edx, MAX_LOG_ROOM - mov ebx, [esi + TLog.pBuffer] - - mov [esi + TLog.nRemainChars], edx - mov [esi + TLog.nStoredChars], eax - mov [esi + TLog.pCurrentBufPos], ebx - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; AL = character to append into log buffer. -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLog_DumpChar: - cmp [glb_LogEnabled], 1 - je .do_it - ret - -.do_it: - mcOnRegZero al, .do_backspace - - mov esi, [glb_pLog] - cmp [esi + TLog.nRemainChars], 0 - jne .dump - - push eax - call TLog_Flush - pop eax - mov esi, [glb_pLog] - -.dump: - mov edi, [esi + TLog.pCurrentBufPos] - stosb - mov [esi + TLog.pCurrentBufPos], edi - inc [esi + TLog.nStoredChars] - dec [esi + TLog.nRemainChars] - ret - -.do_backspace: - call TLog_Backspace - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TLog.Inc b/programs/games/StarTrek/trunk/TLog.Inc deleted file mode 100644 index e5ceb681b4..0000000000 --- a/programs/games/StarTrek/trunk/TLog.Inc +++ /dev/null @@ -1,28 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TLog.Inc -; DATE: February 21, 2009 -; -------------------------------------------------------------------------- - -MAX_LOG_ROOM = 40000h - -; -------------------------------------------------------------------------- -PLAQUE_INSERT_KLRATE = 0F8h -PLAQUE_INSERT_SCORE = 0F9h -PLAQUE_INSERT_DATE = 0FAh -PLAQUE_INSERT_LEVEL = 0FBh -PLAQUE_INSERT_NAME = 0FCh -PLAQUE_STRING = 0FDh -PLAQUE_END_OF_LINE = 0FEh -PLAQUE_END_OF_ALL = 0FFh - -; -------------------------------------------------------------------------- -virtual at 0 -TLog: - .pBuffer PCHAR ? - .pCurrentBufPos PCHAR ? - .nStoredChars COUNT ? - .nRemainChars COUNT ? - .size = $ -end virtual - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TLrScan.Asm b/programs/games/StarTrek/trunk/TLrScan.Asm deleted file mode 100644 index c062f96e30..0000000000 --- a/programs/games/StarTrek/trunk/TLrScan.Asm +++ /dev/null @@ -1,184 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TLrScan.Asm -; DATE: October 11, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Enable/Disable log file -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLrScan_Log: - call TCmdBuf_Scan - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_ALPHA - je .check_yes_no - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .print_log_state - -.print_log_format: - mov ecx, 712 - -.print: - call TConsole_ProutGameMsg - ret - -.check_yes_no: - mcLoad8bitsToReg32 ecx, 159 - call TCmdBuf_Crop - jc .yes - - mcLoad8bitsToReg32 ecx, 122 - call TCmdBuf_Crop - jnc .print_log_format - ; - ; Switch logging OFF - ; - cmp [glb_LogEnabled], 0 - je .msg710 - - call TLog_Disable - mov [glb_LogEnabled], 0 - -.msg710: - mov ecx, 710 - jmp .print - -.yes: - ; - ; Switch logging ON - ; - cmp [glb_LogEnabled], 1 - je .msg711 - - mov [glb_LogEnabled], 1 - call TLog_Enable - -.msg711: - mov ecx, 711 - jmp .print - -.print_log_state: - movzx ecx, [glb_LogEnabled] - add ecx, 710 - jmp .print - -; -------------------------------------------------------------------------- -; Input: -; EAX = X quadrant coordinate (may be out of range) -; EDX = Y quadrant coordinate (may be out of range) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLrScan_DumpContents: - push eax edx - - cmp eax, 1 - jb .out_of_range - cmp edx, 1 - jb .out_of_range - cmp eax, 8 - ja .out_of_range - cmp edx, 8 - ja .out_of_range - - mcLoad1 ecx - call TArray_SetStarChartValue - - mov cl, ATTR_REPORT_VALUE - call TConsole_SetAttr - - call TArray_GetGalaxyValue - mov eax, ecx - mov cl, 5 - call TConsole_CramIntWidth - jmp .done - -.out_of_range: - mov cl, ATTR_GALAXY_EDGE - call TConsole_SetAttr - mcLoad8bitsToReg32 ecx, 134 - call TConsole_Cram - -.done: - pop edx eax - ret - -; -------------------------------------------------------------------------- -; LRSCAN -; -------------------------------------------------------------------------- -align PROC_ALIGN -TLrScan_Main: - mov cl, DEV_LR_SENSORS - call TArray_IsDamaged - jnc .proceed - - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .not_available - -.proceed: - call TConsole_ScrollUp - mov cl, ATTR_REPORT_TEXT - call TConsole_SetAttr - mcLoad8bitsToReg32 ecx, 135 - call TConsole_Cram - mov cl, 1 - mcLoadGameDataPtr ebx - mov al, [ebx + TREKDATA.QUADX] - mov dl, [ebx + TREKDATA.QUADY] - call TConsole_CramLoc - call TConsole_ScrollUp - call TConsole_ScrollUp - ; - ; EAX = QUADX-1 - ; EDX = QUADY-1 - ; - mcLoadGameDataPtr ebx - movzx eax, [ebx + TREKDATA.QUADX] - movzx edx, [ebx + TREKDATA.QUADY] - dec eax - dec edx - - call TLrScan_DumpContents - inc edx - call TLrScan_DumpContents - inc edx - call TLrScan_DumpContents - - push edx eax - call TConsole_ScrollUp - pop eax edx - - inc eax - sub edx, 2 - call TLrScan_DumpContents - inc edx - call TLrScan_DumpContents - inc edx - call TLrScan_DumpContents - - push edx eax - call TConsole_ScrollUp - pop eax edx - - inc eax - sub edx, 2 - call TLrScan_DumpContents - inc edx - call TLrScan_DumpContents - inc edx - call TLrScan_DumpContents - call TConsole_ScrollUp - jmp .done - -.not_available: - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 133 - call TConsole_Prout - -.done: - call TConsole_ScrollUp - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TMove.Asm b/programs/games/StarTrek/trunk/TMove.Asm deleted file mode 100644 index 4833b4849d..0000000000 --- a/programs/games/StarTrek/trunk/TMove.Asm +++ /dev/null @@ -1,1786 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TMove.Asm -; DATE: October 12, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; TIMEWRP -; -------------------------------------------------------------------------- -virtual at 0 -loc56: - .pTrekData PVOID ? - .dbl_XDATE DOUBLE ? - ._pad_1 BYTE ? - ._pad_2 BYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_TimeWarp: - mcBeginLocals loc56.size - - mov ecx, 627 - call TConsole_ProutGameMsg - - mcLoadGameDataPtr esi - mcStoreLocal loc56.pTrekData, esi - - mov ebx, [glb_pCommon] - cmp [ebx + TCommon.SNAP], 0 - je .travel_forward - - fld [glb_dbl_0dot5] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .L10 - -.travel_forward: - mcLoadLocal esi, loc56.pTrekData - fld [esi + TREKDATA.INTIME] - fld [glb_dbl_0dot5] - fmulp - call TCommon_ExpRan - fstp [esi + TREKDATA.TIME] - - mov ecx, 628 - call TConsole_Cram - - mov cl, 2 - mcLoadLocal esi, loc56.pTrekData - fld [esi + TREKDATA.TIME] - call TConsole_CramFloat - - mov ecx, 630 - call TConsole_Prout - - mcLoadLocal esi, loc56.pTrekData - fld [esi + TREKDATA.FUTURE2] - fld [glb_dbl_1E38] - mc_CMP_ST0_ST1 - jz .L40 - - fld [esi + TREKDATA.FUTURE2] - fld [esi + TREKDATA.TIME] - faddp - fstp [esi + TREKDATA.FUTURE2] - jmp .L40 - -.L10: - mcLoadLocal esi, loc56.pTrekData - fld [esi + TREKDATA.DATE] - fstp [esp + loc56.dbl_XDATE] - - mov ebx, [glb_pCommon] - mov [ebx + TCommon.SNAP], 0 - mcLoadMemberRef esi, TCommon.SNAPSHT - mcLoadMemberRef edi, TCommon.GAMEDB - mov ecx, TREKDATA.size - rep movsb - - mov ecx, 629 - call TConsole_Cram - - mov cl, 2 - mcLoadLocal esi, loc56.pTrekData - fld [esp + loc56.dbl_XDATE] - fld [esi + TREKDATA.DATE] - fsubp - call TConsole_CramFloat - - mov ecx, 630 - call TConsole_Prout - - mcLoadLocal esi, loc56.pTrekData - cmp [esi + TREKDATA.REMCOM], 0 - je .L25 - - mcLoadLocal ebx, loc56.pTrekData - fld [ebx + TREKDATA.INTIME] - movzx eax, [ebx + TREKDATA.REMCOM] - call TCommon_FPU_Load_EAX - fdivp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE2] - - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot3] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE4] - -.L25: - mcLoadLocal ebx, loc56.pTrekData - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot5] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE1] - - fld [ebx + TREKDATA.INTIME] - fld [glb_dbl_0dot5] - fmulp - call TCommon_ExpRan - fld [ebx + TREKDATA.DATE] - faddp - fstp [ebx + TREKDATA.FUTURE3] - - cmp [ebx + TREKDATA.NSCREM], 0 - je .set_scom_features - - fld [glb_dbl_0dot2777] - fstp [ebx + TREKDATA.FUTURE6] - -.set_scom_features: - mcZeroBits eax - mcStoreMember TREKDATA.BATX, al - mcStoreMember TREKDATA.BATY, al - mcStoreMember TREKDATA.ISATB, al - - fld [glb_dbl_1E38] - fld st - fstp [ebx + TREKDATA.FUTURE5] - fstp [ebx + TREKDATA.FUTURE7] - ; - ; Revert star chart to earlier era - ; - mcLoadMemberRef esi, TREKDATA.STARCH - mcLoad8bitsToReg32 ecx, 64 - -.revert: - cmp dword [esi], 1 - jle .next_revert - - mov dword [esi], 1 - -.next_revert: - add esi, 4 - loop .revert - - mov ecx, 631 - call TConsole_ProutGameMsg - -.L40: - call TCommon_NewQuad - -.done: - mcEndLocals loc56.size - ret - -; -------------------------------------------------------------------------- -; RAM -; -------------------------------------------------------------------------- -; Input: -; AL = IX sector of a collision -; DL = IY sector of a collision -; CL = IENM (object type symbol) -; BL = IBUMPD (who rammed what) -; -------------------------------------------------------------------------- -virtual at 0 -loc43: - .pTrekData PVOID ? - .dbl_TYPE DOUBLE ? - .dbl_EXTRADM DOUBLE ? - .chIENM CHAR ? - .sect_IX BYTE ? - .sect_IY BYTE ? - .bIBUMPED BYTE ? - .nICAS COUNT ? - .nL INDEX ? - .pDAMAGE PDOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_Ram: - mcBeginLocals loc43.size - - mcStoreLocal loc43.bIBUMPED, bl - mcStoreLocal loc43.sect_IX, al - mcStoreLocal loc43.sect_IY, dl - mcStoreLocal loc43.chIENM, cl - - mcLoadGameDataPtr ebx - mcStoreLocal loc43.pTrekData, ebx - - mcLoadMemberRef esi, TREKDATA.DAMAGE - mcStoreLocal loc43.pDAMAGE, esi - - call TMove_RedAlert - call TConsole_SetGameMsgAttr - - mov ecx, 334 - call TConsole_Prout - - call TConsole_ScrollUp - call TConsole_ScrollUp - call TConsole_Cram3Asterisks - call TConsole_CramShip - - movzx eax, [esp + loc43.bIBUMPED] - lea ecx, [eax + 335] - call TConsole_Cram - - mcLoadLocal al, loc43.chIENM - mcOnRegEqu al, CHAR_KLINGON, .klingon - mcOnRegEqu al, CHAR_THOLIAN, .tholian - mcOnRegEqu al, CHAR_ROMULAN, .romulan - mcOnRegEqu al, CHAR_COMMANDER, .commander - mcOnRegEqu al, CHAR_SCOM, .scommander - - ;int 3 - jmp .done - -.klingon: - push 2 - jmp .calc_type - -.tholian: - push 1 - jmp .calc_type - -.romulan: - push 3 - jmp .calc_type - -.commander: - push 4 - jmp .calc_type - -.scommander: - push 5 - -.calc_type: - pop ecx - fldz - -.L11: - fld [glb_dbl_0dot5] - faddp - loop .L11 - fstp [esp + loc43.dbl_TYPE] - - mov cl, 2 - mcLoadLocal bl, loc43.chIENM - mcLoadLocal al, loc43.sect_IX - mcLoadLocal dl, loc43.sect_IY - call TConsole_CramEnemyAt - call TConsole_ScrollUp - - mcLoadLocal al, loc43.sect_IX - mcLoadLocal dl, loc43.sect_IY - call TPhasers_DeadKlingon - - call TConsole_Cram3Asterisks - call TConsole_CramShip - mov ecx, 337 - call TConsole_Prout - - mov ecx, 338 - call TConsole_Cram - - call TRandom_Ranf - fld [glb_dbl_20] - fmulp - call TCommon_FP_Truncate - add eax, 10 - mcStoreLocal loc43.nICAS, eax - call TConsole_CramInt - - mov ecx, 339 - call TConsole_Prout - - mcLoadLocal esi, loc43.pTrekData - mcLoadLocal eax, loc43.nICAS - add [esi + TREKDATA.CASUAL], al - - mcLoad1 ecx - mcStoreLocal loc43.nL, ecx - -.damage_device: - mcLoadLocal esi, loc43.pDAMAGE - fldz - fld tbyte [esi] - mc_CMP_ST0_ST1 - jc .L10 - - call TRandom_Ranf - fld [esp + loc43.dbl_TYPE] - fmulp - fld [glb_dbl_Ten] - fmulp - fld1 - faddp - mcLoadLocal esi, loc43.pTrekData - fld [esi + TREKDATA.DAMFAC] - fmulp - fld [esi + TREKDATA.TIME] - faddp - - mcLoadLocal esi, loc43.pDAMAGE - fld tbyte [esi] - faddp - fstp tbyte [esi] - -.L10: - add [esp + loc43.pDAMAGE], 10 - inc [esp + loc43.nL] - cmp [esp + loc43.nL], 13 - jbe .damage_device - - mcLoadLocal edi, loc43.pTrekData - mov [edi + TREKDATA.ISUBDAM], 1 - mov [edi + TREKDATA.SHLDUP], 0 - - cmp [edi + TREKDATA.REMKL], 0 - je .finished - - call TDock_DamageReport - jmp .done - -.finished: - mov al, 1 - call TFinish_Main - -.done: - mcEndLocals loc43.size - ret - -; -------------------------------------------------------------------------- -; BEGPARD -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_BegPardon: - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 173 - call TConsole_Prout - ret - -; -------------------------------------------------------------------------- -; GETCD -; -------------------------------------------------------------------------- -virtual at 0 -loc28: - .pTrekData PVOID ? - .nIROWQ INT32 ? - .nIROWS INT32 ? - .nICOLQ INT32 ? - .nICOLS INT32 ? - .nITEMP INT32 ? - .nIPROMPT INT32 ? - .nXJ INT32 ? - .nXK INT32 ? - .nXL INT32 ? - .nXI INT32 ? - .dbl_DELTX DOUBLE ? - .dbl_DELTY DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_GetCourseDistance: - mcBeginLocals loc28.size - - mcLoadGameDataPtr esi - mcStoreLocal loc28.pTrekData, esi - - cmp [esi + TREKDATA.LANDED], 1 - jne .L1 - - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 163 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 164 - call TConsole_Cram - call TConsole_CramShip - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - jmp .L71 - -.L1: - movzx eax, [esi + TREKDATA.QUADX] - movzx edx, [esi + TREKDATA.QUADY] - mcStoreLocal loc28.nIROWQ, eax - mcStoreLocal loc28.nICOLQ, edx - - fldz - fldz - fstp [esp + loc28.dbl_DELTX] - fstp [esp + loc28.dbl_DELTY] - - mcZeroBits ecx - mcStoreLocal loc28.nITEMP, ecx - mcStoreLocal loc28.nIPROMPT, ecx - -.L10: - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - je .L24 - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_ALPHA - je .L13 - - mov cl, DEV_COMPUTER - call TArray_IsDamaged - jc .L1301 - -.L11: - mcLoad8bitsToReg32 ecx, 174 - call TGame_Prompt - inc [esp + loc28.nIPROMPT] - jmp .L10 - -.L13: - mcLoad8bitsToReg32 ecx, 165 - call TCmdBuf_Crop - jc .L20 - - mcLoad8bitsToReg32 ecx, 166 - call TCmdBuf_Crop - jnc .L11 - ; - ; Automatic movement requested. - ; Check for computer damage. - ; - mov cl, DEV_COMPUTER - call TArray_IsDamaged - jnc .L14 - -.L1301: - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 167 - call TConsole_Prout - jmp .L2001 - -.L14: - ; - ; Get quadrant and sector - ; - call TCmdBuf_Scan - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc28.nXI, eax - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - jne .L15 - -.L1410: - mcLoad8bitsToReg32 ecx, 168 - call TGame_Prompt - inc [esp + loc28.nIPROMPT] - jmp .L14 - -.L15: - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L1410 - - cmp [ebx + TCmdBuf.cmdbuf_INUM], -1 - je .L71 - - call TCmdBuf_Scan - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc28.nXJ, eax - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L1410 - - call TCmdBuf_Scan - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc28.nXK, eax - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L16 - - call TCmdBuf_Scan - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc28.nXL, eax - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L1410 - ; - ; Quadrant and sector specified - ; - mcLoadLocal eax, loc28.nXI - mcLoadLocal edx, loc28.nXJ - mcStoreLocal loc28.nIROWQ, eax - mcStoreLocal loc28.nICOLQ, edx - - mcLoadLocal eax, loc28.nXK - mcLoadLocal edx, loc28.nXL - mcStoreLocal loc28.nIROWS, eax - mcStoreLocal loc28.nICOLS, edx - jmp .L30 - -.L16: - ; - ; Only sector specified - ; - mcLoadLocal eax, loc28.nXI - mcLoadLocal edx, loc28.nXJ - mcStoreLocal loc28.nIROWS, eax - mcStoreLocal loc28.nICOLS, edx - inc [esp + loc28.nITEMP] - jmp .L30 - -.L20: - ; - ; Manual (DELTX,DELTY) movement - ; - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - je .L24 - -.L2001: - mcLoad8bitsToReg32 ecx, 169 - call TGame_Prompt - inc [esp + loc28.nIPROMPT] - jmp .L20 - -.L24: - fld [ebx + TCmdBuf.cmdbuf_FNUM] - fstp [esp + loc28.dbl_DELTX] - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - jne .L29 - ; - ; if (deltx == -1.0) && (key == EOL) goto 71 - ; - fld [esp + loc28.dbl_DELTX] - fld1 - fchs - mc_CMP_ST0_ST1 - jz .L71 - -.L29: - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L70 - - fld [ebx + TCmdBuf.cmdbuf_FNUM] - fstp [esp + loc28.dbl_DELTY] - jmp .L40 - -.L30: - ; - ; Check for invalid input for automatic case - ; - mcLoadLocal eax, loc28.nICOLQ - mcLoadLocal edx, loc28.nIROWQ - cmp eax, 1 - jl .L70 - cmp edx, 1 - jl .L70 - cmp eax, 8 - jg .L70 - cmp edx, 8 - jg .L70 - - mcLoadLocal eax, loc28.nICOLS - mcLoadLocal edx, loc28.nIROWS - cmp eax, 1 - jl .L70 - cmp edx, 1 - jl .L70 - cmp eax, 10 - jg .L70 - cmp edx, 10 - jg .L70 - ; - ; Print message from appropriate officer - ; - cmp [esp + loc28.nITEMP], 0 - jne .L31 - - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 170 - call TConsole_Prout - jmp .L32 - -.L31: - cmp [esp + loc28.nIPROMPT], 0 - je .L32 - - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 171 - call TConsole_Cram - - mov cl, 2 - mcLoadLocal eax, loc28.nIROWS - mcLoadLocal edx, loc28.nICOLS - call TConsole_CramLoc - - mcLoad8bitsToReg32 ecx, 154 - call TConsole_Prout - -.L32: - ; - ; Convert to DELTX,DELTY form - ; - mcLoadLocal esi, loc28.pTrekData - - mcLoadLocal eax, loc28.nICOLS - movzx edx, [esi + TREKDATA.SECTY] - sub eax, edx - call TCommon_FPU_Load_EAX - fld [glb_dbl_0dot1] - fmulp - mcLoadLocal eax, loc28.nICOLQ - movzx edx, [esi + TREKDATA.QUADY] - sub eax, edx - call TCommon_FPU_Load_EAX - faddp - fstp [esp + loc28.dbl_DELTX] - - mcLoadLocal edx, loc28.nIROWS - movzx eax, [esi + TREKDATA.SECTX] - sub eax, edx - call TCommon_FPU_Load_EAX - fld [glb_dbl_0dot1] - fmulp - mcLoadLocal edx, loc28.nIROWQ - movzx eax, [esi + TREKDATA.QUADX] - sub eax, edx - call TCommon_FPU_Load_EAX - faddp - fstp [esp + loc28.dbl_DELTY] - -.L40: - ; - ; Check for a zero movement - ; - fld [esp + loc28.dbl_DELTX] - fldz - mc_CMP_ST0_ST1 - jnz .L42 - - fld [esp + loc28.dbl_DELTY] - fldz - mc_CMP_ST0_ST1 - jz .L71 - -.L42: - cmp [esp + loc28.nIPROMPT], 0 - je .L43 - - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 172 - call TConsole_Prout - -.L43: - ; - ; Convert into course and distance - ; - fld [esp + loc28.dbl_DELTX] - fld st - fmulp - - fld [esp + loc28.dbl_DELTY] - fld st - fmulp - - faddp - fsqrt - mcLoadLocal edi, loc28.pTrekData - fstp [edi + TREKDATA.DIST] - - fld [esp + loc28.dbl_DELTX] - fld [esp + loc28.dbl_DELTY] - fpatan - fld [glb_dbl_1dot90985932] - fmulp - fstp [edi + TREKDATA.DIREC] - - fldz - fld [edi + TREKDATA.DIREC] - mc_CMP_ST0_ST1 - jnc .done - - fld [edi + TREKDATA.DIREC] - fld [glb_dbl_12] - faddp - fstp [edi + TREKDATA.DIREC] - jmp .done - -.L70: - call TConsole_ScrollUp - call TMove_BegPardon - -.L71: - fld1 - fchs - mcLoadLocal edi, loc28.pTrekData - fstp [edi + TREKDATA.DIREC] - -.done: - mcEndLocals loc28.size - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = X sector -; EDX = Y sector -; Output: -; ST(0) = distance -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_DistanceAfterMove: - mcLoadGameDataPtr ebx - - movzx ecx, [ebx + TREKDATA.SECTX] - sub eax, ecx - - movzx ecx, [ebx + TREKDATA.SECTY] - sub edx, ecx - - imul edx, edx - imul eax, eax - - add eax, edx - call TCommon_FPU_Load_EAX - fsqrt - fld [glb_dbl_0dot1] - fmulp - ret - -; -------------------------------------------------------------------------- -; REDALRT -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_RedAlert: - mov cl, ATTR_COND_RED - call TConsole_SetAttr - mcLoad8bitsToReg32 ecx, 180 - call TConsole_Prout - ret - -; -------------------------------------------------------------------------- -; MOVE -; -------------------------------------------------------------------------- -virtual at 0 -loc29: - .pTrekData PVOID ? - .bTRBEAM BOOL ? - .bXTIMEW BOOL ? - .dbl_DeltaX DOUBLE ? - .dbl_DeltaY DOUBLE ? - .dbl_Angle DOUBLE ? - .dbl_Bigger DOUBLE ? - .dbl_X DOUBLE ? - .dbl_Y DOUBLE ? - .dbl_Stopegy DOUBLE ? - .dbl_align DOUBLE ? - .nIX INT32 ? - .nIY INT32 ? - .nSteps INT32 ? - .iStep INT32 ? - .nIQUAD BYTE ? - .nKINKS BYTE ? - .nKINK BYTE ? - .nReserved3 BYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_Move: - mcBeginLocals loc29.size - - mcLoadGameDataPtr esi - mcStoreLocal loc29.pTrekData, esi - - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .check_if_leaving_orbit - - mov [esi + TREKDATA.CONDIT], CONDITION_GREEN - call TCommon_NewCondition - -.check_if_leaving_orbit: - cmp [esi + TREKDATA.INORBIT], 0 - je .L1 - - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 175 - call TConsole_Prout - - mcLoadLocal esi, loc29.pTrekData - mov [esi + TREKDATA.INORBIT], 0 - -.L1: - fld [glb_dbl_15] - fld [esi + TREKDATA.DIREC] - fsubp - fld [glb_dbl_0dot5235998] - fmulp - fstp [esp + loc29.dbl_Angle] - ; - ; DELTAX = -SIN (ANGLE) - ; - fld [esp + loc29.dbl_Angle] - fsin - fchs - fstp [esp + loc29.dbl_DeltaX] - ; - ; DELTAY = COS (ANGLE) - ; - fld [esp + loc29.dbl_Angle] - fcos - fstp [esp + loc29.dbl_DeltaY] - - fld [esp + loc29.dbl_DeltaX] - fld [esp + loc29.dbl_DeltaY] - call TMove_Bigger - fstp [esp + loc29.dbl_Bigger] - - fld [esp + loc29.dbl_DeltaX] - fld [esp + loc29.dbl_Bigger] - fdivp - fstp [esp + loc29.dbl_DeltaX] - - fld [esp + loc29.dbl_DeltaY] - fld [esp + loc29.dbl_Bigger] - fdivp - fstp [esp + loc29.dbl_DeltaY] - - mov [esp + loc29.bTRBEAM], 0 - ; - ; If tractor beam is to occur, do not - ; move full distance - ; - fld [esi + TREKDATA.FUTURE2] - fld [esi + TREKDATA.DATE] - fld [esi + TREKDATA.TIME] - faddp - mc_CMP_ST0_ST1 - jc .L5 - ; - ; Ship will be tractored! - ; - inc [esp + loc29.bTRBEAM] - mov [esi + TREKDATA.CONDIT], CONDITION_RED - - fld [esi + TREKDATA.FUTURE2] - fld [esi + TREKDATA.DATE] - fsubp - fld [esi + TREKDATA.DIST] - fmulp - fld [esi + TREKDATA.TIME] - fdivp - fld [glb_dbl_0dot1] - faddp - fstp [esi + TREKDATA.DIST] - - fld [esi + TREKDATA.FUTURE2] - fld [esi + TREKDATA.DATE] - fsubp - fld [glb_dbl_0dot00001] - faddp - fstp [esi + TREKDATA.TIME] - -.L5: - mov al, [esi + TREKDATA.SECTX] - mov dl, [esi + TREKDATA.SECTY] - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - - mov al, [esi + TREKDATA.SECTX] - call TCommon_LoadByteIntoFPU - fstp [esp + loc29.dbl_X] - - mov al, [esi + TREKDATA.SECTY] - call TCommon_LoadByteIntoFPU - fstp [esp + loc29.dbl_Y] - ; - ; How many steps to move - ; - fld [esi + TREKDATA.DIST] - fld [esp + loc29.dbl_Bigger] - fmulp - fld [glb_dbl_Ten] - fmulp - frndint - call TCommon_FP_Truncate - mcStoreLocal loc29.nSteps, eax - mcOnRegZero eax, .L100 - - mcLoad1 ecx - mcStoreLocal loc29.iStep, ecx - -.move_one_step: - fld [esp + loc29.dbl_X] - fld [esp + loc29.dbl_DeltaX] - faddp - fld st - fstp [esp + loc29.dbl_X] - frndint - call TCommon_FP_Truncate - mcStoreLocal loc29.nIX, eax - - fld [esp + loc29.dbl_Y] - fld [esp + loc29.dbl_DeltaY] - faddp - fld st - fstp [esp + loc29.dbl_Y] - frndint - call TCommon_FP_Truncate - mcStoreLocal loc29.nIY, eax - - mcLoadLocal eax, loc29.nIX - mcLoadLocal edx, loc29.nIY - - cmp eax, 1 - jl .L40 - cmp edx, 1 - jl .L40 - cmp eax, 10 - jg .L40 - cmp edx, 10 - jg .L40 - - call TArray_QuadPtr - mov al, [ebx] - mcStoreLocal loc29.nIQUAD, al - - cmp al, CHAR_COSMOS - jne .L20 - - inc [esp + loc29.iStep] - mov ecx, [esp + loc29.iStep] - cmp ecx, [esp + loc29.nSteps] - jbe .move_one_step - ; - ; Arrived into sector in the same quadrant - ; - mcLoadLocal eax, loc29.nIX - mcLoadLocal edx, loc29.nIY - call TMove_DistanceAfterMove - mcLoadLocal edi, loc29.pTrekData - fstp [edi + TREKDATA.DIST] - - mcLoadLocal eax, loc29.nIX - mcLoadLocal edx, loc29.nIY - mov [edi + TREKDATA.SECTX], al - mov [edi + TREKDATA.SECTY], dl - jmp .L100 - -.L20: - ; - ; Object encountered along flight path - ; - mcLoadLocal esi, loc29.pTrekData - fld [esi + TREKDATA.DIST] - fld [glb_dbl_50] - fmulp - fld [esi + TREKDATA.TIME] - fdivp - fstp [esp + loc29.dbl_Stopegy] - - mcLoadLocal eax, loc29.nIX - mcLoadLocal edx, loc29.nIY - call TMove_DistanceAfterMove - fstp [esi + TREKDATA.DIST] - - mcLoadLocal al, loc29.nIQUAD - mcOnRegEqu al, CHAR_KLINGON, .L30 - mcOnRegEqu al, CHAR_COMMANDER, .L30 - mcOnRegEqu al, CHAR_SCOM, .L30 - mcOnRegEqu al, CHAR_ROMULAN, .L30 - mcOnRegEqu al, CHAR_THOLIAN, .L30 - mcOnRegEqu al, CHAR_BLACK_HOLE, .L25 - ; - ; Ship is blocked by some object - ; - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - call TConsole_CramShip - - mcLoad8bitsToReg32 edx, 177 - mcLoad8bitsToReg32 ecx, 176 - cmp [esp + loc29.nIQUAD], CHAR_WEB - cmove ecx, edx - call TConsole_Cram - - mcLoadLocal eax, loc29.nIX - mcLoadLocal edx, loc29.nIY - mov cl, 2 - call TConsole_CramLoc - - mov al, ';' - call TConsole_PutChar - call TConsole_ScrollUp - - mcLoad8bitsToReg32 ecx, 178 - call TConsole_Cram - - mov cl, 2 - fld [esp + loc29.dbl_Stopegy] - call TConsole_CramFloat - - mcLoad8bitsToReg32 ecx, 179 - call TConsole_Prout - ; - ; Deplete energy due to emergency stop - ; - mcLoadLocal esi, loc29.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [esp + loc29.dbl_Stopegy] - fsubp - fstp [esi + TREKDATA.ENERGY] - - fld [esp + loc29.dbl_X] - fld [esp + loc29.dbl_DeltaX] - fsubp - call TCommon_FP_Truncate - mov [esi + TREKDATA.SECTX], al - - fld [esp + loc29.dbl_Y] - fld [esp + loc29.dbl_DeltaY] - fsubp - call TCommon_FP_Truncate - mov [esi + TREKDATA.SECTY], al - ; - ; Check if emergency stop depleted all remaining energy - ; - fld [esi + TREKDATA.ENERGY] - fldz - mc_CMP_ST0_ST1 - jc .L100 - - mov al, 4 - call TFinish_Main - jmp .done - -.L25: - ; - ; Object is a black hole! Swallow ship. - ; - call TMove_RedAlert - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - call TConsole_Cram3Asterisks - call TConsole_CramShip - mcLoad8bitsToReg32 ecx, 182 - call TConsole_Cram - - mcLoadLocal eax, loc29.nIX - mcLoadLocal edx, loc29.nIY - mov cl, 2 - call TConsole_CramLoc - call TConsole_ScrollUp - - call TRandom_Ranf - fld [glb_dbl_0dot5] - mc_CMP_ST0_ST1 - jc .L27 - ; - ; Ship warped into another quadrant - ; by a black hole. - ; - call TRandom_IRan8 - mcLoadLocal ebx, loc29.pTrekData - mcStoreMember TREKDATA.QUADX, al - mcStoreMember TREKDATA.QUADY, dl - - call TRandom_IRan10 - mcLoadLocal ebx, loc29.pTrekData - mcStoreMember TREKDATA.SECTX, al - mcStoreMember TREKDATA.SECTY, dl - - call TRandom_Ranf - fld [glb_dbl_0dot65] - mcZeroBits ecx - mc_CMP_ST0_ST1 - setc cl - mcStoreLocal loc29.bXTIMEW, ecx - - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 183 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 184 - call TConsole_Cram - - cmp [esp + loc29.bXTIMEW], 0 - je .engage_time_warp - - mcLoad8bitsToReg32 ecx, 185 - call TConsole_Cram - -.engage_time_warp: - mcLoad8bitsToReg32 ecx, 186 - call TConsole_Prout - - cmp [esp + loc29.bXTIMEW], 0 - je .L95 - - call TMove_TimeWarp - - mcLoadLocal edi, loc29.pTrekData - mov [edi + TREKDATA.KSTUF4], 1 - jmp .L95 - -.L27: - mov al, 21 - call TFinish_Main - jmp .done - -.L30: - ; - ; Object is an enemy vessel. Ram him! - ; - mcLoadLocal eax, loc29.nIX - mcLoadLocal edx, loc29.nIY - mcLoadLocal ebx, loc29.pTrekData - mcStoreMember TREKDATA.SECTX, al - mcStoreMember TREKDATA.SECTY, dl - - mcLoadLocal cl, loc29.nIQUAD - mcZeroBits ebx - call TMove_Ram - jmp .L100 - -.L40: - ; - ; Compute final position -- new quadrant and sector - ; - mcLoadLocal esi, loc29.pTrekData - movzx eax, [esi + TREKDATA.QUADX] - movzx ecx, [esi + TREKDATA.SECTX] - dec eax - imul eax, 10 - add eax, ecx - mcStoreLocal loc29.nIX, eax - - movzx eax, [esi + TREKDATA.QUADY] - movzx ecx, [esi + TREKDATA.SECTY] - dec eax - imul eax, 10 - add eax, ecx - mcStoreLocal loc29.nIY, eax - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_Ten] - fmulp - fld [esp + loc29.dbl_Bigger] - fmulp - fld [esp + loc29.dbl_DeltaX] - fmulp - frndint - call TCommon_FP_Truncate - add [esp + loc29.nIX], eax - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_Ten] - fmulp - fld [esp + loc29.dbl_Bigger] - fmulp - fld [esp + loc29.dbl_DeltaY] - fmulp - frndint - call TCommon_FP_Truncate - add [esp + loc29.nIY], eax - ; - ; Check for edge of the galaxy - ; - mcZeroBits ecx - mcStoreLocal loc29.nKINKS, cl - -.L45: - mcZeroBits ecx - mcStoreLocal loc29.nKINK, cl - - cmp [esp + loc29.nIX], 0 - jg .L50 - - neg [esp + loc29.nIX] - inc [esp + loc29.nIX] - inc [esp + loc29.nKINK] - -.L50: - cmp [esp + loc29.nIY], 0 - jg .L55 - - neg [esp + loc29.nIY] - inc [esp + loc29.nIY] - inc [esp + loc29.nKINK] - -.L55: - cmp [esp + loc29.nIX], 80 - jle .L60 - - mcLoad8bitsToReg32 eax, 161 - sub eax, [esp + loc29.nIX] - mcStoreLocal loc29.nIX, eax - inc [esp + loc29.nKINK] - -.L60: - cmp [esp + loc29.nIY], 80 - jle .L65 - - mcLoad8bitsToReg32 eax, 161 - sub eax, [esp + loc29.nIY] - mcStoreLocal loc29.nIY, eax - inc [esp + loc29.nKINK] - -.L65: - cmp [esp + loc29.nKINK], 0 - je .L70 - - inc [esp + loc29.nKINKS] - jmp .L45 - -.L70: - cmp [esp + loc29.nKINKS], 0 - je .L90 - - mcLoadLocal esi, loc29.pTrekData - inc [esi + TREKDATA.NKINKS] - cmp [esi + TREKDATA.NKINKS], 3 - je .L80 - - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 187 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 188 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 189 - call TConsole_Prout - jmp .L90 - -.L80: - mov al, 6 - call TFinish_Main - jmp .done - -.L90: - ; - ; Compute final position of starship - ; in new quadrant. - ; - mcLoadLocal eax, loc29.nIX - add eax, 9 - mcLoad8bitsToReg32 ecx, 10 - mcZeroBits edx - div ecx - mcLoadLocal ebx, loc29.pTrekData - mcStoreMember TREKDATA.QUADX, al - - mcLoadLocal eax, loc29.nIY - add eax, 9 - mcZeroBits edx - div ecx - mcStoreMember TREKDATA.QUADY, al - - movzx ecx, [ebx + TREKDATA.QUADX] - dec ecx - imul ecx, 10 - mcLoadLocal eax, loc29.nIX - sub eax, ecx - mcStoreMember TREKDATA.SECTX, al - - movzx ecx, [ebx + TREKDATA.QUADY] - dec ecx - imul ecx, 10 - mcLoadLocal eax, loc29.nIY - sub eax, ecx - mcStoreMember TREKDATA.SECTY, al - - cmp [esp + loc29.bTRBEAM], 0 - jne .done - -.L95: - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 190 - call TConsole_Cram - - mcLoadLocal ebx, loc29.pTrekData - mcLoadMember al, TREKDATA.QUADX - mcLoadMember dl, TREKDATA.QUADY - mov cl, 1 - call TConsole_CramLoc - call TConsole_ScrollUp - - call TArray_SetShip - call TCommon_NewQuad - jmp .done - -.L100: - call TArray_SetShip - call TCommon_ResetDist - call TCommon_SortKlingons - -.done: - mcEndLocals loc29.size - ret - -; -------------------------------------------------------------------------- -; ST0 = MAX (ABS (ST0), ABS (ST1)) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_Bigger: - fabs - fxch - fabs - call TCommon_FPU_Max - ret - -; -------------------------------------------------------------------------- -; WARP -; -------------------------------------------------------------------------- -virtual at 0 -loc26: - .pTrekData PVOID ? - .dblPower DOUBLE ? - .dblAngle DOUBLE ? - .dblDeltaX DOUBLE ? - .dblDeltaY DOUBLE ? - .dblBigger DOUBLE ? - .dbl_align DOUBLE ? - .dblSectX DOUBLE ? - .dblSectY DOUBLE ? - .nIWarp INT32 ? - .nSteps INT32 ? - .iStep INT32 ? - .iSectX INT32 ? - .iSectY INT32 ? - .Blooey BOOL ? - .TWarp BOOL ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMove_Warp: - mcBeginLocals loc26.size - - mcLoadGameDataPtr edi - mcStoreLocal loc26.pTrekData, edi - mov [edi + TREKDATA.IDIDIT], 0 - - mov cl, DEV_WARP_ENGINES - call TArray_GetDblDamage - fld [glb_dbl_Ten] - mc_CMP_ST0_ST1 - jc TMove_WarpX.L90 - - mov cl, DEV_WARP_ENGINES - call TArray_IsDamaged - jnc .L3 - - fld [glb_dbl_4] - mcLoadLocal esi, loc26.pTrekData - fld [esi + TREKDATA.WARPFAC] - mc_CMP_ST0_ST1 - jc .L3 - jz .L3 - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 146 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 147 - call TConsole_Prout - call TConsole_ScrollUp - jmp TMove_WarpX.done - -.L3: - call TMove_GetCourseDistance - - fldz - mcLoadLocal esi, loc26.pTrekData - fld [esi + TREKDATA.DIREC] - mc_CMP_ST0_ST1 - jc TMove_WarpX.done - ; - ; Check energy required to use warp engines - ; - fld [esi + TREKDATA.WARPFAC] - fld st - fld st - fmulp - fmulp - fld [esi + TREKDATA.DIST] - fld [glb_dbl_0dot05] - faddp - fmulp - movzx eax, [esi + TREKDATA.SHLDUP] - inc eax - call TCommon_FPU_Load_EAX - fmulp - fstp [esp + loc26.dblPower] - - fld [esi + TREKDATA.ENERGY] - fld [esp + loc26.dblPower] - mc_CMP_ST0_ST1 - jc .L10 - ; - ; Not enough energy - ; - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 148 - call TConsole_Prout - - mcLoadLocal esi, loc26.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - je .L5 - - fld [esp + loc26.dblPower] - fld [glb_dbl_0dot5] - fmulp - fld [esi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jc .L5 - - mcLoad8bitsToReg32 ecx, 149 - call TConsole_Prout - jmp TMove_WarpX.done - -.L5: - fld [esi + TREKDATA.ENERGY] - fld [esi + TREKDATA.DIST] - fld [glb_dbl_0dot05] - faddp - fdivp - mcFpuPop - mov esi, glb_dbl_FpuPopper - mov edi, glb_dbl_0dot333 - call TCommon_X_exp_Y - call TCommon_FP_Truncate - mcStoreLocal loc26.nIWarp, eax - mcOnRegZero eax, .L8 - - mcLoad8bitsToReg32 ecx, 152 - call TConsole_Cram - mcLoadLocal eax, loc26.nIWarp - call TConsole_CramInt - - mcLoadLocal esi, loc26.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - jne .L6 - - mcLoad8bitsToReg32 ecx, 154 - call TConsole_Prout - jmp TMove_WarpX.done - -.L6: - mov al, CHAR_COMMA - call TConsole_PutChar - call TConsole_ScrollUp - - mcLoad8bitsToReg32 ecx, 153 - call TConsole_Prout - jmp TMove_WarpX.done - -.L8: - mcLoad8bitsToReg32 ecx, 151 - call TConsole_Prout - jmp TMove_WarpX.done - -.L10: - ; - ; Check the trip duration - ; - fld [esi + TREKDATA.DIST] - fld [glb_dbl_Ten] - fmulp - fld [esi + TREKDATA.WFACSQ] - fdivp - fstp [esi + TREKDATA.TIME] - - fld [esi + TREKDATA.REMTIME] - fld [glb_dbl_0dot8] - fmulp - fld [esi + TREKDATA.TIME] - mc_CMP_ST0_ST1 - jc TMove_WarpX.L20 - - call TConsole_SetCrewMsgAttr - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 155 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 156 - call TConsole_Cram - - mcLoadLocal esi, loc26.pTrekData - fld [esi + TREKDATA.TIME] - fld [esi + TREKDATA.REMTIME] - fdivp - fld [glb_dbl_100] - fmulp - - mov cl, 2 - call TConsole_CramFloat - mcLoad8bitsToReg32 ecx, 157 - call TConsole_Prout - call TConsole_ScrollUp - - mcLoad8bitsToReg32 ecx, 158 - call TGame_JA - jc TMove_WarpX.L20 - jmp TMove_WarpX.done - -; -------------------------------------------------------------------------- -; WARPX -; -------------------------------------------------------------------------- -TMove_WarpX: - mcBeginLocals loc26.size - - mcLoadGameDataPtr esi - mcStoreLocal loc26.pTrekData, esi - -.L20: - mcZeroBits eax - mcStoreLocal loc26.Blooey, eax - mcStoreLocal loc26.TWarp, eax - - mcLoadLocal esi, loc26.pTrekData - fld [glb_dbl_6] - fld [esi + TREKDATA.WARPFAC] - mc_CMP_ST0_ST1 - jc .L50 - jz .L50 - ; - ; Check if engines will get damaged by high warp - ; - fld [esi + TREKDATA.WARPFAC] - fld [glb_dbl_6] - fsubp - fld st - fmulp - fld [esi + TREKDATA.DIST] - fmulp - fld [glb_dbl_66dot666] - fdivp - - call TRandom_Ranf - fxch - mc_CMP_ST0_ST1 - jc .check_time_warp - ; - ; Engines will get damaged - ; - inc [esp + loc26.Blooey] - call TRandom_Ranf - mcLoadLocal esi, loc26.pTrekData - fld [esi + TREKDATA.DIST] - fmulp - fstp [esi + TREKDATA.DIST] - -.check_time_warp: - mcLoadLocal esi, loc26.pTrekData - fld [glb_dbl_Ten] - fld [esi + TREKDATA.WARPFAC] - mc_CMP_ST0_ST1 - jc .L40 - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_0dot5] - fmulp - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .L40 - - inc [esp + loc26.TWarp] - -.L40: - mcLoadLocal ecx, loc26.Blooey - add ecx, [esp + loc26.TWarp] - mcOnRegZero ecx, .L50 - ; - ; If ship will collide with something then cancel - ; engine damages or time warp. - ; - mcLoadLocal esi, loc26.pTrekData - fld [glb_dbl_0dot15] - fld [esi + TREKDATA.DIREC] - fsubp - fld [glb_dbl_0dot5235998] - fmulp - fstp [esp + loc26.dblAngle] - ; - ; DELTAX = -SIN (ANGLE) - ; - fld [esp + loc26.dblAngle] - fsin - fchs - fstp [esp + loc26.dblDeltaX] - ; - ; DELTAY = COS (ANGLE) - ; - fld [esp + loc26.dblAngle] - fcos - fstp [esp + loc26.dblDeltaY] - - fld [esp + loc26.dblDeltaX] - fld [esp + loc26.dblDeltaY] - call TMove_Bigger - fstp [esp + loc26.dblBigger] - - fld [esp + loc26.dblDeltaX] - fld [esp + loc26.dblBigger] - fdivp - fstp [esp + loc26.dblDeltaX] - - fld [esp + loc26.dblDeltaY] - fld [esp + loc26.dblBigger] - fdivp - fstp [esp + loc26.dblDeltaY] - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_Ten] - fmulp - fld [esp + loc26.dblBigger] - fmulp - frndint - call TCommon_FP_Truncate - mcStoreLocal loc26.nSteps, eax - mcOnRegZero eax, .L50 - - movzx eax, [esi + TREKDATA.SECTX] - call TCommon_FPU_Load_EAX - fstp [esp + loc26.dblSectX] - - movzx eax, [esi + TREKDATA.SECTY] - call TCommon_FPU_Load_EAX - fstp [esp + loc26.dblSectY] - - mcLoad1 ecx - mcStoreLocal loc26.iStep, ecx - -.move_one_step: - fld [esp + loc26.dblSectX] - fld [esp + loc26.dblDeltaX] - faddp - fld st - fstp [esp + loc26.dblSectX] - frndint - call TCommon_FP_Truncate - mcStoreLocal loc26.iSectX, eax - - cmp eax, 1 - jl .L50 - cmp eax, 10 - jg .L50 - - fld [esp + loc26.dblSectY] - fld [esp + loc26.dblDeltaY] - faddp - fld st - fstp [esp + loc26.dblSectY] - frndint - call TCommon_FP_Truncate - mcStoreLocal loc26.iSectY, eax - - cmp eax, 1 - jl .L50 - cmp eax, 10 - jg .L50 - - mcLoadLocal eax, loc26.iSectX - mcLoadLocal edx, loc26.iSectY - call TArray_QuadPtr - cmp byte [ebx], CHAR_COSMOS - je .move_one_step - - mcZeroBits eax - mov [esp + loc26.Blooey], eax - mov [esp + loc26.TWarp], eax - -.L50: - mcLoadLocal edi, loc26.pTrekData - mov [edi + TREKDATA.KSTUF4], 0 - - call TMove_Move - - mcLoadLocal esi, loc26.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - ; - ; Deplete energy spent on move - ; - fld [esi + TREKDATA.WARPFAC] - fld st - fld st - fmulp - fmulp - fld [esi + TREKDATA.DIST] - fmulp - movzx eax, [esi + TREKDATA.SHLDUP] - inc eax - call TCommon_FPU_Load_EAX - fmulp - fld [esi + TREKDATA.ENERGY] - fsubrp - fld st - fstp [esi + TREKDATA.ENERGY] - - fldz - mc_CMP_ST0_ST1 - jc .L55 - - mov al, 4 - call TFinish_Main - jmp .done - -.L55: - cmp [esi + TREKDATA.KSTUF4], 0 - jne .try_enter_time_warp - ; - ; Time needed for a trip - ; - fld [esi + TREKDATA.DIST] - fld [glb_dbl_Ten] - fmulp - fld [esi + TREKDATA.WFACSQ] - fdivp - fstp [esi + TREKDATA.TIME] - -.try_enter_time_warp: - cmp [esp + loc26.TWarp], 0 - je .damage_warp_engines - - call TMove_TimeWarp - -.damage_warp_engines: - cmp [esp + loc26.Blooey], 0 - je .L60 - - call TRandom_Ranf - fld [glb_dbl_3] - fmulp - fld1 - faddp - mcLoadLocal esi, loc26.pTrekData - fld [esi + TREKDATA.DAMFAC] - fmulp - mov cl, DEV_WARP_ENGINES - call TArray_SetDblDamage - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 148 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 161 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 162 - call TConsole_Prout - -.L60: - mcLoadLocal edi, loc26.pTrekData - inc [edi + TREKDATA.IDIDIT] - jmp .done - -.L90: - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 150 - call TConsole_Prout - -.done: - mcEndLocals loc26.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TMsgTable.Asm b/programs/games/StarTrek/trunk/TMsgTable.Asm deleted file mode 100644 index 7edf6ed98d..0000000000 --- a/programs/games/StarTrek/trunk/TMsgTable.Asm +++ /dev/null @@ -1,191 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TMsgTable.Asm -; DATE: September 28, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMsgTable_CountItems: - mov esi, [glb_pRawMsgBuffer] - mcZeroBits eax - mcZeroBits ecx - mcZeroBits edx - -.load_char: - lodsb - mcOnRegZero eax, .done - - cmp al, 0Dh - sete dl - add ecx, edx - jmp .load_char - -.done: - mov [glb_NumMsgItems], ecx - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMsgTable_Parse: - mov ecx, [glb_NumMsgItems] - shl ecx, 2 - invoke HeapAlloc, [glb_Allocator], HEAP_NO_SERIALIZE, ecx - mov [glb_pMsgItems], eax - - mov edi, eax - mov esi, [glb_pRawMsgBuffer] - mcZeroBits eax - mov [glb_NumMsgItems], eax - -.load_char: - lodsb - mcOnRegZero eax, .done - - mcOnRegEqu al, '{', .begin_item - mcOnRegEqu al, '}', .end_item - jmp .load_char - -.begin_item: - mov [edi], esi - add edi, 4 - inc [glb_NumMsgItems] - jmp .load_char - -.end_item: - lea edx, [esi - 1] - mov byte [edx], 0 - jmp .load_char - -.done: - ret - -; -------------------------------------------------------------------------- -; Input: -; EDI = buffer address -; ECX = buffer size in bytes -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMsgTable_Decrypt: - pushad - -.reset_key: - mov esi, TMsgTable_GetItem - mcLoad8bitsToReg32 edx, 27 - -.next: - lodsb - xor [edi], al - inc edi - - dec ecx - jz .done - - dec edx - jz .reset_key - jmp .next - -.done: - popad - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc4: - .hFile HFILE ? - .dwSize UINT32 ? - .dwLoaded UINT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMsgTable_Load: - mcBeginLocals loc4.size - - invoke CreateFile, str_MsgFileName, GENERIC_READ, \ - 0, 0, OPEN_EXISTING, FILE_FLAG_SEQ_SCAN, 0 - - mcStoreLocal loc4.hFile, eax - cmp eax, -1 - je .done - - mov ebx, esp - invoke GetFileSize, [ebx + loc4.hFile], 0 - mcStoreLocal loc4.dwSize, eax - mcOnRegZero eax, .close - - inc eax - invoke HeapAlloc, [glb_Allocator], HEAP_NO_SERIALIZE, eax - mov [glb_pRawMsgBuffer], eax - mcOnRegZero eax, .close - - mcLoadMemberRef edi, loc4.dwLoaded - - invoke ReadFile, [ebx + loc4.hFile], eax, \ - [ebx + loc4.dwSize], edi, 0 - - mov edi, [glb_pRawMsgBuffer] - mcLoadLocal ecx, loc4.dwLoaded - mcZeroBits eax - mov [edi + ecx], al - - call TMsgTable_Decrypt - call TMsgTable_CountItems - call TMsgTable_Parse - -.close: - mov ebx, esp - invoke CloseHandle, [ebx + loc4.hFile] - -.done: - mcEndLocals loc4.size - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = item index (1-based) -; Output: -; ESI = points to ANSI text at specified index or empty string -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMsgTable_GetItem: - cmp ecx, [glb_NumMsgItems] - ja .empty - - dec ecx - push edx - mov edx, [glb_pMsgItems] - mov esi, [edx + ecx*4] - pop edx - ret - -.empty: - mov esi, str_CharSizeText + 4 - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = item index (1-based) -; Output: -; EAX = string length -; -------------------------------------------------------------------------- -align PROC_ALIGN -TMsgTable_GetLength: - push esi ecx - call TMsgTable_GetItem - - mcZeroBits eax - mcZeroBits ecx - -.next_char: - lodsb - mcOnRegZero eax, .done - - inc ecx - jmp .next_char - -.done: - mov eax, ecx - pop ecx esi - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TNova.Asm b/programs/games/StarTrek/trunk/TNova.Asm deleted file mode 100644 index 4f1dd2d9d0..0000000000 --- a/programs/games/StarTrek/trunk/TNova.Asm +++ /dev/null @@ -1,1410 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TNova.Asm -; DATE: October 18, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; NOVA -; -------------------------------------------------------------------------- -; Input: -; AL = X sector of nova -; DL = Y sector of nova -; -------------------------------------------------------------------------- -virtual at 0 -loc54: - .pTrekData PVOID ? - .arr_HitsX BYTES 12 - .arr_HitsY BYTES 12 - .bIHURT BOOL ? - .nBot INT32 ? - .nTop INT32 ? - .nTop2 INT32 ? - .nKOUNT INT32 ? - .nII INT32 ? - .nJJ INT32 ? - .nJ INT32 ? - .nMM INT32 ? - .nNN INT32 ? - .nLL INT32 ? - .nIX BYTE ? - .nICX BYTE ? - .nIY BYTE ? - .nICY BYTE ? - .chIQUAD BYTE ? - .chIQUAD1 BYTE ? - .nNewCX BYTE ? - .nNewCY BYTE ? - .arr_DblCourse DOUBLES 9 - .dbl_HIT DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TNova_Main: - mcBeginLocals loc54.size - - mcLoadGameDataPtr esi - mcStoreLocal loc54.pTrekData, esi - - mcStoreLocal loc54.nIX, al - mcStoreLocal loc54.nIY, dl - - fld [glb_dbl_0dot05] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .do_supernova - - mcLoadLocal al, loc54.nIX - mcLoadLocal dl, loc54.nIY - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - - call TConsole_SetGameMsgAttr - mov cl, 2 - mov bl, CHAR_ASTERISK - mcLoadLocal al, loc54.nIX - mcLoadLocal dl, loc54.nIY - call TConsole_CramEnemyAt - mov ecx, 613 - call TConsole_Prout - - call TArray_MyGalaxyPtr - dec dword [ebx] - ; - ; IF (IPHWHO != 1) STARKL++ - ; - mcLoadLocal esi, loc54.pTrekData - cmp [esi + TREKDATA.IPHWHO], 1 - je .setup_stack - - inc [esi + TREKDATA.STARKL] - -.setup_stack: - mcZeroBits eax - mcStoreLocal loc54.nKOUNT, eax - mcStoreLocal loc54.nICX, al - mcStoreLocal loc54.nICY, al - inc eax - mcStoreLocal loc54.nBot, eax - mcStoreLocal loc54.nTop, eax - mcStoreLocal loc54.nTop2, eax - ; - ; Also setup COURSE array - ; - mcLoadLocalRef edi, loc54.arr_DblCourse - fld [glb_dbl_10dot5] - fstp tbyte [edi] - fld [glb_dbl_12] - fstp tbyte [edi + 10] - fld [glb_dbl_1dot5] - fstp tbyte [edi + 20] - fld [glb_dbl_9] - fstp tbyte [edi + 30] - fldz - fstp tbyte [edi + 40] - fld [glb_dbl_3] - fstp tbyte [edi + 50] - fld [glb_dbl_7dot5] - fstp tbyte [edi + 60] - fld [glb_dbl_6] - fstp tbyte [edi + 70] - fld [glb_dbl_4dot5] - fstp tbyte [edi + 80] - ; - ; HITS (BOT,1) = IX - ; HITS (BOT,2) = IY - ; - mcLoadLocalRef esi, loc54.arr_HitsX - mcLoadLocalRef edi, loc54.arr_HitsY - mcLoadLocal al, loc54.nIX - mcLoadLocal dl, loc54.nIY - mov [esi], al - mov [edi], dl - -.L78: - ; - ; DO 90 MM=BOT,TOP - ; - mcLoadLocal eax, loc54.nBot - mcStoreLocal loc54.nMM, eax - -.MM_incremented: - ; - ; DO 90 NN=1,3 - ; - mcLoad1 eax - mcStoreLocal loc54.nNN, eax - -.NN_incremented: - ; - ; DO 90 J=1,3 - ; - mcLoad1 eax - mcStoreLocal loc54.nJ, eax - -.J_incremented: - ; - ; IF (J*NN == 4) GOTO 90 - ; - mcLoadLocal ecx, loc54.nJ - imul ecx, [esp + loc54.nNN] - mcOnRegEqu ecx, 4, .next_J - ; - ; II = HITS (MM,1) + NN - 2 - ; JJ = HITS (MM,2) + J - 2 - ; - mcLoadLocalRef esi, loc54.arr_HitsX - mcLoadLocalRef edi, loc54.arr_HitsY - mcLoadLocal ecx, loc54.nMM - dec ecx - movzx eax, byte [esi + ecx] - movzx edx, byte [edi + ecx] - add eax, [esp + loc54.nNN] - add edx, [esp + loc54.nJ] - sub eax, 2 - sub edx, 2 - mcStoreLocal loc54.nII, eax - mcStoreLocal loc54.nJJ, edx - ; - ; Validate sector II,JJ - ; - call TPhotons_IsValidSector - jnc .next_J - - mov eax, edx - call TPhotons_IsValidSector - jnc .next_J - ; - ; IQUAD = QUAD (II,JJ) - ; - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - call TArray_QuadPtr - mov cl, [ebx] - mcStoreLocal loc54.chIQUAD, cl - ; - ; Space, black hole, "thing", tholian or its web are not affected - ; - mcOnRegEqu cl, CHAR_COSMOS, .next_J - mcOnRegEqu cl, CHAR_THING, .next_J - mcOnRegEqu cl, CHAR_THOLIAN, .next_J - mcOnRegEqu cl, CHAR_WEB, .next_J - mcOnRegEqu cl, CHAR_BLACK_HOLE, .next_J - ; - ; IF (IQUAD != '*') GOTO 80 - ; - mcOnRegNotEqu cl, CHAR_ASTERISK, .L80 - ; - ; Another star affected by nova - ; - fld [glb_dbl_0dot05] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .do_secondary_supernova - ; - ; TOP2++ - ; HITS (TOP2,1) = II - ; HITS (TOP2,2) = JJ - ; - inc [esp + loc54.nTop2] - mov ecx, [esp + loc54.nTop2] - dec ecx - mcLoadLocalRef esi, loc54.arr_HitsX - mcLoadLocalRef edi, loc54.arr_HitsY - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - mov [esi + ecx], al - mov [edi + ecx], dl - ; - ; Decrease star count in the quadrant - ; - call TArray_MyGalaxyPtr - dec dword [ebx] - ; - ; IF (IPHWHO != 1) STARKL++ - ; - mcLoadLocal esi, loc54.pTrekData - cmp [esi + TREKDATA.IPHWHO], 1 - je .next_nova_msg - - inc [esi + TREKDATA.STARKL] - -.next_nova_msg: - call TConsole_SetGameMsgAttr - mov cl, 2 - mov bl, CHAR_ASTERISK - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - call TConsole_CramEnemyAt - mov ecx, 613 - call TConsole_Cram - jmp .L8905 - -.L80: - cmp [esp + loc54.chIQUAD], CHAR_PLANET - jne .L8002 - ; - ; Planet destroyed by nova - ; - call TArray_MyNewStufPtr - dec byte [ebx] - ; - ; IF (IPHWHO != 1) NPLANKL++ - ; - mcLoadLocal esi, loc54.pTrekData - cmp [esi + TREKDATA.IPHWHO], 1 - je .planet_killed_msg - - inc [esi + TREKDATA.NPLANKL] - -.planet_killed_msg: - call TConsole_SetGameMsgAttr - mov cl, 2 - mov bl, CHAR_PLANET - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - call TConsole_CramEnemyAt - mov ecx, 306 - call TConsole_Cram - - mcLoadLocal esi, loc54.pTrekData - movzx ecx, [esi + TREKDATA.IPLANET] - call TArray_PlanetPtr - mcZeroBits eax - stosd - stosb - - mov [esi + TREKDATA.IPLANET], al - mov [esi + TREKDATA.PLNETX], al - mov [esi + TREKDATA.PLNETY], al - - cmp [esi + TREKDATA.LANDED], 1 - jne .L8905 - - mov al, 16 - call TFinish_Main - jmp .done - -.L8002: - cmp [esp + loc54.chIQUAD], CHAR_STARBASE - jne .L82 - ; - ; Nova destroys starbase - ; - call TArray_MyGalaxyPtr - sub dword [ebx], 10 - - mcLoadLocal esi, loc54.pTrekData - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - call TEvents_RemoveThisBase - - mcLoadLocal esi, loc54.pTrekData - dec [esi + TREKDATA.REMBASE] - mov [esi + TREKDATA.BASEX], 0 - mov [esi + TREKDATA.BASEY], 0 - ; - ; IF (IPHWHO != 1) BASEKL++ - ; - mcLoadLocal esi, loc54.pTrekData - cmp [esi + TREKDATA.IPHWHO], 1 - je .base_killed_msg - - inc [esi + TREKDATA.BASEKL] - -.base_killed_msg: - mov [esi + TREKDATA.CONDIT], 0 - call TCommon_NewCondition - call TConsole_SetGameMsgAttr - mov cl, 2 - mov bl, CHAR_STARBASE - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - call TConsole_CramEnemyAt - mov ecx, 306 - call TConsole_Cram - jmp .L8905 - ; - ; HIT = 800.0 + 800.0*RANF(0) - ; -.L82: - call TRandom_Ranf - fld [glb_dbl_800] - fmulp - fld [glb_dbl_800] - faddp - fstp [esp + loc54.dbl_HIT] - - mcLoadLocal esi, loc54.pTrekData - mov al, [esi + TREKDATA.SHIP] - cmp [esp + loc54.chIQUAD], al - jne .L87 - ; - ; Starship hit by nova! - ; - call TConsole_SetGameMsgAttr - call TConsole_Cram3Asterisks - call TConsole_CramShip - mov ecx, 614 - call TConsole_Cram - - mcLoadLocal esi, loc54.pTrekData - mov [esi + TREKDATA.KSHOT], 0 - - mcLoadLocalRef esi, loc54.dbl_HIT - mcLoadLocalRef edi, loc54.bIHURT - mcZeroBits ecx - call TAttack_Zap - - mcLoadLocal esi, loc54.pTrekData - fldz - fld [esi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jnc .L86 - - mov al, 7 - call TFinish_Main - jmp .done - -.L86: - ; - ; Nova kicks starship away - ; - mcLoadLocal ecx, loc54.nMM - dec ecx - mcLoadLocalRef ebx, loc54.arr_HitsX - mcLoadLocalRef edx, loc54.arr_HitsY - mov al, [ebx + ecx] - mov dl, [edx + ecx] - - mov cl, [esi + TREKDATA.SECTX] - sub cl, al - add [esp + loc54.nICX], cl - - mov cl, [esi + TREKDATA.SECTY] - sub cl, al - add [esp + loc54.nICY], cl - - inc [esp + loc54.nKOUNT] - jmp .next_J - -.L87: - ; - ; Enemy ship hit by nova! - ; - cmp [esp + loc54.chIQUAD], CHAR_KLINGON - je .L88 - ; - ; Find enemy index in KX,KY arrays - ; - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - mcLoadLocal esi, loc54.pTrekData - movzx ecx, [esi + TREKDATA.NENHERE] - lea edi, [esi + TREKDATA.KY] - add esi, TREKDATA.KX - mcZeroBits ebx - -.find_enemy_ship: - inc ebx - cmp [esi], al - jne .next_ship - cmp [edi], dl - jne .next_ship - - mcStoreLocal loc54.nLL, ebx - jmp .hit_the_enemy - -.next_ship: - inc esi - inc edi - loop .find_enemy_ship - - ;int 3 - jmp .next_J - -.hit_the_enemy: - ; - ; KPOWER (LL) -= HIT - ; - mcLoadLocal esi, loc54.pTrekData - lea ebx, [esi + TREKDATA.KPOWER] - mcLoadLocal ecx, loc54.nLL - dec ecx - imul ecx, 10 - fld tbyte [ebx + ecx] - fld [esp + loc54.dbl_HIT] - fsubp - fstp tbyte [ebx + ecx] - - fldz - fld tbyte [ebx + ecx] - mc_CMP_ST0_ST1 - jc .L88 - ; - ; NEWCX = II + II - HITS (MM,1) - ; NEWCY = JJ + JJ - HITS (MM,2) - ; - mcLoadLocalRef esi, loc54.arr_HitsX - mcLoadLocalRef edi, loc54.arr_HitsY - mcLoadLocal ecx, loc54.nMM - dec ecx - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - add eax, eax - add edx, edx - sub al, [esi + ecx] - sub dl, [edi + ecx] - mcStoreLocal loc54.nNewCX, al - mcStoreLocal loc54.nNewCY, dl - - call TConsole_SetGameMsgAttr - mov cl, 2 - mcLoadLocal bl, loc54.chIQUAD - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - call TConsole_CramEnemyAt - mov ecx, 615 - call TConsole_Cram - - movzx eax, [esp + loc54.nNewCX] - call TPhotons_IsValidSector - jnc .L8703 - - movzx eax, [esp + loc54.nNewCY] - call TPhotons_IsValidSector - jnc .L8703 - ; - ; IQUAD1 = QUAD (NEWCX,NEWCY) - ; - mcLoadLocal al, loc54.nNewCX - mcLoadLocal dl, loc54.nNewCY - call TArray_QuadPtr - mov cl, [ebx] - mcStoreLocal loc54.chIQUAD1, cl - - mcOnRegNotEqu cl, CHAR_BLACK_HOLE, .L87025 - ; - ; Enemy displaced into black hole! - ; - mov ecx, 616 - call TConsole_Prout - jmp .L88 - -.L87025: - mcOnRegNotEqu cl, CHAR_COSMOS, .L8703 - - mov ecx, 617 - call TConsole_Cram - - mov cl, 2 - mcLoadLocal al, loc54.nNewCX - mcLoadLocal dl, loc54.nNewCY - call TConsole_CramLoc - - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - - mcLoadLocal al, loc54.nNewCX - mcLoadLocal dl, loc54.nNewCY - call TArray_QuadPtr - mcLoadLocal cl, loc54.chIQUAD - mov [ebx], cl - - mcLoadLocal al, loc54.nNewCX - mcLoadLocal dl, loc54.nNewCY - mcLoadLocal ecx, loc54.nLL - dec ecx - mcLoadLocal esi, loc54.pTrekData - lea edi, [esi + TREKDATA.KY] - add esi, TREKDATA.KX - mov [esi + ecx], al - mov [edi + ecx], dl - - imul ecx, 10 - mcLoadLocal esi, loc54.pTrekData - lea edi, [esi + TREKDATA.KDIST] - sub al, [esi + TREKDATA.SECTX] - sub dl, [esi + TREKDATA.SECTY] - movsx eax, al - movsx edx, dl - imul eax, eax - imul edx, edx - add eax, edx - call TCommon_FPU_Load_EAX - fsqrt - fstp tbyte [edi + ecx] - -.L8703: - call TConsole_ScrollUp - jmp .next_J - -.L88: - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - call TPhasers_DeadKlingon - jmp .next_J - -.L8905: - call TConsole_ScrollUp - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - -.next_J: - inc [esp + loc54.nJ] - cmp [esp + loc54.nJ], 3 - jbe .J_incremented - - inc [esp + loc54.nNN] - cmp [esp + loc54.nNN], 3 - jbe .NN_incremented - - inc [esp + loc54.nMM] - mov eax, [esp + loc54.nTop] - cmp [esp + loc54.nMM], eax - jbe .MM_incremented - ; - ; Check if more stars affected by nova - ; - mov eax, [esp + loc54.nTop] - cmp [esp + loc54.nTop2], eax - je .L93 - - inc eax - mcStoreLocal loc54.nBot, eax - mov eax, [esp + loc54.nTop2] - mcStoreLocal loc54.nTop, eax - jmp .L78 - -.L93: - cmp [esp + loc54.nKOUNT], 0 - je .done - ; - ; Starship affected by nova - kick it away - ; - mcLoadLocal esi, loc54.pTrekData - fild [esp + loc54.nKOUNT] - fld [glb_dbl_0dot1] - fmulp - fstp [esi + TREKDATA.DIST] - - cmp [esp + loc54.nICX], 0 - je .L9301 - - mcLoad1 eax - movsx ecx, [esp + loc54.nICX] - call TAttack_ISign - mcStoreLocal loc54.nICX, al - -.L9301: - cmp [esp + loc54.nICY], 0 - je .L9302 - - mcLoad1 eax - movsx ecx, [esp + loc54.nICY] - call TAttack_ISign - mcStoreLocal loc54.nICY, al - -.L9302: - ; - ; INDEX = 3*(ICX+1) + ICY + 2 - ; - movsx ecx, [esp + loc54.nICX] - inc ecx - imul ecx, 3 - movsx eax, [esp + loc54.nICY] - add ecx, eax - add ecx, 2 - - cmp ecx, 1 - jb .assertion_failed - cmp ecx, 9 - ja .assertion_failed - - dec ecx - imul ecx, 10 - mcLoadLocalRef ebx, loc54.arr_DblCourse - fld tbyte [ebx + ecx] - fstp [esi + TREKDATA.DIREC] - - fld [esi + TREKDATA.DIREC] - fldz - mc_CMP_ST0_ST1 - jnz .check_distance - - fldz - fstp [esi + TREKDATA.DIST] - -.check_distance: - fld [esi + TREKDATA.DIST] - fldz - mc_CMP_ST0_ST1 - jz .done - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_12] - fmulp - fstp [esi + TREKDATA.TIME] - - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mov ecx, 618 - call TConsole_Cram - call TConsole_CramShip - - call TMove_Move - jmp .done - -.do_secondary_supernova: - mcLoadLocal eax, loc54.nII - mcLoadLocal edx, loc54.nJJ - jmp .call_snova - -.assertion_failed: - ;int 3 - jmp .done - -.do_supernova: - mcLoadLocal al, loc54.nIX - mcLoadLocal dl, loc54.nIY - -.call_snova: - call TNova_SuperNova - -.done: - mcEndLocals loc54.size - ret - -; -------------------------------------------------------------------------- -; SNOVA -; -------------------------------------------------------------------------- -; Input: -; AL = X sector of supernova -; DL = Y sector of supernova -; -------------------------------------------------------------------------- -virtual at 0 -loc55: - .pTrekData PVOID ? - .pChart PINT32 ? - .pGalaxy PINT32 ? - .iNSX INDEX ? - .iNSY INDEX ? - .iNUM INDEX ? - .iNQX INDEX ? - .iNQY INDEX ? - .nInputSectorX BYTE ? - .nInputSectorY BYTE ? - .__pad_1 BYTE ? - .__pad_2 BYTE ? - .nKLDEAD COUNT ? - .nCOMDEAD COUNT ? - .nISCDEAD COUNT ? - .nRMDEAD COUNT ? - .nNPDEAD COUNT ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TNova_SuperNova: - mcBeginLocals loc55.size - - mcLoadGameDataPtr esi - mcStoreLocal loc55.pTrekData, esi - - movzx eax, al - movzx edx, dl - mcStoreLocal loc55.iNSX, eax - mcStoreLocal loc55.iNSY, edx - - mcStoreLocal loc55.nInputSectorX, al - mcStoreLocal loc55.nInputSectorY, dl - - test eax, edx - jnz .L50 - - mov edx, [esi + TREKDATA.INSTAR] - call TRandom_IRan - inc eax - mcStoreLocal loc55.iNUM, eax - - mcLoad1 eax - mcStoreLocal loc55.iNQX, eax - -._NQX_incremented: - mcLoad1 eax - mcStoreLocal loc55.iNQY, eax - -._NQY_incremented: - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TArray_GetGalaxyValue - mcOnRegEqu ecx, 1000, .done - - mov eax, ecx - mcZeroBits edx - mcLoad8bitsToReg32 ecx, 10 - div ecx - sub [esp + loc55.iNUM], edx - js .L20 - jz .L20 - -.next_quad: - inc [esp + loc55.iNQY] - cmp [esp + loc55.iNQY], 8 - jbe ._NQY_incremented - - inc [esp + loc55.iNQX] - cmp [esp + loc55.iNQX], 8 - jbe ._NQX_incremented - - jmp .done - -.L20: - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TArray_GetGalaxyValue - mcOnRegEqu ecx, 1000, .done - - mcLoadLocal esi, loc55.pTrekData - mcLoadLocal eax, loc55.iNQX - cmp al, [esi + TREKDATA.QUADX] - jne .L70 - - mcLoadLocal eax, loc55.iNQY - cmp al, [esi + TREKDATA.QUADY] - jne .L70 - ; - ; The supernova is in this quadrant! - ; - cmp [esi + TREKDATA.JUSTIN], 0 - jne .L70 - - call TArray_MyGalaxyPtr - mov eax, [ebx] - mcZeroBits edx - mcLoad8bitsToReg32 ecx, 10 - div ecx - mcOnRegZero edx, .done - call TRandom_IRan - inc eax - mcStoreLocal loc55.iNUM, eax - - mcLoadLocal esi, loc55.pTrekData - add esi, TREKDATA.QUAD - mcLoad8bitsToReg32 ecx, 100 - mcZeroBits edx - -.find_star: - lodsb - mcOnRegNotEqu al, CHAR_ASTERISK, .next_star - - dec [esp + loc55.iNUM] - jz .L50 - -.next_star: - inc edx - loop .find_star - jmp .done - -.L50: - call TConsole_ScrollUp - call TMove_RedAlert - call TConsole_SetGameMsgAttr - mov ecx, 619 - call TConsole_Cram - - mov cl, 2 - mcLoadLocal eax, loc55.iNSX - mcLoadLocal edx, loc55.iNSY - call TConsole_CramLoc - call TConsole_ScrollUp - - mcLoadLocal esi, loc55.pTrekData - movzx eax, [esi + TREKDATA.QUADX] - movzx edx, [esi + TREKDATA.QUADY] - mcStoreLocal loc55.iNQX, eax - mcStoreLocal loc55.iNQY, edx - ; - ; Supernova adjacent to ship ends game! - ; - movzx eax, [esi + TREKDATA.SECTX] - sub eax, [esp + loc55.iNSX] - imul eax, eax - - movzx ecx, [esi + TREKDATA.SECTY] - sub ecx, [esp + loc55.iNSY] - imul ecx, ecx - - add eax, ecx - cmp ecx, 2 - ja .L80 - - mov ecx, 620 - call TConsole_ProutGameMsg - call TPlanet_Stars - - mcLoadLocal edi, loc55.pTrekData - mov [edi + TREKDATA.ALLDONE], 1 - jmp .L80 - -.L70: - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jc .L80 - - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mov ecx, 621 - call TConsole_Cram - - mcLoadLocal esi, loc55.pTrekData - mov cl, 1 - fld [esi + TREKDATA.DATE] - call TConsole_CramFloat - call TConsole_ScrollUp - - mov ecx, 622 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TConsole_CramLoc - - mov ecx, 623 - call TConsole_Prout - -.L80: - ; - ; A wave of total destruction in the quadrant!! - ; - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TArray_GetGalaxyValue - mcStoreLocal loc55.iNUM, ecx - - mcLoad8bitsToReg32 eax, 100 - xchg eax, ecx - mcZeroBits edx - div ecx - mcStoreLocal loc55.nKLDEAD, eax - - mcZeroBits eax - mcStoreLocal loc55.nCOMDEAD, eax - mcStoreLocal loc55.nISCDEAD, eax - - mcLoadLocal esi, loc55.pTrekData - mcLoadLocal eax, loc55.iNQX - cmp al, [esi + TREKDATA.ISX] - jne .L85 - - mcLoadLocal eax, loc55.iNQY - cmp al, [esi + TREKDATA.ISY] - jne .L85 - - mcZeroBits eax - mov [esi + TREKDATA.NSCREM], al - mov [esi + TREKDATA.ISX], al - mov [esi + TREKDATA.ISY], al - mov [esi + TREKDATA.ISATB], al - mov [esi + TREKDATA.ISCATE], al - inc [esp + loc55.nISCDEAD] - - fld [glb_dbl_1E38] - fld st - fstp [esi + TREKDATA.FUTURE6] - fstp [esi + TREKDATA.FUTURE7] - -.L85: - cmp [esp + loc55.nKLDEAD], 0 - je .L100 - - mcLoadLocal eax, loc55.nKLDEAD - sub [esi + TREKDATA.REMKL], al - - cmp [esi + TREKDATA.REMCOM], 0 - je .L100 - - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TPhasers_RemoveCommander - jnc .L100 - - dec [esp + loc55.nKLDEAD] - inc [esp + loc55.nCOMDEAD] - - mcLoadLocal esi, loc55.pTrekData - cmp [esi + TREKDATA.REMCOM], 0 - jne .L100 - - fld [glb_dbl_1E38] - fstp [esi + TREKDATA.FUTURE2] - -.L100: - ; - ; Destroy Romulans and planets - ; - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TArray_NewStufPtr - movzx ecx, byte [ebx] - mcStoreLocal loc55.iNUM, ecx - mcZeroBits eax - mov [ebx], al - ; - ; NRMDEAD = NUM/10 - ; - mov eax, ecx - mcZeroBits edx - mcLoad8bitsToReg32 ecx, 10 - div ecx - mcStoreLocal loc55.nRMDEAD, eax - mcStoreLocal loc55.nNPDEAD, edx - - mcLoadLocal esi, loc55.pTrekData - sub [esi + TREKDATA.NROMREM], al - - cmp [esp + loc55.nNPDEAD], 0 - je .L109 - ; - ; Remove planet in quadrant NQX,NQY - ; - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TArray_FindPlanet - jecxz .L109 - - mov edi, esi - mcZeroBits eax - stosd - stosb - -.L109: - ; - ; Destroy base (if any) in quadrant NQX,NQY - ; - mcLoadLocal esi, loc55.pTrekData - cmp [esi + TREKDATA.REMBASE], 0 - je .L120 - - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TEvents_RemoveThisBase - jnc .L120 - - mcLoadLocal esi, loc55.pTrekData - dec [esi + TREKDATA.REMBASE] - -.L120: - ; - ; If starship caused supernova, tally up the destruction - ; - cmp [esp + loc55.iNSX], 0 - je .L130 - - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TArray_GetGalaxyValue - mov eax, ecx - mcZeroBits edx - mcLoad8bitsToReg32 ecx, 100 - div ecx - mcStoreLocal loc55.iNUM, edx - - mcLoadLocal eax, loc55.nKLDEAD - mcLoadLocal edx, loc55.nCOMDEAD - mcLoadLocal ecx, loc55.nRMDEAD - mcLoadLocal ebx, loc55.nISCDEAD - - mcLoadLocal esi, loc55.pTrekData - add [esi + TREKDATA.KILLK], al - add [esi + TREKDATA.KILLC], dl - add [esi + TREKDATA.NROMKL], cl - add [esi + TREKDATA.NSCKILL], bl - - cmp [esi + TREKDATA.IPHWHO], 1 - je .L130 - - mcZeroBits edx - mcLoad8bitsToReg32 ecx, 10 - mcLoadLocal eax, loc55.iNUM - div ecx - - add [esi + TREKDATA.BASEKL], al - add [esi + TREKDATA.STARKL], dl - - mcLoadLocal eax, loc55.nNPDEAD - add [esi + TREKDATA.NPLANKL], al - -.L130: - ; - ; Mark supernova in galaxy and in star chart - ; - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TArray_StarChartPtr - mcStoreLocal loc55.pChart, ebx - - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TArray_GalaxyPtr - mcStoreLocal loc55.pGalaxy, ebx - - mcLoadLocal esi, loc55.pChart - cmp dword [esi], 0 - jle .L131 - - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jnc .L131 - - mcLoadLocal esi, loc55.pGalaxy - mov eax, [esi] - add eax, 1000 - mcLoadLocal edi, loc55.pChart - mov [edi], eax - -.L131: - mov cl, DEV_SUBSPACE_RADIO - call TArray_IsDamaged - jnc .mark_chart - - mcLoadLocal esi, loc55.pTrekData - mcLoadLocal eax, loc55.iNQX - cmp [esi + TREKDATA.QUADX], al - jne .L132 - - mcLoadLocal eax, loc55.iNQY - cmp [esi + TREKDATA.QUADY], al - jne .L132 - -.mark_chart: - mcLoadLocal edi, loc55.pChart - mov dword [edi], 1 - -.L132: - mcLoadLocal edi, loc55.pGalaxy - mov dword [edi], 1000 - ; - ; If supernova destroys last klingons, give special message - ; - mcLoadLocal esi, loc55.pTrekData - cmp [esi + TREKDATA.REMKL], 0 - jne .L140 - - mcLoadLocal eax, loc55.iNQX - cmp [esi + TREKDATA.QUADX], al - jne .win_by_supernova - - mcLoadLocal eax, loc55.iNQY - cmp [esi + TREKDATA.QUADY], al - je .L140 - -.win_by_supernova: - call TConsole_ScrollUp - call TConsole_ScrollUp - mov ecx, 624 - call TConsole_ProutGameMsg - - mov ecx, 625 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal eax, loc55.iNQX - mcLoadLocal edx, loc55.iNQY - call TConsole_CramLoc - - mov ecx, 626 - call TConsole_Prout - - mov al, 1 - call TFinish_Main - jmp .done - -.L140: - mcLoadLocal esi, loc55.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - je .done - - mov al, 8 - call TFinish_Main - -.done: - mcEndLocals loc55.size - ret - -; -------------------------------------------------------------------------- -; AUTOVER, GRAB -; -------------------------------------------------------------------------- -; Input: -; AL = finishing code if game will end (II in original source) -; CL =0 if AUTOVER called, =1 if GRAB called (IGRAB in original source) -; -------------------------------------------------------------------------- -virtual at 0 -loc53: - .pTrekData PVOID ? - .bIGRAB BYTE ? - .bII BYTE ? - .pad_1 BYTE ? - .pad_2 BYTE ? - .dbl_POWER DOUBLE ? - .dbl_DISTREQ DOUBLE ? - .dbl_DISTMAX DOUBLE ? - .pad_11 BYTE ? - .pad_22 BYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TNova_AutomaticOverride: - mcBeginLocals loc53.size - - mcStoreLocal loc53.bIGRAB, cl - mcStoreLocal loc53.bII, al - - mcLoadGameDataPtr esi - mcStoreLocal loc53.pTrekData, esi - - cmp [esi + TREKDATA.LANDED], 1 - jne .L45 - - mov cl, DEV_TRANSPORTER - call TArray_IsDamaged - jc .L25 - - mov ecx, 600 - call TConsole_ProutGameMsg - - mcLoadLocal esi, loc53.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - je .L20 - - mov ecx, 601 - call TConsole_Prout - jmp .L25 - -.L20: - mov ecx, 602 - call TConsole_Cram - invoke Sleep, 1200 - - call TRandom_Ranf - fld [glb_dbl_0dot5] - mc_CMP_ST0_ST1 - jc .L30 - - mov ecx, 573 - call TConsole_Prout - -.L25: - mcLoadLocal al, loc53.bII - -.finished: - call TFinish_Main - jmp .done - -.L30: - mov ecx, 574 - call TConsole_Prout - - mcLoadLocal esi, loc53.pTrekData - cmp [esi + TREKDATA.IMINE], 0 - je .L45 - - mov [esi + TREKDATA.IMINE], 0 - - mov ecx, 603 - call TConsole_Cram - - call TRandom_Ranf - fld [glb_dbl_DOCKFAC] - mc_CMP_ST0_ST1 - jc .L40 - - mov ecx, 604 - call TConsole_Prout - jmp .L45 - -.L40: - mov ecx, 605 - call TConsole_Prout - - mcLoadLocal esi, loc53.pTrekData - mov [esi + TREKDATA.ICRYSTL], 1 - -.L45: - cmp [esp + loc53.bIGRAB], 0 - jne .done - - mcLoadLocal esi, loc53.pTrekData - cmp [esi + TREKDATA.ICRAFT], 0 - je .try_override - - mov al, 17 - jmp .finished - -.try_override: - call TConsole_ScrollUp - - mcLoadLocal esi, loc53.pTrekData - cmp [esi + TREKDATA.JUSTIN], 0 - je .L50 - -.L47: - call TMove_RedAlert - call TConsole_SetGameMsgAttr - - mov ecx, 606 - call TConsole_Cram - call TConsole_CramShip - - mov ecx, 607 - call TConsole_Prout - mov ecx, 608 - call TConsole_Prout - call TConsole_ScrollUp - -.L50: - call TConsole_SetGameMsgAttr - mov ecx, 609 - call TConsole_Cram - call TConsole_CramShip - call TConsole_ScrollUp - - mov ecx, 610 - call TConsole_Prout - ; - ; STARCH (QUADX,QUADY) = 1 - ; - mcLoad1 ecx - mcLoadLocal esi, loc53.pTrekData - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - call TArray_SetStarChartValue - ; - ; Try to use warp engines... - ; - mov cl, DEV_WARP_ENGINES - call TArray_IsDamaged - jnc .L100 - - call TConsole_ScrollUp - mov ecx, 150 - call TConsole_ProutGameMsg - mov al, 8 - jmp .finished - -.L100: - call TRandom_Ranf - fld [glb_dbl_2] - fmulp - fld [glb_dbl_6] - faddp - mcLoadLocal esi, loc53.pTrekData - fstp [esi + TREKDATA.WARPFAC] - - fld [esi + TREKDATA.WARPFAC] - fld st - fmulp - fstp [esi + TREKDATA.WFACSQ] - - call TConsole_SetGameMsgAttr - mov ecx, 611 - call TConsole_Cram - - mov cl, 1 - mcLoadLocal esi, loc53.pTrekData - fld [esi + TREKDATA.WARPFAC] - call TConsole_CramFloat - call TConsole_ScrollUp - - mcLoadLocal esi, loc53.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [glb_dbl_0dot75] - fmulp - fstp [esp + loc53.dbl_POWER] - - fld [esi + TREKDATA.WARPFAC] - fld st - fld st - fmulp - fmulp - - mov al, [esi + TREKDATA.SHLDUP] - call TCommon_LoadByteIntoFPU - fmulp - - fld [esp + loc53.dbl_POWER] - fdivrp - fstp [esp + loc53.dbl_DISTMAX] - - call TRandom_Ranf - fld [glb_dbl_2] - fmulp - fld [glb_dbl_1dot4142] - faddp - fstp [esp + loc53.dbl_DISTREQ] - - fld [esp + loc53.dbl_DISTREQ] - fld [esp + loc53.dbl_DISTMAX] - call TCommon_FPU_Min - mcLoadLocal esi, loc53.pTrekData - fstp [esi + TREKDATA.DIST] - - fld [esi + TREKDATA.DIST] - fld [glb_dbl_Ten] - fmulp - fld [esi + TREKDATA.WFACSQ] - fdivp - fstp [esi + TREKDATA.TIME] - - call TRandom_Ranf - fld [glb_dbl_12] - fmulp - mcLoadLocal esi, loc53.pTrekData - fstp [esi + TREKDATA.DIREC] - - mcZeroBits eax - mov [esi + TREKDATA.JUSTIN], al - mov [esi + TREKDATA.INORBIT], al - - invoke Sleep, 1000 - call TMove_WarpX - - mcLoadLocal esi, loc53.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - - cmp [esi + TREKDATA.JUSTIN], 0 - jne .L200 - - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - call TConsole_Cram3Asterisks - call TConsole_CramShip - mov ecx, 612 - call TConsole_Prout - mov al, 8 - jmp .finished - -.L200: - call TArray_MyGalaxyPtr - cmp dword [ebx], 1000 - je .L47 - - mcLoadLocal esi, loc53.pTrekData - cmp [esi + TREKDATA.REMKL], 0 - jne .done - - mov al, 1 - jmp .finished - -.done: - mcEndLocals loc53.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TPhasers.Asm b/programs/games/StarTrek/trunk/TPhasers.Asm deleted file mode 100644 index 49b15d4c2e..0000000000 --- a/programs/games/StarTrek/trunk/TPhasers.Asm +++ /dev/null @@ -1,1424 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TPhasers.Asm -; DATE: October 18, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; AL = quadrant X of a COMMANDER -; DL = quadrant Y of a COMMANDER -; Output: -; CF=1 if commander was removed -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPhasers_RemoveCommander: - pushad - - mcLoadGameDataPtr ebx - cmp [ebx + TREKDATA.REMCOM], 0 - je .not_removed - - mcLoadMemberRef esi, TREKDATA.CX - mcLoadMemberRef edi, TREKDATA.CY - mcZeroBits ecx - -.find_commander: - cmp [esi + ecx], al - jne .next_commander - cmp [edi + ecx], dl - jne .next_commander - ; - ; Replace commander by the last entry - ; - movzx edx, [ebx + TREKDATA.REMCOM] - dec edx - push edx - - mov al, [esi + edx] - mov dl, [edi + edx] - mov [esi + ecx], al - mov [edi + ecx], dl - - mcZeroBits eax - pop edx - mov [esi + edx], al - mov [edi + edx], al - - dec [ebx + TREKDATA.REMCOM] - - popad - stc - ret - -.next_commander: - inc ecx - cmp cl, [ebx + TREKDATA.REMCOM] - jb .find_commander - -.not_removed: - popad - clc - ret - -; -------------------------------------------------------------------------- -; DEADKL -; -------------------------------------------------------------------------- -; Input: -; AL = sector X of an enemy -; DL = sector Y of an enemy -; -------------------------------------------------------------------------- -virtual at 0 -loc41: - .pTrekData PVOID ? - .pQUAD PBYTE ? - .nTYPE BYTE ? - .nIXX BYTE ? - .nIYY BYTE ? - .nEnemies BYTE ? - .nJ INDEX ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPhasers_DeadKlingon: - mcBeginLocals loc41.size - - mcStoreLocal loc41.nIXX, al - mcStoreLocal loc41.nIYY, dl - - call TArray_QuadPtr - mcStoreLocal loc41.pQUAD, ebx - - mov cl, [ebx] - mcStoreLocal loc41.nTYPE, cl - - mcLoadGameDataPtr ebx - mcStoreLocal loc41.pTrekData, ebx - - call TConsole_SetGameMsgAttr - mcLoadLocal al, loc41.nIXX - mcLoadLocal dl, loc41.nIYY - mcLoadLocal bl, loc41.nTYPE - mov cl, 2 - call TConsole_CramEnemyAt - - mcLoadLocal al, loc41.nTYPE - mcOnRegEqu al, CHAR_THOLIAN, .L30 - mcOnRegEqu al, CHAR_ROMULAN, .L27 - - call TArray_MyGalaxyPtr - sub dword [ebx], 100 - - mcLoadLocal edi, loc41.pTrekData - dec [edi + TREKDATA.KLHERE] - dec [edi + TREKDATA.REMKL] - - mcLoadLocal al, loc41.nTYPE - mcOnRegEqu al, CHAR_KLINGON, .L25 - mcOnRegEqu al, CHAR_SCOM, .L26 - ; - ; COMMANDER finds his fate! - ; - mcLoadLocal edi, loc41.pTrekData - mov [edi + TREKDATA.COMHERE], 0 - - mov al, [edi + TREKDATA.QUADX] - mov dl, [edi + TREKDATA.QUADY] - call TPhasers_RemoveCommander - - fld [glb_dbl_1E38] - fstp [edi + TREKDATA.FUTURE2] - - cmp [edi + TREKDATA.REMCOM], 0 - je .kill_commander - - mov al, [edi + TREKDATA.INCOM] - call TCommon_LoadByteIntoFPU - mov al, [edi + TREKDATA.REMCOM] - call TCommon_LoadByteIntoFPU - fdivp - push edi - call TCommon_ExpRan - pop edi - fld [edi + TREKDATA.DATE] - faddp - fstp [edi + TREKDATA.FUTURE2] - -.kill_commander: - inc [edi + TREKDATA.KILLC] - jmp .L30 - -.L25: - ; - ; Ordinary KLINGON wasted! - ; - inc [edi + TREKDATA.KILLK] - jmp .L30 - -.L26: - ; - ; SUPER-COMMANDER finally brought down! - ; - mcZeroBits eax - mov [edi + TREKDATA.NSCREM], al - mov [edi + TREKDATA.ISHERE], al - mov [edi + TREKDATA.ISX], al - mov [edi + TREKDATA.ISY], al - mov [edi + TREKDATA.ISATB], al - mov [edi + TREKDATA.ISCATE], al - - inc [edi + TREKDATA.NSCKILL] - fld [glb_dbl_1E38] - fld st - fstp [edi + TREKDATA.FUTURE6] - fstp [edi + TREKDATA.FUTURE7] - jmp .L30 - -.L27: - ; - ; ROMULAN destroyed! - ; - call TArray_MyNewStufPtr - sub byte [ebx], 10 - - dec [edi + TREKDATA.IRHERE] - dec [edi + TREKDATA.NROMREM] - inc [edi + TREKDATA.NROMKL] - -.L30: - ; - ; Finish message - ; - mov ecx, 306 - call TConsole_Prout - - mcLoadLocal ebx, loc41.pQUAD - mov byte [ebx], CHAR_COSMOS - - mcLoadLocal esi, loc41.pTrekData - cmp [esi + TREKDATA.REMKL], 0 - je .done - - mov al, [esi + TREKDATA.REMCOM] - shl al, 2 - add al, [esi + TREKDATA.REMKL] - call TCommon_LoadByteIntoFPU - fld [esi + TREKDATA.REMRES] - fdivrp - fstp [esi + TREKDATA.REMTIME] - ; - ; Kill Tholian - ; - cmp [esp + loc41.nTYPE], CHAR_THOLIAN - je .kill_tholian - ; - ; Remove enemy ship from arrays describing local conditions - ; - mov cl, [esi + TREKDATA.NENHERE] - mcStoreLocal loc41.nEnemies, cl - lea edi, [esi + TREKDATA.KY] - add esi, TREKDATA.KX - mcZeroBits ecx - mcLoadLocal al, loc41.nIXX - mcLoadLocal dl, loc41.nIYY - -.find_enemy_ship: - cmp al, [esi + ecx] - jne .next_ship - cmp dl, [edi + ecx] - je .L45 - -.next_ship: - inc ecx - cmp cl, [esp + loc41.nEnemies] - jb .find_enemy_ship - - ;int 3 - jmp .done - -.L45: - inc ecx - - mcLoadLocal ebx, loc41.pTrekData - dec [ebx + TREKDATA.NENHERE] - dec [esp + loc41.nEnemies] - - cmp cl, [ebx + TREKDATA.NENHERE] - ja .L55 - ; - ; Shift all ships up to delete the killed one - ; - mcStoreLocal loc41.nJ, ecx - -.remove_ship: - mcLoadLocal ecx, loc41.nJ - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - dec ecx - mov al, [esi + ecx + 1] - mov dl, [edi + ecx + 1] - mov [esi + ecx], al - mov [edi + ecx], dl - - imul ecx, 10 - mcLoadMemberRef esi, TREKDATA.KPOWER - mcLoadMemberRef edi, TREKDATA.KDIST - fld tbyte [esi + ecx + 10] - fld tbyte [edi + ecx + 10] - fstp tbyte [edi + ecx] - fstp tbyte [esi + ecx] - - inc [esp + loc41.nJ] - mov ecx, [esp + loc41.nJ] - cmp cl, [esp + loc41.nEnemies] - jbe .remove_ship - -.L55: - ; - ; Cleanup the tail of arrays - ; - movzx ecx, [esp + loc41.nEnemies] - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - mcZeroBits eax - mov [esi + ecx], al - mov [edi + ecx], al - - imul ecx, 10 - fldz - fldz - mcLoadMemberRef esi, TREKDATA.KPOWER - mcLoadMemberRef edi, TREKDATA.KDIST - fstp tbyte [esi + ecx] - fstp tbyte [edi + ecx] - jmp .done - -.kill_tholian: - dec [esi + TREKDATA.ITHERE] - -.done: - mcEndLocals loc41.size - ret - -; -------------------------------------------------------------------------- -; HITEM -; -------------------------------------------------------------------------- -; Input: -; ESI = pointer to array of DOUBLE values with hits -; -------------------------------------------------------------------------- -virtual at 0 -loc40: - .pTrekData PVOID ? - .pHITS PDOUBLE ? - .nNENHER2 COUNT ? - .nK INDEX ? - .nKK INDEX ? - .dbl_KP DOUBLE ? - .dbl_KPOW DOUBLE ? - .pKPOWER PDOUBLE ? - .pKDIST PDOUBLE ? - .pKX PBYTE ? - .pKY PBYTE ? - .nII BYTE ? - .nJJ BYTE ? - .n1 BYTE ? - .n2 BYTE ? - .dbl_HIT DOUBLE ? - .dbl_WHAM DOUBLE ? - .dbl_DUSTFAC DOUBLE ? - .dbl_1 DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPhasers_HitThem: - mcBeginLocals loc40.size - - mcLoadGameDataPtr edi - mcStoreLocal loc40.pTrekData, edi - mcStoreLocal loc40.pHITS, esi - - movzx eax, [edi + TREKDATA.NENHERE] - mcStoreLocal loc40.nNENHER2, eax - - lea ebx, [edi + TREKDATA.KX] - lea ecx, [edi + TREKDATA.KY] - lea esi, [edi + TREKDATA.KPOWER] - lea eax, [edi + TREKDATA.KDIST] - mcStoreLocal loc40.pKX, ebx - mcStoreLocal loc40.pKY, ecx - mcStoreLocal loc40.pKPOWER, esi - mcStoreLocal loc40.pKDIST, eax - - call TConsole_ScrollUp - - mcLoad1 eax - mcStoreLocal loc40.nKK, eax - mcStoreLocal loc40.nK, eax - -.next_hit: - invoke Sleep, 500 - - mcLoadLocal ecx, loc40.nK - dec ecx - imul ecx, 10 - mcLoadLocal esi, loc40.pHITS - fld tbyte [esi + ecx] - fstp [esp + loc40.dbl_WHAM] - - fldz - fld [esp + loc40.dbl_WHAM] - mc_CMP_ST0_ST1 - jz .L30 - - call TRandom_Ranf - fld [glb_dbl_0dot01] - fmulp - fld [glb_dbl_0dot9] - faddp - fstp [esp + loc40.dbl_DUSTFAC] - - mcLoadLocal ecx, loc40.nKK - dec ecx - imul ecx, 10 - mcLoadLocal esi, loc40.pKDIST - lea edi, [esi + ecx] - mcLoadLocalRef esi, loc40.dbl_DUSTFAC - call TCommon_X_exp_Y - fld [esp + loc40.dbl_WHAM] - fmulp - fstp [esp + loc40.dbl_HIT] - - mcLoadLocal ecx, loc40.nKK - dec ecx - imul ecx, 10 - mcLoadLocal esi, loc40.pKPOWER - fld tbyte [esi + ecx] - fstp [esp + loc40.dbl_KP] - - fld [esp + loc40.dbl_KP] - fabs - fld [esp + loc40.dbl_HIT] - fld st - faddp - call TCommon_FPU_Min - - fld [esp + loc40.dbl_KP] - call TCommon_FPU_SignAB - - fld [esp + loc40.dbl_KP] - fsubrp - fld st - fstp tbyte [esi + ecx] - fstp [esp + loc40.dbl_KPOW] - - mcLoadLocal ecx, loc40.nKK - dec ecx - mcLoadLocal esi, loc40.pKX - mcLoadLocal edi, loc40.pKY - mov al, [esi + ecx] - mov dl, [edi + ecx] - mcStoreLocal loc40.nII, al - mcStoreLocal loc40.nJJ, dl - - call TConsole_SetGameMsgAttr - fld [esp + loc40.dbl_HIT] - fld [glb_dbl_0dot005] - mc_CMP_ST0_ST1 - jc .L10 - - mov ecx, 302 - call TConsole_Cram - jmp .L20 - -.L10: - fld [esp + loc40.dbl_HIT] - mov cl, 2 - call TConsole_CramFloat - - mov ecx, 303 - call TConsole_Cram - -.L20: - mcLoadLocal al, loc40.nII - mcLoadLocal dl, loc40.nJJ - call TConsole_CramEnemyAtEx - call TConsole_ScrollUp - - fldz - fld [esp + loc40.dbl_KPOW] - mc_CMP_ST0_ST1 - jnz .L25 - - mcLoadLocal al, loc40.nII - mcLoadLocal dl, loc40.nJJ - call TPhasers_DeadKlingon - - mcLoadLocal esi, loc40.pTrekData - cmp [esi + TREKDATA.REMKL], 0 - je .game_won - - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - jmp .L40 - -.L25: - fldz - fld [esp + loc40.dbl_KPOW] - mc_CMP_ST0_ST1 - jc .L30 - - fld [glb_dbl_0dot9] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .L30 - - call TRandom_Ranf - fld [glb_dbl_0dot4] - fmulp - fld [glb_dbl_0dot4] - faddp - fld [esp + loc40.dbl_KP] - fmulp - fld [esp + loc40.dbl_KPOW] - mc_CMP_ST0_ST1 - jnc .L30 - - call TConsole_SetCrewMsgAttr - mov ecx, 304 - call TConsole_Cram - - mov cl, 2 - mcLoadLocal al, loc40.nII - mcLoadLocal dl, loc40.nJJ - call TConsole_CramLoc - - call TConsole_ScrollUp - mov ecx, 305 - call TConsole_Prout - - fld [esp + loc40.dbl_KPOW] - fchs - - mcLoadLocal ecx, loc40.nKK - dec ecx - imul ecx, 10 - mcLoadLocal esi, loc40.pKPOWER - fstp tbyte [esi + ecx] - -.L30: - inc [esp + loc40.nKK] - -.L40: - ; - ; Next hit - ; - inc [esp + loc40.nK] - mov ecx, [esp + loc40.nK] - cmp ecx, [esp + loc40.nNENHER2] - jbe .next_hit - jmp .done - -.game_won: - mov al, 1 - call TFinish_Main - -.done: - mcEndLocals loc40.size - ret - -; -------------------------------------------------------------------------- -; PHASERS -; -------------------------------------------------------------------------- -virtual at 0 -loc39: - .pTrekData PVOID ? - .bIFAST BOOL ? - .bIPOOP BOOL ? - .bIDOIT BOOL ? - .bNO BOOL ? - .nK INDEX ? - .nI INDEX ? - .pIWHERE PVOID ? - .nEnemies COUNT ? - .nKEY UINT32 ? - .nKEY1 UINT32 ? - .nKEY2 UINT32 ? - .nIREC UINT32 ? - .pszAITEM PCHAR ? - .dbl_POW DOUBLE ? - .dbl_POWREM DOUBLE ? - .dbl_EXTRA DOUBLE ? - .dbl_TEMP DOUBLE ? - .dbl_PART1 DOUBLE ? - .dbl_PART2 DOUBLE ? - .dbl_HITS_I_ DOUBLE ? - .dbl_OVER DOUBLE ? - .arr_HITS DOUBLES 20 - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPhasers_Main: - mcBeginLocals loc39.size - - call TConsole_SetGameMsgAttr - - mcLoadGameDataPtr esi - mcStoreLocal loc39.pTrekData, esi - - movzx ecx, [esi + TREKDATA.NENHERE] - mcStoreLocal loc39.nEnemies, ecx - - mcZeroBits eax - mcStoreLocal loc39.bIFAST, eax - mcStoreLocal loc39.bNO, eax - mcStoreLocal loc39.nIREC, eax - - inc eax - mcStoreLocal loc39.bIPOOP, eax - mcStoreLocal loc39.bIDOIT, eax - mov [esi + TREKDATA.IDIDIT], al - - mov cl, DEV_SR_SENSORS - call TArray_IsDamaged - adc [esp + loc39.nIREC], 0 - - mov cl, DEV_COMPUTER - call TArray_IsDamaged - adc [esp + loc39.nIREC], 0 - - cmp [esp + loc39.nIREC], 0 - je .check_firing_solution - - dec [esp + loc39.bIPOOP] - -.check_firing_solution: - mcLoadLocal esi, loc39.pTrekData - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .L5 - - mov ecx, 274 - call TConsole_Prout - jmp .L19 - -.L5: - mov cl, DEV_PHASERS - call TArray_IsDamaged - jnc .L10 - - mov ecx, 275 - call TConsole_Prout - jmp .L19 - -.L10: - ; - ; Do checks for hi-speed shield control - ; - mcLoadLocal esi, loc39.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - je .L20 - - mov cl, DEV_SHIELD_CONTROL - call TArray_IsDamaged - jnc .L13 - - mov ecx, 276 - call TConsole_Prout - jmp .L19 - -.L13: - mcLoadLocal esi, loc39.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [glb_dbl_200] - mc_CMP_ST0_ST1 - jc .L16 - - mov ecx, 277 - call TConsole_Prout - -.L19: - dec [esp + loc39.bIDOIT] - - cmp [esp + loc39.bIPOOP], 0 - je .L15 - cmp [esp + loc39.nEnemies], 0 - je .L15 - - mov ecx, 278 - call TConsole_Prout - jmp .L870 - -.L15: - mcLoadLocal esi, loc39.pTrekData - dec [esi + TREKDATA.IDIDIT] - - cmp [esp + loc39.bIFAST], 0 - je .done - - fld [esi + TREKDATA.ENERGY] - fld [glb_dbl_200] - faddp - fstp [esi + TREKDATA.ENERGY] - jmp .done - -.L16: - mcLoadLocal esi, loc39.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [glb_dbl_200] - fsubp - fstp [esi + TREKDATA.ENERGY] - inc [esp + loc39.bIFAST] - -.L20: - ; - ; Read in amount of energy to expend on phaser fire - ; - call TCmdBuf_Scan - mcStoreLocal loc39.pszAITEM, esi - - movzx ecx, [ebx + TCmdBuf.cmdbuf_KEY] - mcStoreLocal loc39.nKEY, ecx - - fld [ebx + TCmdBuf.cmdbuf_FNUM] - fstp [esp + loc39.dbl_POW] - - cmp [esp + loc39.nEnemies], 0 - je .L35 - - mcLoad1 edx - mcStoreLocal loc39.nK, edx - - cmp [esp + loc39.nKEY], CMD_TOKEN_ALPHA - je .L23 - cmp [esp + loc39.nKEY], CMD_TOKEN_REAL - je .L28 - - mcLoadLocal esi, loc39.pszAITEM - mcLoad8bitsToReg32 ecx, 122 - call TCmdBuf_Crop - jnc .L23 - - inc [esp + loc39.bNO] - - call TCmdBuf_Scan - mcStoreLocal loc39.pszAITEM, esi - - movzx ecx, [ebx + TCmdBuf.cmdbuf_KEY] - mcStoreLocal loc39.nKEY, ecx - - fld [ebx + TCmdBuf.cmdbuf_FNUM] - fstp [esp + loc39.dbl_POW] - -.L23: - cmp [esp + loc39.nKEY], CMD_TOKEN_ALPHA - jne .check_devices - - mcLoadLocal esi, loc39.pszAITEM - mcLoad8bitsToReg32 ecx, 165 - call TCmdBuf_Crop - jc .L90 - -.check_devices: - mov cl, DEV_COMPUTER - call TArray_IsDamaged - jc .L80 - - mov cl, DEV_SR_SENSORS - call TArray_IsDamaged - jc .L81 - ; - ; Is KEY = EOL, 'AUTO' or phaser power - ; - cmp [esp + loc39.nKEY], CMD_TOKEN_ALPHA - jne .L2301 - - mcLoadLocal esi, loc39.pszAITEM - mcLoad8bitsToReg32 ecx, 166 - call TCmdBuf_Crop - jc .L27 - jmp .L24 - -.L2301: - ; - ; Differentiate between EOL and phaser power (command mode) - ; - cmp [esp + loc39.nKEY], CMD_TOKEN_EOL - jne .L30 - -.L24: - ; - ; Request MANUAL/AUTO fire - ; - mcLoad8bitsToReg32 ecx, 174 - call TGame_Prompt - call TConsole_SetGameMsgAttr - - call TCmdBuf_Scan - - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - add eax, 0 - js .L15 - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_ALPHA - jne .L24 - - mcLoad8bitsToReg32 ecx, 165 - call TCmdBuf_Crop - jc .L90 - - mcLoad8bitsToReg32 ecx, 166 - call TCmdBuf_Crop - jnc .L24 - -.L2409: - ; - ; Inform user of available energy and read in - ; desired phaser power - ; - cmp [esp + loc39.nEnemies], 0 - je .L26 - - mov ecx, 279 - call TConsole_Cram - -.L25: - mcLoadLocal esi, loc39.pTrekData - mov cl, 2 - fld [esi + TREKDATA.ENERGY] - call TConsole_CramFloat - call TConsole_ScrollUp - - cmp [esp + loc39.bIPOOP], 0 - je .L26 - - mov al, '(' - call TConsole_PutChar - - mcZeroBits eax - mcStoreLocal loc39.nIREC, eax - - inc eax - mcStoreLocal loc39.nK, eax - -.sum_all_power: - call TRandom_Ranf - fld [glb_dbl_0dot05] - fmulp - fld [glb_dbl_1dot01] - faddp - fstp [esp + loc39.dbl_PART2] - - mov esi, glb_dbl_0dot9 - mcLoadLocal ebx, loc39.pTrekData - mcLoadLocal ecx, loc39.nK - dec ecx - imul ecx, 10 - lea edi, [ebx + ecx + TREKDATA.KDIST] - call TCommon_X_exp_Y - fld st - faddp - fstp [esp + loc39.dbl_PART1] - - fld [ebx + ecx + TREKDATA.KPOWER] - fabs - - fld [esp + loc39.dbl_PART1] - fdivp - - fld [esp + loc39.dbl_PART2] - fmulp - - call TCommon_FP_Truncate - inc eax - add [esp + loc39.nIREC], eax - - inc [esp + loc39.nK] - mcLoadLocal ecx, loc39.nK - cmp ecx, [esp + loc39.nEnemies] - jbe .sum_all_power - - mcLoadLocal eax, loc39.nIREC - call TConsole_CramInt - mov ecx, 280 - call TConsole_Prout - -.L26: - mov ecx, 281 - call TGame_Prompt - -.L27: - call TCmdBuf_Scan - - movzx eax, [ebx + TCmdBuf.cmdbuf_KEY] - mcStoreLocal loc39.nKEY, eax - - fld [ebx + TCmdBuf.cmdbuf_FNUM] - fstp [esp + loc39.dbl_POW] - -.L28: - mcLoadLocal eax, loc39.nKEY - mcStoreLocal loc39.nKEY1, eax - - cmp eax, CMD_TOKEN_EOL - je .L2409 - -.L30: - call TCmdBuf_Scan - mcStoreLocal loc39.pszAITEM, esi - - movzx eax, [ebx + TCmdBuf.cmdbuf_KEY] - mcStoreLocal loc39.nKEY2, eax - - mcLoadLocal eax, loc39.nKEY1 - mcStoreLocal loc39.nKEY, eax - - cmp [esp + loc39.nKEY2], CMD_TOKEN_EOL - je .L35 - - mcLoadLocal esi, loc39.pszAITEM - mcLoad8bitsToReg32 ecx, 122 - call TCmdBuf_Crop - jnc .L34 - - inc [esp + loc39.bNO] - jmp .L35 - -.L34: - call TMove_BegPardon - jmp .L15 - -.L35: - cmp [esp + loc39.nKEY], CMD_TOKEN_REAL - jne .L26 - - mcLoadLocal esi, loc39.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [esp + loc39.dbl_POW] - mc_CMP_ST0_ST1 - jc .L41 - - mov ecx, 282 - call TConsole_Cram - jmp .L25 - -.L41: - fld [esp + loc39.dbl_POW] - fld [glb_dbl_5] - mc_CMP_ST0_ST1 - jc .L46 - jz .L46 - - fldz - fld [esp + loc39.dbl_POW] - mc_CMP_ST0_ST1 - jc .L15 - jz .L15 - - mov ecx, 283 - call TConsole_Prout - jmp .L15 - -.L42: - ; - ; Print message for shield control - ; and decide if malfunction occurs - ; - call TConsole_ScrollUp - - fld [glb_dbl_0dot995] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .L45 - ; - ; Malfunction! - ; - call TMove_RedAlert - call TConsole_SetCrewMsgAttr - mov ecx, 284 - call TConsole_Prout - - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mov ecx, 285 - call TConsole_Prout - jmp .done - -.L45: - call TConsole_SetGameMsgAttr - mov ecx, 229 - call TConsole_Prout - jmp [esp + loc39.pIWHERE] - -.L46: - ; - ; Allocate energy among klingons according to - ; nearest first strategy and compute hits - ; - cmp [esp + loc39.bIFAST], 0 - je .L47 - - mov eax, .L47 - mcStoreLocal loc39.pIWHERE, eax - jmp .L42 - -.L47: - mcLoadLocal esi, loc39.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [esp + loc39.dbl_POW] - fsubp - fld st - fstp [esi + TREKDATA.ENERGY] - fstp [esp + loc39.dbl_EXTRA] - - cmp [esp + loc39.nEnemies], 0 - je .L75 - ; - ; Loop that distribute hits in automatic mode - ; - fldz - fstp [esp + loc39.dbl_EXTRA] - - fld [esp + loc39.dbl_POW] - fstp [esp + loc39.dbl_POWREM] - - mcLoad1 eax - mcStoreLocal loc39.nI, eax - -.compute_hit: - fldz - fstp [esp + loc39.dbl_HITS_I_] - - fldz - fld [esp + loc39.dbl_POWREM] - mc_CMP_ST0_ST1 - jc .L50 - jz .L50 - - mcLoadLocal ebx, loc39.pTrekData - mcLoadLocal ecx, loc39.nI - dec ecx - imul ecx, 10 - lea edi, [ebx + ecx + TREKDATA.KDIST] - mov esi, glb_dbl_0dot9 - call TCommon_X_exp_Y - fld st - faddp - - fld [ebx + ecx + TREKDATA.KPOWER] - fabs - fdivrp - fld st - fstp [esp + loc39.dbl_HITS_I_] - fstp [esp + ecx + loc39.arr_HITS] - - call TRandom_Ranf - fld [glb_dbl_0dot05] - fmulp - fld [glb_dbl_0dot01] - faddp - fld [esp + loc39.dbl_HITS_I_] - fmulp - fstp [esp + loc39.dbl_OVER] - - fld [esp + loc39.dbl_POWREM] - fstp [esp + loc39.dbl_TEMP] - - fld [esp + loc39.dbl_POWREM] - fld [esp + loc39.dbl_HITS_I_] - fsubp - fld [esp + loc39.dbl_OVER] - fsubp - fld st - fstp [esp + loc39.dbl_POWREM] - - fldz - mc_CMP_ST0_ST1 - jc .extra_plus_over - - fld [esp + loc39.dbl_TEMP] - fld [esp + loc39.dbl_HITS_I_] - call TCommon_FPU_Min - fstp [esp + loc39.dbl_HITS_I_] - - fldz - fstp [esp + loc39.dbl_OVER] - - mcLoadLocal ecx, loc39.nI - dec ecx - imul ecx, 10 - fld [esp + loc39.dbl_HITS_I_] - fstp [esp + ecx + loc39.arr_HITS] - -.extra_plus_over: - fld [esp + loc39.dbl_EXTRA] - fld [esp + loc39.dbl_OVER] - faddp - fstp [esp + loc39.dbl_EXTRA] - -.L50: - inc [esp + loc39.nI] - mov ecx, [esp + loc39.nI] - cmp ecx, [esp + loc39.nEnemies] - jbe .compute_hit - - fldz - fld [esp + loc39.dbl_POWREM] - mc_CMP_ST0_ST1 - jc .hit_them - jz .hit_them - - fld [esp + loc39.dbl_EXTRA] - fld [esp + loc39.dbl_POWREM] - faddp - fstp [esp + loc39.dbl_EXTRA] - -.hit_them: - mcLoadLocalRef esi, loc39.arr_HITS - call TPhasers_HitThem - - fldz - fld [esp + loc39.dbl_EXTRA] - mc_CMP_ST0_ST1 - jz .L200 - - mcLoadLocal esi, loc39.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - jne .L200 - -.L75: - ; - ; Inform of overkill - ; - mcLoadLocal esi, loc39.pTrekData - cmp [esi + TREKDATA.ITHERE], 0 - je .L78 - - call TConsole_SetGameMsgAttr - mov ecx, 286 - call TConsole_Cram - - cmp [esp + loc39.nEnemies], 0 - je .L7501 - - mov ecx, 287 - call TConsole_Cram - -.L7501: - mov ecx, 288 - call TConsole_Prout - jmp .L200 - -.L78: - call TConsole_SetGameMsgAttr - mov cl, 2 - fld [esp + loc39.dbl_EXTRA] - call TConsole_CramFloat - mov ecx, 289 - call TConsole_Prout - jmp .L200 - -.L80: - ; - ; Manual section begins here. - ; Inform of imposed manual condition. - ; - call TConsole_SetGameMsgAttr - mov ecx, 299 - call TConsole_Prout - jmp .L84 - -.L81: - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - mov ecx, 290 - call TConsole_Prout - mov ecx, 291 - call TConsole_Prout - mov ecx, 292 - call TConsole_Prout - mov ecx, 293 - call TConsole_Prout - call TConsole_ScrollUp - -.L84: - call TConsole_SetGameMsgAttr - mov ecx, 282 - call TConsole_Cram - - mov cl, 2 - mcLoadLocal esi, loc39.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [glb_dbl_0dot006] - fsubp - call TConsole_CramFloat - call TConsole_ScrollUp - -.L870: - ; - ; Loop for desired individual hits - ; - mcLoad1 eax - mcStoreLocal loc39.nK, eax - -.L87: - mov cl, ATTR_PROMPT_TEXT - call TConsole_SetAttr - - cmp [esp + loc39.bIPOOP], 0 - je .L88 - ; - ; Print battle computer recommendation - ; - mov al, '(' - call TConsole_PutChar - - call TRandom_Ranf - fld [glb_dbl_0dot05] - fmulp - fld [glb_dbl_1dot01] - faddp - fstp [esp + loc39.dbl_PART2] - - mov esi, glb_dbl_0dot9 - mcLoadLocal ebx, loc39.pTrekData - mcLoadLocal ecx, loc39.nK - dec ecx - imul ecx, 10 - lea edi, [ebx + ecx + TREKDATA.KDIST] - call TCommon_X_exp_Y - fld st - faddp - fstp [esp + loc39.dbl_PART1] - - fld [ebx + ecx + TREKDATA.KPOWER] - fabs - - fld [esp + loc39.dbl_PART1] - fdivp - - fld [esp + loc39.dbl_PART2] - fmulp - - call TCommon_FP_Truncate - inc eax - call TConsole_CramInt - - mov ecx, 300 - call TConsole_Cram - -.L88: - mov ecx, 294 - call TConsole_Cram - - mcLoadLocal ecx, loc39.nK - mcLoadLocal ebx, loc39.pTrekData - dec ecx - lea esi, [ebx + TREKDATA.KX] - lea edi, [ebx + TREKDATA.KY] - mov al, [esi + ecx] - mov dl, [edi + ecx] - call TConsole_CramEnemyAtEx - - cmp [esp + loc39.bIDOIT], 1 - je .L89 - ; - ; Phasers can't actually be fired - loop back for - ; next computer readout or terminate if that's all. - ; - call TConsole_ScrollUp - - inc [esp + loc39.nK] - mov ecx, [esp + loc39.nK] - cmp ecx, [esp + loc39.nEnemies] - jbe .L87 - jmp .L15 - -.L89: - mov ecx, 301 - call TGame_Prompt - -.L90: - cmp [esp + loc39.nK], 1 - jne .scan_hit - - fldz - fstp [esp + loc39.dbl_POW] - -.scan_hit: - call TCmdBuf_Scan - - fld [ebx + TCmdBuf.cmdbuf_FNUM] - mcLoadLocal ecx, loc39.nK - dec ecx - imul ecx, 10 - fld st - fstp [esp + ecx + loc39.arr_HITS] - fstp [esp + loc39.dbl_HITS_I_] - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - je .L95 - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - jne .L91 - - cmp [esp + loc39.nK], 1 - je .L84 - jmp .L87 - -.L91: - mcLoad8bitsToReg32 ecx, 122 - call TCmdBuf_Crop - jnc .L84 - - inc [esp + loc39.bNO] - jmp .L90 - -.L95: - fldz - fld [esp + loc39.dbl_HITS_I_] - mc_CMP_ST0_ST1 - jc .L15 - - fld [esp + loc39.dbl_POW] - fld [esp + loc39.dbl_HITS_I_] - faddp - fstp [esp + loc39.dbl_POW] - ; - ; If total amount is too much, then - ; inform and start over. - ; - mcLoadLocal esi, loc39.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [esp + loc39.dbl_POW] - mc_CMP_ST0_ST1 - jc .L97 - - call TConsole_SetGameMsgAttr - mov ecx, 295 - call TConsole_Prout - jmp .L84 - -.L97: - inc [esp + loc39.nK] - mov ecx, [esp + loc39.nK] - cmp ecx, [esp + loc39.nEnemies] - jbe .L90 - ; - ; If total requested is 0.0 - abort phasers. - ; - fldz - fld [esp + loc39.dbl_POW] - mc_CMP_ST0_ST1 - jz .L15 - - call TCmdBuf_Scan - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_ALPHA - jne .L9701 - - mcLoad8bitsToReg32 ecx, 122 - call TCmdBuf_Crop - adc [esp + loc39.bNO], 0 - -.L9701: - mcLoadLocal esi, loc39.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [esp + loc39.dbl_POW] - fsubp - fstp [esi + TREKDATA.ENERGY] - - cmp [esp + loc39.bIFAST], 0 - je .L98 - - mov eax, .L98 - mcStoreLocal loc39.pIWHERE, eax - jmp .L42 - -.L98: - mcLoadLocalRef esi, loc39.arr_HITS - call TPhasers_HitThem - - mcLoadLocal edi, loc39.pTrekData - inc [edi + TREKDATA.IDIDIT] - -.L200: - ; - ; Raising shields after phaser fire. - ; - mcLoadLocal esi, loc39.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - - cmp [esp + loc39.bIFAST], 0 - je .L210 - - call TConsole_ScrollUp - cmp [esp + loc39.bNO], 0 - jne .L202 - - fld [glb_dbl_0dot99] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .L205 - - call TConsole_SetCrewMsgAttr - mov ecx, 296 - call TConsole_Prout - mov ecx, 297 - call TConsole_Prout - -.L202: - mcLoadLocal edi, loc39.pTrekData - mov [edi + TREKDATA.SHLDUP], 0 - jmp .L210 - -.L205: - call TConsole_SetGameMsgAttr - mov ecx, 228 - call TConsole_Prout - -.L210: - ; - ; Check for phaser overheat - ; - fld [glb_dbl_1500] - fld [esp + loc39.dbl_POW] - mc_CMP_ST0_ST1 - jc .done - jz .done - - fld [esp + loc39.dbl_POW] - fld [glb_dbl_1500] - fsubp - fld [glb_dbl_0dot00038] - fmulp - fstp [esp + loc39.dbl_TEMP] - - call TRandom_Ranf - fld [esp + loc39.dbl_TEMP] - mc_CMP_ST0_ST1 - jc .done - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mov ecx, 298 - call TConsole_Prout - - call TRandom_Ranf - fld1 - faddp - fld [esp + loc39.dbl_TEMP] - fld1 - faddp - fmulp - mcLoadLocal esi, loc39.pTrekData - fld [esi + TREKDATA.DAMFAC] - fmulp - mov cl, DEV_PHASERS - call TArray_SetDblDamage - -.done: - mcEndLocals loc39.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TPhotons.Asm b/programs/games/StarTrek/trunk/TPhotons.Asm deleted file mode 100644 index 78e56def10..0000000000 --- a/programs/games/StarTrek/trunk/TPhotons.Asm +++ /dev/null @@ -1,1571 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TPhotons.Asm -; DATE: November 1, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; EAX = sector coordinate (X or Y) -; Output: -; CF=1 if EAX is in range [1..10] -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPhotons_IsValidSector: - cmp eax, 1 - jb .invalid - cmp eax, 10 - ja .invalid - - stc - ret - -.invalid: - clc - ret - -; -------------------------------------------------------------------------- -; PHOTONS -; -------------------------------------------------------------------------- -virtual at 0 -loc44: - .pTrekData PVOID ? - .pdbl_KPower PDOUBLE ? - .nN COUNT ? - .nTubes COUNT ? - .bIHURT BOOL ? - .nI INDEX ? - .nJ INDEX ? - .nLL INDEX ? - .nL INDEX ? - .nJX INT32 ? - .nJY INT32 ? - .torp_IX INT32 ? - .torp_IY INT32 ? - .byte_IX BYTE ? - .byte_IY BYTE ? - .byte_STARTX BYTE ? - .byte_STARTY BYTE ? - .arr_TARGX INTEGERS 6 - .arr_TARGY INTEGERS 6 - ; - ; I have added here another 3 DOUBLE values (30 bytes) to "improve" the game. - ; However, that caused a misalignment of the local variables, which - ; in turn caused the failure of a Sleep API!! (MORALE: Always align the stack!) - ; Thanks to 'Clerk' from WASM.RU forum I was able to fix the issue. - ; - .arr_COURSE DOUBLES 6 - .dbl_R DOUBLE ? - .dbl_AC DOUBLE ? - .dbl_TEMP DOUBLE ? - .dbl_DELTX DOUBLE ? - .dbl_DELTY DOUBLE ? - .dbl_HIT DOUBLE ? - .dbl_ANGLE DOUBLE ? - .dbl_DELTAX DOUBLE ? - .dbl_DELTAY DOUBLE ? - .dbl_BIGGER DOUBLE ? - .dbl_SINANG DOUBLE ? - .dbl_X DOUBLE ? - .dbl_Y DOUBLE ? - .dbl_DIST DOUBLE ? - .dbl_DISTN DOUBLE ? - .dbl_KP DOUBLE ? - .dbl_ANG DOUBLE ? - .dbl_SPRANG DOUBLE ? - .dbl_BETA DOUBLE ? - .ch_IQUAD CHAR ? - .ch_reserved CHAR ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPhotons_Main: - mcBeginLocals loc44.size - call TConsole_SetGameMsgAttr - - mcLoadGameDataPtr esi - mcStoreLocal loc44.pTrekData, esi - ; - ; Check torpedo count and status of photon tubes - ; - mov [esi + TREKDATA.IDIDIT], 1 - mov [esi + TREKDATA.KSHOT], 0 - - movzx ecx, [esi + TREKDATA.NPTUBES] - mcStoreLocal loc44.nTubes, ecx - - mov cl, DEV_PHOTON_TUBES - call TArray_IsDamaged - jnc .L10 - - mov ecx, 340 - call TConsole_Prout - jmp .L3005 - -.L10: - mcLoadLocal esi, loc44.pTrekData - cmp [esi + TREKDATA.TORPS], 0 - jne .L15 - - mov ecx, 341 - call TConsole_Prout - jmp .L3005 - -.L15: - call TCmdBuf_Scan - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mcStoreLocal loc44.nN, eax - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - je .L30 - -.L16: - mcLoadLocal esi, loc44.pTrekData - movzx eax, [esi + TREKDATA.TORPS] - call TConsole_CramInt - - mov ecx, 342 - call TConsole_Prout - - mov ecx, 343 - call TGame_Prompt - jmp .L15 - -.L30: - mcLoadLocal eax, loc44.nN - cmp eax, 0 - jle .L3005 - cmp eax, [esp + loc44.nTubes] - jle .L31 - - mov ecx, 344 - call TConsole_Cram - mcLoadLocal esi, loc44.pTrekData - movzx eax, [esi + TREKDATA.NPTUBES] - call TConsole_CramInt - mov ecx, 704 - call TConsole_Prout - jmp .L16 - -.L3004: - call TMove_BegPardon - -.L3005: - mcLoadLocal edi, loc44.pTrekData - dec [edi + TREKDATA.IDIDIT] - jmp KPHOTON.done - -.L31: - mcLoadLocal esi, loc44.pTrekData - mcLoadLocal eax, loc44.nN - cmp al, [esi + TREKDATA.TORPS] - jle .L32 - jmp .L16 - -.L3101: - ; - ; All torpedoes fired at same spot - ; - cmp [esp + loc44.nN], 1 - je .L36 - - mcLoadLocalRef esi, loc44.arr_TARGX - mcLoadLocalRef edi, loc44.arr_TARGY - - mov eax, [esi] - mov edx, [edi] - mov [esi + 4], eax - mov [edi + 4], edx - - cmp [esp + loc44.nN], 2 - je .L36 - - mov [esi + 8], eax - mov [edi + 8], edx - jmp .L36 - -.L32: - ; - ; Read in target sectors - ; - mcLoad1 eax - mcStoreLocal loc44.nI, eax - -.scan_next_target: - call TCmdBuf_Scan - - mcLoadLocal ecx, loc44.nI - dec ecx - mcLoadLocalRef esi, loc44.arr_TARGX - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mov [esi + ecx*4], eax - ; - ; IF ((I == 1) AND (CMD == EOL)) GOTO 34 - ; - cmp [esp + loc44.nI], 1 - jne .L3201 - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .L34 - -.L3201: - ; - ; IF ((I == 2) AND (CMD == EOL)) GOTO 3101 - ; - cmp [esp + loc44.nI], 2 - jne .L3202 - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .L3101 - -.L3202: - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L3004 - - call TCmdBuf_Scan - - mcLoadLocal ecx, loc44.nI - dec ecx - mcLoadLocalRef esi, loc44.arr_TARGY - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mov [esi + ecx*4], eax - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L3004 - - inc [esp + loc44.nI] - mov ecx, [esp + loc44.nI] - cmp ecx, [esp + loc44.nN] - jbe .scan_next_target - jmp .L36 - -.L34: - mcLoad1 eax - mcStoreLocal loc44.nI, eax - -.ask_target_sector: - mov cl, ATTR_PROMPT_TEXT - call TConsole_SetAttr - - mov ecx, 345 - call TConsole_Cram - - mcLoadLocal eax, loc44.nI - call TConsole_CramInt - - mov ecx, 301 - call TGame_Prompt - - call TCmdBuf_Scan - - mcLoadLocal ecx, loc44.nI - dec ecx - mcLoadLocalRef esi, loc44.arr_TARGX - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mov [esi + ecx*4], eax - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L3004 - - call TCmdBuf_Scan - - mcLoadLocal ecx, loc44.nI - dec ecx - mcLoadLocalRef esi, loc44.arr_TARGY - mov eax, [ebx + TCmdBuf.cmdbuf_INUM] - mov [esi + ecx*4], eax - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - jne .L3004 - - inc [esp + loc44.nI] - mov ecx, [esp + loc44.nI] - cmp ecx, [esp + loc44.nN] - jbe .ask_target_sector - -.L36: - ; - ; Check for invalid targets - ; - mcLoadLocal ecx, loc44.nN - mcLoadLocalRef esi, loc44.arr_TARGX - mcLoadLocalRef edi, loc44.arr_TARGY - -.validate_sector: - mov eax, [edi] - add edi, 4 - - add eax, 0 - js .L3005 - - call TPhotons_IsValidSector - jnc .L3004 - - lodsd - - add eax, 0 - js .L3005 - - call TPhotons_IsValidSector - jnc .L3004 - - loop .validate_sector - ; - ; Compute course for each torpedo - ; - mcLoad1 eax - mcStoreLocal loc44.nI, eax - -.next_course: - mcLoadLocal ecx, loc44.nI - dec ecx - - mcLoadLocalRef esi, loc44.arr_TARGY - mov eax, [esi + ecx*4] - - mcLoadLocal ebx, loc44.pTrekData - movzx edx, [ebx + TREKDATA.SECTY] - - sub eax, edx - call TCommon_FPU_Load_EAX - fld [glb_dbl_0dot1] - fmulp - fstp [esp + loc44.dbl_DELTX] - - mcLoadLocalRef esi, loc44.arr_TARGX - mov edx, [esi + ecx*4] - movzx eax, [ebx + TREKDATA.SECTX] - - sub eax, edx - call TCommon_FPU_Load_EAX - fld [glb_dbl_0dot1] - fmulp - fstp [esp + loc44.dbl_DELTY] - ; - ; Do not shoot the ENTERPRISE! - ; - fld [esp + loc44.dbl_DELTX] - fldz - mc_CMP_ST0_ST1 - jnz .L40 - - fld [esp + loc44.dbl_DELTY] - fldz - mc_CMP_ST0_ST1 - jnz .L40 - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mov ecx, 346 - call TConsole_Prout - mov ecx, 347 - call TConsole_Prout - mov ecx, 348 - call TConsole_Prout - jmp .L3005 - -.L40: - fld [esp + loc44.dbl_DELTX] - fld [esp + loc44.dbl_DELTY] - fpatan - fld [glb_dbl_1dot90985932] - fmulp - mcLoadLocal ecx, loc44.nI - dec ecx - imul ecx, 10 - mcLoadLocalRef edi, loc44.arr_COURSE - fstp tbyte [edi + ecx] - - inc [esp + loc44.nI] - mov ecx, [esp + loc44.nI] - cmp ecx, [esp + loc44.nN] - jbe .next_course - ; - ; Begin outer loop for moving torpedoes - ; - mcZeroBits eax - mcStoreLocal loc44.nI, eax - -.L50: - inc [esp + loc44.nI] - mov ecx, [esp + loc44.nI] - cmp ecx, [esp + loc44.nN] - ja KPHOTON.L115 - - mcLoadLocal esi, loc44.pTrekData - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - je .L50001 - - dec [esi + TREKDATA.TORPS] - jnz .L50001 - - mov [esi + TREKDATA.QTORPS], 0 - -.L50001: - ; - ; J=I - ; - mcLoadLocal eax, loc44.nI - mcStoreLocal loc44.nJ, eax - - mov al, [esi + TREKDATA.SECTX] - mov dl, [esi + TREKDATA.SECTY] - mcStoreLocal loc44.byte_STARTX, al - mcStoreLocal loc44.byte_STARTY, dl - - call TRandom_Ranf - call TRandom_Ranf - faddp - fld [glb_dbl_0dot5] - fmulp - fld [glb_dbl_0dot5] - fsubp - fstp [esp + loc44.dbl_R] - - fld [glb_dbl_0dot49] - fld [esp + loc44.dbl_R] - fabs - mc_CMP_ST0_ST1 - jc .L5709 - - call TRandom_Ranf - fld [glb_dbl_1dot2] - faddp - fld [esp + loc44.dbl_R] - fmulp - fstp [esp + loc44.dbl_R] - ; - ; Torpedo misfires - ; - mov cl, ATTR_HIT_DAMAGE - call TConsole_SetAttr - - cmp [esp + loc44.nN], 1 - ja .L5706 - - mov ecx, 349 - call TConsole_Prout - jmp .L5707 - -.L5706: - mov ecx, 350 - call TConsole_Cram - mcLoadLocal eax, loc44.nI - call TConsole_CramInt - mov ecx, 351 - call TConsole_Prout - - mov eax, [esp + loc44.nI] - cmp eax, [esp + loc44.nN] - je .abort_burst - - mov ecx, 352 - call TConsole_Prout - -.abort_burst: - mcLoadLocal eax, loc44.nN - mcStoreLocal loc44.nI, eax - -.L5707: - call TRandom_Ranf - fld [glb_dbl_0dot2] - mc_CMP_ST0_ST1 - jc .L5709 - - call TRandom_Ranf - fld st - faddp - fld1 - faddp - mcLoadLocal esi, loc44.pTrekData - fld [esi + TREKDATA.DAMFAC] - fmulp - mov cl, DEV_PHOTON_TUBES - call TArray_SetDblDamage - jmp KPHOTON.L115 - -.increase_deflection: - fld [esp + loc44.dbl_R] - fld [esi + TREKDATA.SHLD] - fmulp - fld [glb_dbl_0dot001] - fmulp - fld [esp + loc44.dbl_R] - faddp - fstp [esp + loc44.dbl_R] - jmp .calc_AC - -.L5709: - mcLoadLocal esi, loc44.pTrekData - cmp [esi + TREKDATA.QTORPS], 1 - je .calc_quantum_R - cmp [esi + TREKDATA.SHLDUP], 0 - jne .increase_deflection - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - je .increase_deflection - jmp .calc_AC - -.calc_quantum_R: - call TRandom_Ranf - fld [glb_dbl_0dot15] - fmulp - fstp [esp + loc44.dbl_R] - -.calc_AC: - mcLoadLocal ecx, loc44.nI - dec ecx - imul ecx, 10 - mcLoadLocalRef edi, loc44.arr_COURSE - fld [glb_dbl_DOCKFAC] - fld [esp + loc44.dbl_R] - fmulp - fld tbyte [edi + ecx] - faddp - fstp [esp + loc44.dbl_AC] - jmp KPHOTON.L5710 - -KPHOTON: - ; - ; Enemy fires photon torpedo! - ; - mcBeginLocals loc44.size - - mcLoadGameDataPtr esi - mcStoreLocal loc44.pTrekData, esi - - movzx ecx, [esi + TREKDATA.KSHOT] - dec ecx - lea edi, [esi + TREKDATA.KY] - add esi, TREKDATA.KX - mov al, [esi + ecx] - mov dl, [edi + ecx] - mcStoreLocal loc44.byte_IX, al - mcStoreLocal loc44.byte_IY, dl - mcStoreLocal loc44.byte_STARTX, al - mcStoreLocal loc44.byte_STARTY, dl - - mcLoad1 eax - mcStoreLocal loc44.nI, eax - mcStoreLocal loc44.nN, eax - - mcLoadLocal esi, loc44.pTrekData - mov al, [esi + TREKDATA.SECTY] - sub al, [esp + loc44.byte_STARTY] - movsx eax, al - call TCommon_FPU_Load_EAX - fld [glb_dbl_0dot1] - fmulp - fstp [esp + loc44.dbl_DELTX] - - mov al, [esp + loc44.byte_STARTX] - sub al, [esi + TREKDATA.SECTX] - movsx eax, al - call TCommon_FPU_Load_EAX - fld [glb_dbl_0dot1] - fmulp - fstp [esp + loc44.dbl_DELTY] - - fld [esp + loc44.dbl_DELTX] - fld [esp + loc44.dbl_DELTY] - fpatan - fld [glb_dbl_1dot90985932] - fmulp - fstp [esp + loc44.dbl_AC] - - call TRandom_Ranf - fld [glb_dbl_0dot5] - fsubp - fstp [esp + loc44.dbl_TEMP] - - mcLoadLocal esi, loc44.pTrekData - movzx ecx, [esi + TREKDATA.KSHOT] - dec ecx - imul ecx, 10 - lea ebx, [esi + TREKDATA.KPOWER] - fld tbyte [ebx + ecx] - fld [glb_dbl_0dot001] - fmulp - fld1 - faddp - fld [esp + loc44.dbl_TEMP] - fmulp - - call TRandom_Ranf - fld [esp + loc44.dbl_TEMP] - fmulp - faddp - fld st - fstp [esp + loc44.dbl_R] - - fld [glb_dbl_DOCKFAC] - fmulp - fld [esp + loc44.dbl_AC] - faddp - fstp [esp + loc44.dbl_AC] - - call TConsole_SetGameMsgAttr - mcLoadLocal al, loc44.byte_IX - mcLoadLocal dl, loc44.byte_IY - call TConsole_CramEnemyAtEx - mov ecx, 354 - call TConsole_Prout - ; - ; Check for klingon misfire - ; - fld [glb_dbl_0dot45] - fld [esp + loc44.dbl_TEMP] - fabs - mc_CMP_ST0_ST1 - jc .L5710 - ; - ; Enemy torpedo misfired. Determine damage. - ; - fld [glb_dbl_15] - fld [esp + loc44.dbl_AC] - fsubp - fld [glb_dbl_0dot5235988] - fmulp - fstp [esp + loc44.dbl_ANGLE] - - call TRandom_Ranf - fld [glb_dbl_600] - fmulp - fld [glb_dbl_200] - faddp - fstp [esp + loc44.dbl_HIT] - - mcLoadLocal esi, loc44.pTrekData - movzx ecx, [esi + TREKDATA.KSHOT] - mcStoreLocal loc44.nLL, ecx - ; - ; BUG FIX! Set these members as if torpedo hit him! - ; - dec ecx - movzx eax, [esi + ecx + TREKDATA.KX] - movzx edx, [esi + ecx + TREKDATA.KY] - mcStoreLocal loc44.torp_IX, eax - mcStoreLocal loc44.torp_IY, edx - - call TArray_QuadPtr - mov al, [ebx] - mcStoreLocal loc44.ch_IQUAD, al - - mov ecx, 355 - call TConsole_Prout - jmp .L68 - -.L5710: - fld [glb_dbl_15] - fld [esp + loc44.dbl_AC] - fsubp - fld [glb_dbl_0dot5235988] - fmulp - fstp [esp + loc44.dbl_ANGLE] - - call TConsole_SetGameMsgAttr - cmp [esp + loc44.nN], 1 - je .L58 - - call TConsole_ScrollUp - mov ecx, 356 - call TConsole_Cram - mcLoadLocal eax, loc44.nJ - call TConsole_CramInt - -.L5720: - mov ecx, 357 - call TConsole_Cram - jmp .L59 - -.L58: - call TConsole_ScrollUp - mov ecx, 358 - call TConsole_Cram - -.L59: - fld [esp + loc44.dbl_ANGLE] - fld st - fsin - fchs - fstp [esp + loc44.dbl_DELTAX] - fcos - fstp [esp + loc44.dbl_DELTAY] - - fld [esp + loc44.dbl_DELTAX] - fabs - fld [esp + loc44.dbl_DELTAY] - fabs - call TCommon_FPU_Max - fstp [esp + loc44.dbl_BIGGER] - - fld [esp + loc44.dbl_DELTAX] - fld [esp + loc44.dbl_BIGGER] - fdivp - fstp [esp + loc44.dbl_DELTAX] - - fld [esp + loc44.dbl_DELTAY] - fld [esp + loc44.dbl_BIGGER] - fdivp - fstp [esp + loc44.dbl_DELTAY] - - mov al, [esp + loc44.byte_STARTX] - call TCommon_LoadByteIntoFPU - fstp [esp + loc44.dbl_X] - - mov al, [esp + loc44.byte_STARTY] - call TCommon_LoadByteIntoFPU - fstp [esp + loc44.dbl_Y] - ; - ; Begin inner loop for moving a single torpedo - ; - mcZeroBits eax - mcStoreLocal loc44.nL, eax - -.L5910: - inc [esp + loc44.nL] - ; - ; X += DELTAX - ; - fld [esp + loc44.dbl_X] - fld [esp + loc44.dbl_DELTAX] - faddp - fld st - fstp [esp + loc44.dbl_X] - frndint - call TCommon_FP_Truncate - mcStoreLocal loc44.torp_IX, eax - - cmp eax, 1 - jl .L105 - cmp eax, 10 - jg .L105 - ; - ; Y += DELTAY - ; - fld [esp + loc44.dbl_Y] - fld [esp + loc44.dbl_DELTAY] - faddp - fld st - fstp [esp + loc44.dbl_Y] - frndint - call TCommon_FP_Truncate - mcStoreLocal loc44.torp_IY, eax - - cmp eax, 1 - jl .L105 - cmp eax, 10 - jg .L105 - ; - ; Check if new line must be done in track. - ; - cmp [esp + loc44.nL], 4 - je .new_line - cmp [esp + loc44.nL], 9 - jne .print_track - -.new_line: - call TConsole_ScrollUp - -.print_track: - mov cl, 1 - fld [esp + loc44.dbl_X] - call TConsole_CramFloat - - mcLoad8bitsToReg32 ecx, 59 - call TConsole_Cram - - mov cl, 1 - fld [esp + loc44.dbl_Y] - call TConsole_CramFloat - - mov cl, 3 - call TConsole_RepeatBlank - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TArray_QuadPtr - mov al, [ebx] - mcStoreLocal loc44.ch_IQUAD, al - - cmp al, CHAR_COSMOS - je .L5910 - - call TConsole_ScrollUp - invoke Sleep, 800 - ; - ; Begin hit checks. - ; - movzx ecx, [esp + loc44.byte_STARTX] - sub ecx, [esp + loc44.torp_IX] - imul ecx, ecx - - movzx eax, [esp + loc44.byte_STARTY] - sub eax, [esp + loc44.torp_IY] - imul eax, eax - - add eax, ecx - call TCommon_FPU_Load_EAX - fsqrt - fstp [esp + loc44.dbl_DIST] - - mov eax, [esp + loc44.torp_IY] - movzx ecx, [esp + loc44.byte_STARTY] - sub eax, ecx - call TCommon_FPU_Load_EAX - fld [glb_dbl_0dot1] - fmulp - fstp [esp + loc44.dbl_DELTX] - - mov ecx, [esp + loc44.torp_IX] - movzx eax, [esp + loc44.byte_STARTX] - sub eax, ecx - call TCommon_FPU_Load_EAX - fld [glb_dbl_0dot1] - fmulp - fstp [esp + loc44.dbl_DELTY] - ; - ; BULSEYE - ; - fld [esp + loc44.dbl_DELTX] - fld [esp + loc44.dbl_DELTY] - fpatan - fld [glb_dbl_1dot90985932] - fmulp - fld [glb_dbl_15] - fsubrp - fld [glb_dbl_0dot5235988] - fmulp - fld [esp + loc44.dbl_ANGLE] - fsubrp - fsin - fld st - fstp [esp + loc44.dbl_SINANG] - - fabs - fld [esp + loc44.dbl_DIST] - fmulp - fstp [esp + loc44.dbl_DISTN] - ; - ; HIT=(700.0 + 100*RANF(0)) - DISTN*1000.0 - ; - call TRandom_Ranf - fld [glb_dbl_100] - fmulp - fld [glb_dbl_700] - faddp - - fld [esp + loc44.dbl_DISTN] - fld [glb_dbl_1000] - fmulp - fsubp - fstp [esp + loc44.dbl_HIT] - ; - ; Quantum warhead packs a punch! - ; - mcLoadLocal esi, loc44.pTrekData - cmp [esi + TREKDATA.QTORPS], 1 - jne .check_object_type - cmp [esi + TREKDATA.KSHOT], 0 - jne .check_object_type - - call TRandom_Ranf - fld [glb_dbl_700] - fmulp - fld [glb_dbl_700] - faddp - fld [esp + loc44.dbl_HIT] - faddp - fstp [esp + loc44.dbl_HIT] - ; - ; Test for a type of object hit by torpedo - ; -.check_object_type: - mcLoadLocal al, loc44.ch_IQUAD - mcOnRegEqu al, CHAR_KLINGON, .L62 - mcOnRegEqu al, CHAR_ROMULAN, .L62 - mcOnRegEqu al, CHAR_COMMANDER, .check_anti_photon - mcOnRegEqu al, CHAR_SCOM, .check_anti_photon - jmp .L70 - -.check_anti_photon: - call TRandom_Ranf - fld [glb_dbl_0dot05] - mc_CMP_ST0_ST1 - jc .L62 - - call TConsole_SetGameMsgAttr - mov cl, 2 - mcLoadLocal bl, loc44.ch_IQUAD - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TConsole_CramEnemyAt - mov ecx, 360 - call TConsole_Prout - mov ecx, 361 - call TConsole_Prout - jmp TPhotons_Main.L50 - -.L62: - mcLoadLocal ebx, loc44.pTrekData - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - movzx ecx, [ebx + TREKDATA.NENHERE] - - mcZeroBits eax - mcStoreLocal loc44.nLL, eax - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - -.find_klingon: - inc [esp + loc44.nLL] - - cmp al, [esi] - jne .next_klingon - - cmp dl, [edi] - je .L68 - -.next_klingon: - inc esi - inc edi - loop .find_klingon - - ;int 3 - jmp .done - -.L68: - mcLoadLocal ecx, loc44.nLL - call TArray_KlingonPowerPtr - mcStoreLocal loc44.pdbl_KPower, edx - fld tbyte [edx] - fstp [esp + loc44.dbl_KP] - - fld [esp + loc44.dbl_KP] - fabs - fld [esp + loc44.dbl_HIT] - call TCommon_FPU_Min - - fld [esp + loc44.dbl_KP] - call TCommon_FPU_SignAB - - fld [esp + loc44.dbl_KP] - fsubrp - mcLoadLocal edi, loc44.pdbl_KPower - fld st - fstp tbyte [edi] - - fldz - mc_CMP_ST0_ST1 - jnz .L69 - - mcLoadLocal ecx, loc44.nLL - dec ecx - mcLoadLocal ebx, loc44.pTrekData - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - mov al, [esi + ecx] - mov dl, [edi + ecx] - call TPhasers_DeadKlingon - jmp TPhotons_Main.L50 - -.L69: - call TConsole_SetGameMsgAttr - mov cl, 2 - mcLoadLocal bl, loc44.ch_IQUAD - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TConsole_CramEnemyAt - -.L6901: - ; - ; If enemy damaged, but not destroyed - try - ; to displace him. - ; - call TRandom_Ranf - fld [glb_dbl_0dot5] - fsubp - fld [glb_dbl_2dot5] - fmulp - fld [esp + loc44.dbl_ANGLE] - faddp - fstp [esp + loc44.dbl_ANG] - - fld [esp + loc44.dbl_ANG] - fcos - fabs - fld [esp + loc44.dbl_ANG] - fsin - fabs - call TCommon_FPU_Max - fstp [esp + loc44.dbl_TEMP] - - fld [esp + loc44.dbl_ANG] - fsin - fchs - fld [esp + loc44.dbl_TEMP] - fdivp - fstp [esp + loc44.dbl_X] - - fld [esp + loc44.dbl_ANG] - fcos - fld [esp + loc44.dbl_TEMP] - fdivp - fstp [esp + loc44.dbl_Y] - ; - ; Calculate JX,JY - sector of displacement. - ; - fild [esp + loc44.torp_IX] - fld [esp + loc44.dbl_X] - faddp - frndint - call TCommon_FP_Truncate - mcStoreLocal loc44.nJX, eax - - fild [esp + loc44.torp_IY] - fld [esp + loc44.dbl_Y] - faddp - frndint - call TCommon_FP_Truncate - mcStoreLocal loc44.nJY, eax - ; - ; If displacement sector is out of quadrant range - ; then simply report that enemy is not yet destroyed. - ; - cmp eax, 1 - jl .L6905 - cmp eax, 10 - jg .L6905 - - mcLoadLocal eax, loc44.nJX - cmp eax, 1 - jl .L6905 - cmp eax, 10 - jg .L6905 - ; - ; Check if displaced into a black hole! - ; - mcLoadLocal edx, loc44.nJY - call TArray_QuadPtr - mov al, [ebx] - mcOnRegNotEqu al, CHAR_BLACK_HOLE, .L6903 - ; - ; Someone falls into a black hole! - ; - mov ecx, 362 - call TConsole_Prout - - mcLoadLocal esi, loc44.pTrekData - mov al, [esi + TREKDATA.SHIP] - cmp al, [esp + loc44.ch_IQUAD] - jne .L6902 - - mov al, 21 - call TFinish_Main - jmp .done - -.L6902: - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TPhasers_DeadKlingon - jmp TPhotons_Main.L50 - -.L6903: - mcOnRegNotEqu al, CHAR_COSMOS, .L6905 - ; - ; Displace it! - ; - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - - mcLoadLocal eax, loc44.nJX - mcLoadLocal edx, loc44.nJY - call TArray_QuadPtr - mcLoadLocal al, loc44.ch_IQUAD - mov [ebx], al - - mov ecx, 363 - call TConsole_Prout - mov ecx, 364 - call TConsole_Cram - mov cl, 2 - mcLoadLocal eax, loc44.nJX - mcLoadLocal edx, loc44.nJY - call TConsole_CramLoc - call TConsole_ScrollUp - - mcLoadLocal esi, loc44.pTrekData - mov al, [esi + TREKDATA.SHIP] - cmp al, [esp + loc44.ch_IQUAD] - jne .L6904 - ; - ; Starship displaced by a torpedo. - ; Move it and reset enemy distances. - ; - mcLoadLocal eax, loc44.nJX - mcLoadLocal edx, loc44.nJY - mov [esi + TREKDATA.SECTX], al - mov [esi + TREKDATA.SECTY], dl - -.reset_distance: - call TCommon_ResetDist - jmp TPhotons_Main.L50 - -.L6904: - ; - ; Enemy displaced by photon blast! - ; - mcLoadLocal ebx, loc44.pTrekData - mcLoadLocal ecx, loc44.nLL - dec ecx - - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - mcLoadLocal eax, loc44.nJX - mcLoadLocal edx, loc44.nJY - mov [esi + ecx], al - mov [edi + ecx], dl - jmp .reset_distance - -.L6905: - mov ecx, 365 - call TConsole_Prout - jmp TPhotons_Main.L50 - -.L70: - cmp [esp + loc44.ch_IQUAD], CHAR_THOLIAN - jne .L7002 - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TConsole_CramEnemyAtEx - - fld [glb_dbl_600] - fld [esp + loc44.dbl_HIT] - mc_CMP_ST0_ST1 - jc .L7001 - - mov ecx, 306 - call TConsole_Prout - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - -.cleanup_tholian: - mcLoadLocal ebx, loc44.pTrekData - mcZeroBits eax - mcStoreMember TREKDATA.ITHERE, al - mcStoreMember TREKDATA.ITHX, al - mcStoreMember TREKDATA.ITHY, al - jmp TPhotons_Main.L50 - -.L7001: - fld [glb_dbl_0dot05] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jc .tholian_left - -.L7510: - mov ecx, 366 - call TConsole_Prout - jmp TPhotons_Main.L50 - -.tholian_left: - mov ecx, 367 - call TConsole_Prout - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TArray_QuadPtr - mov byte [ebx], CHAR_WEB - - mov al, CHAR_BLACK_HOLE - call TCommon_DropIn - jmp .cleanup_tholian - -.L7002: - cmp [esp + loc44.ch_IQUAD], CHAR_WEB - jne .L7005 - - mov ecx, 368 - call TConsole_Prout - jmp TPhotons_Main.L50 - -.L7005: - cmp [esp + loc44.ch_IQUAD], CHAR_STARBASE - jne .L75 - ; - ; Starbase hit! - ; - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TConsole_CramEnemyAtEx - - fld [glb_dbl_600] - fld [esp + loc44.dbl_HIT] - mc_CMP_ST0_ST1 - jc .L7510 - - mov ecx, 369 - call TConsole_Cram - - mcLoadLocal esi, loc44.pTrekData - cmp [esi + TREKDATA.IPHWHO], 1 - je .end_msg - - mov ecx, 370 - call TConsole_Cram - -.end_msg: - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - - mcLoadLocal esi, loc44.pTrekData - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - call TArray_StarChartPtr - add dword [ebx], 0 - jns .clean_base - - mcZeroBits eax - mov [ebx], eax - -.clean_base: - mcLoadLocal ebx, loc44.pTrekData - movzx ecx, [ebx + TREKDATA.REMBASE] - mov al, [ebx + TREKDATA.QUADX] - mov dl, [ebx + TREKDATA.QUADY] - mcLoadMemberRef esi, TREKDATA.BASEQX - mcLoadMemberRef edi, TREKDATA.BASEQY - -.check_base_quad: - cmp al, [esi] - jne .next_base - cmp dl, [edi] - jne .next_base - jmp .L71 - -.next_base: - inc esi - inc edi - loop .check_base_quad - - ;int 3 - jmp .done - -.L71: - ; - ; Replace the values at ESI,EDI with - ; the last base coordinates. - ; - movzx ecx, [ebx + TREKDATA.REMBASE] - dec ecx - - mcLoadMemberRef edx, TREKDATA.BASEQX - mov al, [edx + ecx] - mov [esi], al - - mcLoadMemberRef edx, TREKDATA.BASEQY - mov al, [edx + ecx] - mov [edi], al - - dec [ebx + TREKDATA.REMBASE] - mov [ebx + TREKDATA.BASEX], 0 - mov [ebx + TREKDATA.BASEY], 0 - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - - call TArray_MyGalaxyPtr - sub dword [ebx], 10 - - mcLoadLocal ebx, loc44.pTrekData - cmp [ebx + TREKDATA.IPHWHO], 1 - je .refresh_condition - - inc [ebx + TREKDATA.BASEKL] - -.refresh_condition: - mov [ebx + TREKDATA.CONDIT], 0 - call TCommon_NewCondition - jmp TPhotons_Main.L50 - -.L75: - cmp [esp + loc44.ch_IQUAD], CHAR_PLANET - jne .L80 - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TConsole_CramEnemyAtEx - - fld [glb_dbl_450] - fld [esp + loc44.dbl_HIT] - mc_CMP_ST0_ST1 - jc .L7510 - - mov ecx, 306 - call TConsole_Prout - - mcLoadLocal ebx, loc44.pTrekData - cmp [ebx + TREKDATA.IPHWHO], 1 - je .clean_planet - - inc [ebx + TREKDATA.NPLANKL] - -.clean_planet: - call TArray_MyNewStufPtr - dec byte [ebx] - - mcLoadLocal ebx, loc44.pTrekData - movzx ecx, [ebx + TREKDATA.IPLANET] - dec ecx - imul ecx, TPlanet.size - mcLoadMemberRef edi, TREKDATA.PLNETS - add edi, ecx - mcLoad8bitsToReg32 ecx, TPlanet.size - mcZeroBits eax - rep stosb - - mcStoreMember TREKDATA.IPLANET, al - mcStoreMember TREKDATA.PLNETX, al - mcStoreMember TREKDATA.PLNETY, al - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - - mcLoadLocal esi, loc44.pTrekData - cmp [esi + TREKDATA.LANDED], 1 - jne TPhotons_Main.L50 - - mov al, 15 - call TFinish_Main - jmp .done - -.L80: - cmp [esp + loc44.ch_IQUAD], CHAR_ASTERISK - jne .L90 - ; - ; Check for Nova results... - ; - fld [glb_dbl_270] - fld [esp + loc44.dbl_HIT] - mc_CMP_ST0_ST1 - jnc .L85 - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TConsole_CramEnemyAtEx - mov ecx, 371 - call TConsole_Prout - jmp TPhotons_Main.L50 - -.L85: - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TNova_Main - - call TArray_MyGalaxyPtr - cmp dword [ebx], 1000 - je .done - - mcLoadLocal esi, loc44.pTrekData - cmp [esi + TREKDATA.ALLDONE], 0 - jne .done - jmp TPhotons_Main.L50 - -.L90: - ; - ; Check for a boomerang torpedo - ; - mcLoadLocal esi, loc44.pTrekData - mov al, [esi + TREKDATA.SHIP] - cmp [esp + loc44.ch_IQUAD], al - jne .L93 - - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .L9010 - - call TRandom_Ranf - fld [glb_dbl_0dot77] - mc_CMP_ST0_ST1 - jc .L9010 - - call TConsole_SetGameMsgAttr - mov ecx, 372 - call TConsole_Cram - call TConsole_CramShip - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - jmp TPhotons_Main.L50 - -.L9010: - call TConsole_SetGameMsgAttr - call TConsole_CramShip - mov ecx, 373 - call TConsole_Prout - - call TCommon_NewCondition - - mcLoadLocal esi, loc44.pTrekData - movzx ecx, [esi + TREKDATA.KSHOT] - mcLoadLocalRef esi, loc44.dbl_HIT - mcLoadLocalRef edi, loc44.bIHURT - call TAttack_Zap - - mcLoadLocal esi, loc44.pTrekData - fld [esi + TREKDATA.ENERGY] - fldz - mc_CMP_ST0_ST1 - jc .L91 - - cmp [esi + TREKDATA.KSHOT], 0 - jne .L9020 - - mov al, 22 - jmp .call_finish - -.L9020: - mov al, 5 - jmp .call_finish - -.L91: - fld [esp + loc44.dbl_HIT] - call TAttack_Casualties - ; - ; Check to see if ship displaced - ; - call TConsole_CramShip - jmp .L6901 - -.L93: - cmp [esp + loc44.ch_IQUAD], CHAR_THING - jne .L95 - - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mov ecx, 374 - call TConsole_Prout - mov ecx, 375 - call TConsole_Prout - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mov ecx, 376 - call TConsole_Prout - - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TArray_QuadPtr - mov byte [ebx], CHAR_COSMOS - jmp TPhotons_Main.L50 - -.L95: - ; - ; Torpedo enters vicinity of a black hole. - ; Check for deflection. - ; - mcLoadLocal eax, loc44.torp_IX - mcLoadLocal edx, loc44.torp_IY - call TConsole_CramEnemyAtEx - - fld [glb_dbl_0dot1] - fld [esp + loc44.dbl_DISTN] - mc_CMP_ST0_ST1 - jc .L97 - ; - ; Torpedo deflected! - ; - fld [glb_dbl_0dot5] - fld [esp + loc44.dbl_DISTN] - fsubp - fld [glb_dbl_7dot853981634] - fmulp - fstp [esp + loc44.dbl_SPRANG] - - fld [glb_dbl_1dot57079633] - fld [esp + loc44.dbl_ANGLE] - faddp - fld [esp + loc44.dbl_SPRANG] - fsubp - fstp [esp + loc44.dbl_BETA] - - fld [esp + loc44.dbl_DISTN] - fld [esp + loc44.dbl_BETA] - fsin - fmulp - fild [esp + loc44.torp_IX] - fsubrp - call TCommon_FP_Truncate - - mcStoreLocal loc44.byte_STARTX, al - call TPhotons_IsValidSector - jnc .L97 - - fld [esp + loc44.dbl_DISTN] - fld [esp + loc44.dbl_BETA] - fcos - fmulp - fild [esp + loc44.torp_IY] - faddp - call TCommon_FP_Truncate - - mcStoreLocal loc44.byte_STARTY, al - call TPhotons_IsValidSector - jnc .L97 - - fld [esp + loc44.dbl_SPRANG] - fld [esp + loc44.dbl_SINANG] - call TCommon_FPU_SignAB - fld [esp + loc44.dbl_ANGLE] - fsubrp - fstp [esp + loc44.dbl_ANGLE] - - mov ecx, 378 - call TConsole_Prout - mov ecx, 379 - call TConsole_Cram - jmp .L5720 - -.L97: - mov ecx, 377 - call TConsole_Prout - jmp TPhotons_Main.L50 - -.L105: - ; - ; End inner loop for moving one torpedo - ; - call TConsole_ScrollUp - -.L106: - mov ecx, 359 - call TConsole_Prout - jmp TPhotons_Main.L50 - -.L115: - mcLoadLocal esi, loc44.pTrekData - cmp [esi + TREKDATA.REMKL], 0 - je .finished - - call TCommon_SortKlingons - jmp .done - -.finished: - mov al, 1 - -.call_finish: - call TFinish_Main - -.done: - mcEndLocals loc44.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TPlanet.Asm b/programs/games/StarTrek/trunk/TPlanet.Asm deleted file mode 100644 index c28b7e015f..0000000000 --- a/programs/games/StarTrek/trunk/TPlanet.Asm +++ /dev/null @@ -1,1069 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TPlanet.Asm -; DATE: November 4, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; STARS -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPlanet_Stars: - mov ecx, 434 - call TConsole_ProutGameMsg - ret - -; -------------------------------------------------------------------------- -; KABOOM -; -------------------------------------------------------------------------- -virtual at 0 -loc46: - .pTrekData PVOID ? - .dbl_WHAMMO DOUBLE ? - .byte_IsKilled BYTE ? - .byte_2 BYTE ? - .pKPower PDOUBLE ? - .pKDist PDOUBLE ? - .pKX PBYTE ? - .pKY PBYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPlanet_KaBoom: - mcBeginLocals loc46.size - - call TPlanet_Stars - - mcLoadGameDataPtr esi - mcStoreLocal loc46.pTrekData, esi - cmp [esi + TREKDATA.SHIP], CHAR_ENTERPRISE - jne .print - - call TConsole_Cram3Asterisks - -.print: - mov ecx, 472 - call TConsole_Cram - call TConsole_CramShip - mov ecx, 473 - call TConsole_Prout - - call TPlanet_Stars - call TConsole_ScrollUp - - mcLoadLocal esi, loc46.pTrekData - cmp [esi + TREKDATA.NENHERE], 0 - je .L20 - - fld [esi + TREKDATA.ENERGY] - fld [glb_dbl_25] - fmulp - fstp [esp + loc46.dbl_WHAMMO] - -.outer_loop: - mcLoadLocal ebx, loc46.pTrekData - mcLoadMemberRef esi, TREKDATA.KX - mcLoadMemberRef edi, TREKDATA.KY - mcStoreLocal loc46.pKX, esi - mcStoreLocal loc46.pKY, edi - - movzx ecx, [ebx + TREKDATA.NENHERE] - jecxz .L20 - - mcLoadMemberRef esi, TREKDATA.KPOWER - mcLoadMemberRef edi, TREKDATA.KDIST - -.check_whammo: - fld tbyte [esi] - fld tbyte [edi] - fmulp - fld [esp + loc46.dbl_WHAMMO] - mc_CMP_ST0_ST1 - jc .next_whammo - - mcLoadLocal esi, loc46.pKX - mcLoadLocal edi, loc46.pKY - mov al, [esi] - mov dl, [edi] - call TPhasers_DeadKlingon - invoke Sleep, 500 - jmp .outer_loop - -.next_whammo: - inc [esp + loc46.pKX] - inc [esp + loc46.pKY] - add esi, 10 - add edi, 10 - loop .check_whammo - -.L20: - mov al, 10 - call TFinish_Main - - mcEndLocals loc46.size - ret - -; -------------------------------------------------------------------------- -; PLANET -; -------------------------------------------------------------------------- -virtual at 0 -loc45: - .pTrekData PVOID ? - .pIWHERE PVOID ? - .bHasDilithium BOOL ? - .nPlanetClass INT32 ? - .dbl_DAMAGE_10 DOUBLE ? - .byte_1 BYTE ? - .byte_2 BYTE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TPlanet_Main: - mcBeginLocals loc45.size - - mcLoadGameDataPtr esi - mcStoreLocal loc45.pTrekData, esi - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - - movzx ecx, [esi + TREKDATA.INPLAN] - lea edi, [esi + TREKDATA.PLNETS] - mcZeroBits eax - -.check_planet_info: - add al, [edi + TPlanet.planet_SCANNED] - add edi, TPlanet.size - loop .check_planet_info - mcOnRegNotZero eax, .L102 - - mov ecx, 380 - call TConsole_Prout - -.exit_main: - mcEndLocals loc45.size - ret - -.L102: - mov ecx, 381 - call TConsole_Prout - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - - mcLoadLocal esi, loc45.pTrekData - movzx ecx, [esi + TREKDATA.INPLAN] - lea edi, [esi + TREKDATA.PLNETS] - -.planet_report: - cmp [edi + TPlanet.planet_SCANNED], 0 - je .next_planet - - push ecx edi - mov al, [edi + TPlanet.planet_X] - mov dl, [edi + TPlanet.planet_Y] - mov cl, 1 - call TConsole_CramLoc - - mov ecx, 382 - call TConsole_Cram - pop edi ecx - - mov al, 'L' - add al, [edi + TPlanet.planet_CLASS] - push ecx edi - call TConsole_PutChar - pop edi ecx - - push ecx edi - mov ecx, 383 - movzx eax, [edi + TPlanet.planet_DILITHIUM] - add ecx, eax - call TConsole_Cram - mov ecx, 385 - call TConsole_Prout - pop edi ecx - -.next_planet: - add edi, TPlanet.size - loop .planet_report - jmp .exit_main - -; -------------------------------------------------------------------------- -; ORBIT -; -------------------------------------------------------------------------- -TPlanet_Orbit: - mcBeginLocals loc45.size - - call TConsole_ScrollUp - - mcLoadGameDataPtr esi - mcStoreLocal loc45.pTrekData, esi - - mov [esi + TREKDATA.IDIDIT], 0 - cmp [esi + TREKDATA.INORBIT], 0 - je .L2 - - call TConsole_SetGameMsgAttr - mov ecx, 386 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L2: - mov cl, DEV_IMPULSE_ENGINES - call TArray_IsDamaged - jnc .L3 - - mov cl, DEV_WARP_ENGINES - call TArray_IsDamaged - jnc .L3 - - call TConsole_SetGameMsgAttr - mov ecx, 387 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L3: - mcLoadLocal esi, loc45.pTrekData - cmp [esi + TREKDATA.PLNETX], 0 - je .L5 - - mov al, [esi + TREKDATA.SECTX] - sub al, [esi + TREKDATA.PLNETX] - movsx eax, al - call TCommon_AbsEAX - push eax - - mov al, [esi + TREKDATA.SECTY] - sub al, [esi + TREKDATA.PLNETY] - movsx eax, al - call TCommon_AbsEAX - pop edx - add eax, edx - cmp eax, 2 - jbe .L10 - -.L5: - call TConsole_SetGameMsgAttr - call TConsole_CramShip - mov ecx, 388 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L10: - call TRandom_Ranf - fld [glb_dbl_0dot03] - fmulp - fld [glb_dbl_0dot02] - faddp - mcLoadLocal edi, loc45.pTrekData - fstp [edi + TREKDATA.TIME] - - mov cl, DEV_WARP_ENGINES - call TArray_IsDamaged - jnc .go_ahead_sulu - - mcLoadLocal edi, loc45.pTrekData - fld [edi + TREKDATA.TIME] - fld [glb_dbl_Ten] - fmulp - fstp [edi + TREKDATA.TIME] - -.go_ahead_sulu: - call TConsole_SetCrewMsgAttr - mov ecx, 389 - call TConsole_Prout - call TCommon_NewCondition - - mov eax, .L17 - mcStoreLocal loc45.pIWHERE, eax - -.L16: - mcLoadLocal edi, loc45.pTrekData - mov [edi + TREKDATA.IDIDIT], 1 - - call TEvents_Main - - mcLoadLocal esi, loc45.pTrekData - cmp [esi + TREKDATA.ALLDONE], 1 - je TPlanet_Main.exit_main - cmp [esi + TREKDATA.JUSTIN], 1 - je TPlanet_Main.exit_main - - call TArray_MyGalaxyPtr - cmp dword [ebx], 1000 - je TPlanet_Main.exit_main - jmp [esp + loc45.pIWHERE] - -.L17: - mov ecx, 390 - call TConsole_Cram - - call TRandom_Ranf - fld [glb_dbl_7200] - fmulp - fld [glb_dbl_1400] - faddp - fld st - mcLoadLocal edi, loc45.pTrekData - fstp [edi + TREKDATA.HEIGHT] - - mov cl, 2 - call TConsole_CramFloat - - mov ecx, 391 - call TConsole_Prout - - mcLoadLocal edi, loc45.pTrekData - inc [edi + TREKDATA.INORBIT] - jmp TPlanet_Main.exit_main - -; -------------------------------------------------------------------------- -; BEAM -; -------------------------------------------------------------------------- -TPlanet_Beam: - mcBeginLocals loc45.size - - mcLoadGameDataPtr esi - mcStoreLocal loc45.pTrekData, esi - - call TConsole_ScrollUp - - mov cl, DEV_TRANSPORTER - call TArray_IsDamaged - jnc .L19 - - call TConsole_SetGameMsgAttr - mov ecx, 392 - call TConsole_Prout - - mov cl, DEV_SHUTTLE_CRAFT - call TArray_GetDblDamage - fldz - mc_CMP_ST0_ST1 - jnz TPlanet_Main.exit_main - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mov ecx, 393 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L19: - mcLoadLocal esi, loc45.pTrekData - cmp [esi + TREKDATA.INORBIT], 0 - jne .L1910 - -.L1901: - call TConsole_SetGameMsgAttr - call TConsole_CramShip - mov ecx, 394 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L1910: - cmp [esi + TREKDATA.SHLDUP], 0 - je .L1920 - - call TConsole_SetGameMsgAttr - mov ecx, 395 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L1920: - movzx ecx, [esi + TREKDATA.IPLANET] - call TArray_PlanetPtr - movzx eax, [edi + TPlanet.planet_DILITHIUM] - mcStoreLocal loc45.bHasDilithium, eax - cmp [edi + TPlanet.planet_SCANNED], 1 - je .L1940 - -.L1930: - call TConsole_SetCrewMsgAttr - mov ecx, 396 - call TConsole_Prout - mov ecx, 397 - call TConsole_Prout - mov ecx, 398 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L1940: - mcLoadLocal esi, loc45.pTrekData - cmp [esi + TREKDATA.LANDED], 1 - je .L30 - - cmp [esp + loc45.bHasDilithium], 1 - je .L20 - - call TConsole_SetCrewMsgAttr - mov ecx, 399 - call TConsole_Prout - mov ecx, 400 - call TConsole_Prout - - mov eax, .L20 - mcStoreLocal loc45.pIWHERE, eax - -.L1950: - mcLoad8bitsToReg32 ecx, 158 - call TGame_JA - jnc TPlanet_Main.exit_main - jmp [esp + loc45.pIWHERE] - -.L20: - call TConsole_SetCrewMsgAttr - mov ecx, 401 - call TConsole_Prout - call TConsole_ScrollUp - - call TConsole_SetGameMsgAttr - mov ecx, 402 - call TConsole_Prout - call TConsole_ScrollUp - - call TConsole_SetCrewMsgAttr - mov ecx, 403 - call TConsole_Prout - -.L21: - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mov ecx, 404 - call TConsole_Prout - invoke Sleep, 1200 - - fld [glb_dbl_0dot98] - call TRandom_Ranf - mc_CMP_ST0_ST1 - jnc .L35 - - mov ecx, 405 - call TConsole_Prout - invoke Sleep, 1200 - - mov ecx, 406 - call TConsole_Prout - - mcLoadLocal esi, loc45.pTrekData - neg [esi + TREKDATA.LANDED] - - cmp [esi + TREKDATA.LANDED], 1 - je .reset_mining_flag - cmp [esi + TREKDATA.IMINE], 1 - jne .reset_mining_flag - - mov [esi + TREKDATA.ICRYSTL], 1 - -.reset_mining_flag: - mov [esi + TREKDATA.IMINE], 0 - jmp TPlanet_Main.exit_main - -.L30: - cmp [esi + TREKDATA.ISCRAFT], 1 - je .L32 - - call TConsole_SetGameMsgAttr - mov ecx, 407 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L32: - call TConsole_SetGameMsgAttr - mov ecx, 408 - call TConsole_Prout - call TConsole_ScrollUp - - mov ecx, 409 - call TConsole_Prout - mov ecx, 410 - call TConsole_Prout - call TConsole_ScrollUp - - call TConsole_SetCrewMsgAttr - mov ecx, 411 - call TConsole_Prout - jmp .L21 - -.L35: - call TConsole_ScrollUp - mov ecx, 412 - call TConsole_Prout - - call TConsole_SetCrewMsgAttr - call TConsole_ScrollUp - mov ecx, 413 - call TConsole_Prout - - mov al, 13 - -.finished: - call TFinish_Main - jmp TPlanet_Main.exit_main - -; -------------------------------------------------------------------------- -; MINE -; -------------------------------------------------------------------------- -TPlanet_Mine: - mcBeginLocals loc45.size - - mcLoadGameDataPtr esi - mcStoreLocal loc45.pTrekData, esi - - mov [esi + TREKDATA.IDIDIT], 0 - call TConsole_ScrollUp - - mcLoadLocal esi, loc45.pTrekData - cmp [esi + TREKDATA.LANDED], 1 - je .L50 - - call TConsole_SetGameMsgAttr - mov ecx, 414 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L50: - movzx ecx, [esi + TREKDATA.IPLANET] - call TArray_PlanetPtr - movzx eax, [edi + TPlanet.planet_CLASS] - mcStoreLocal loc45.nPlanetClass, eax - cmp [edi + TPlanet.planet_DILITHIUM], 1 - je .L51 - - call TConsole_SetGameMsgAttr - mov ecx, 415 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L51: - call TRandom_Ranf - fld [glb_dbl_0dot2] - fmulp - fld [glb_dbl_0dot1] - faddp - fild [esp + loc45.nPlanetClass] - fmulp - mcLoadLocal esi, loc45.pTrekData - fstp [esi + TREKDATA.TIME] - - mov eax, .L52 - mcStoreLocal loc45.pIWHERE, eax - jmp TPlanet_Orbit.L16 - -.L52: - invoke Sleep, 1200 - call TConsole_SetGameMsgAttr - mov ecx, 416 - call TConsole_Prout - - mcLoadLocal edi, loc45.pTrekData - mov [edi + TREKDATA.IMINE], 1 - jmp TPlanet_Main.exit_main - -; -------------------------------------------------------------------------- -; CRYSTAL -; -------------------------------------------------------------------------- -TPlanet_Crystal: - mcBeginLocals loc45.size - - mcLoadGameDataPtr esi - mcStoreLocal loc45.pTrekData, esi - - call TConsole_ScrollUp - - mcLoadLocal edi, loc45.pTrekData - cmp [edi + TREKDATA.ICRYSTL], 1 - je .L55 - - call TConsole_SetGameMsgAttr - mov ecx, 417 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L55: - fld [glb_dbl_1000] - fld [edi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jc .L5510 - - call TConsole_SetCrewMsgAttr - mov ecx, 418 - call TConsole_Prout - mov ecx, 419 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L5510: - call TConsole_SetCrewMsgAttr - mov ecx, 420 - call TConsole_Prout - mov ecx, 421 - call TConsole_Prout - mov ecx, 422 - call TConsole_Prout - - mov eax, .L56 - mcStoreLocal loc45.pIWHERE, eax - jmp TPlanet_Beam.L1950 - -.L56: - call TConsole_SetCrewMsgAttr - call TConsole_ScrollUp - mov ecx, 423 - call TConsole_Prout - mov ecx, 424 - call TConsole_Prout - invoke Sleep, 1200 - - mcLoadLocal edi, loc45.pTrekData - fld [edi + TREKDATA.CRYPROB] - fld st - faddp - fstp [edi + TREKDATA.CRYPROB] - - call TConsole_ScrollUp - mov ecx, 425 - call TConsole_Prout - mov ecx, 426 - call TConsole_Prout - invoke Sleep, 1200 - - call TConsole_ScrollUp - mov ecx, 427 - call TConsole_Prout - call TConsole_ScrollUp - invoke Sleep, 1200 - - call TRandom_Ranf - mcLoadLocal esi, loc45.pTrekData - fld [esi + TREKDATA.CRYPROB] - mc_CMP_ST0_ST1 - jc .L57 - - call TConsole_SetCrewMsgAttr - mov ecx, 428 - call TConsole_Prout - -.L5610: - mov cl, ATTR_COND_RED - call TConsole_SetAttr - mov ecx, 429 - call TConsole_Prout - - call TPlanet_Stars - mov ecx, 430 - call TConsole_Prout - - call TPlanet_KaBoom - jmp TPlanet_Main.exit_main - -.L57: - call TRandom_Ranf - fld [glb_dbl_0dot9] - fmulp - fld1 - faddp - fld [glb_dbl_5000] - fmulp - - mcLoadLocal esi, loc45.pTrekData - fld [esi + TREKDATA.ENERGY] - faddp - fstp [esi + TREKDATA.ENERGY] - - call TConsole_SetCrewMsgAttr - mov ecx, 431 - call TConsole_Prout - mov ecx, 432 - call TConsole_Prout - mov ecx, 433 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -; -------------------------------------------------------------------------- -; SENSOR -; -------------------------------------------------------------------------- -TPlanet_Sensor: - mcBeginLocals loc45.size - - mcLoadGameDataPtr esi - mcStoreLocal loc45.pTrekData, esi - - call TConsole_ScrollUp - - mov cl, DEV_SR_SENSORS - call TArray_IsDamaged - jnc .L60 - - mcLoadLocal esi, loc45.pTrekData - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - je .L60 - - call TConsole_SetGameMsgAttr - mov ecx, 435 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L60: - cmp [esi + TREKDATA.PLNETX], 0 - jne .L65 - - call TConsole_SetGameMsgAttr - mov ecx, 436 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -.L65: - call TConsole_SetCrewMsgAttr - mov ecx, 437 - call TConsole_Cram - - mcLoadLocal esi, loc45.pTrekData - mov cl, 1 - mov al, [esi + TREKDATA.QUADX] - mov dl, [esi + TREKDATA.QUADY] - call TConsole_CramLoc - mov al, ':' - call TConsole_PutChar - call TConsole_ScrollUp - - mov ecx, 438 - call TConsole_Cram - - mcLoadLocal esi, loc45.pTrekData - mov cl, 2 - mov al, [esi + TREKDATA.PLNETX] - mov dl, [esi + TREKDATA.PLNETY] - call TConsole_CramLoc - - mov ecx, 439 - call TConsole_Cram - - mcLoadLocal esi, loc45.pTrekData - movzx ecx, [esi + TREKDATA.IPLANET] - call TArray_PlanetPtr - - mov [edi + TPlanet.planet_SCANNED], 1 - mov al, [edi + TPlanet.planet_DILITHIUM] - push eax - - mov al, [edi + TPlanet.planet_CLASS] - add al, 'L' - call TConsole_PutChar - mov al, '`' - call TConsole_PutChar - mov al, '.' - call TConsole_PutChar - call TConsole_ScrollUp - - mov ecx, 440 - call TConsole_Cram - - pop eax - mcOnRegNotZero al, .report - - mov ecx, 441 - call TConsole_Cram - -.report: - mov ecx, 442 - call TConsole_Prout - jmp TPlanet_Main.exit_main - -; -------------------------------------------------------------------------- -; GALILEO -; -------------------------------------------------------------------------- -TPlanet_Galileo: - mcBeginLocals loc45.size - - mcLoadGameDataPtr esi - mcStoreLocal loc45.pTrekData, esi - - mov [esi + TREKDATA.IDIDIT], 0 - call TConsole_ScrollUp - - mov cl, DEV_SHUTTLE_CRAFT - call TArray_GetDblDamage - fld st - fstp [esp + loc45.dbl_DAMAGE_10] - - fldz - mc_CMP_ST0_ST1 - jz .L72 - jc .L71 - - fld1 - fchs - mc_CMP_ST0_ST1 - jz .L70 - - mov ecx, 443 - call TConsole_ProutGameMsg - jmp TPlanet_Main.exit_main - -.L70: - mov ecx, 444 - call TConsole_ProutGameMsg - jmp TPlanet_Main.exit_main - -.L71: - mov ecx, 445 - call TConsole_ProutGameMsg - jmp TPlanet_Main.exit_main - -.L72: - mcLoadLocal esi, loc45.pTrekData - cmp [esi + TREKDATA.INORBIT], 1 - jne TPlanet_Beam.L1901 - - cmp [esi + TREKDATA.SHLDUP], 1 - je .craft_cant_thru_shields - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - jne .L80 - -.craft_cant_thru_shields: - mov ecx, 446 - call TConsole_ProutGameMsg - jmp TPlanet_Main.exit_main - -.L80: - movzx ecx, [esi + TREKDATA.IPLANET] - call TArray_PlanetPtr - cmp [edi + TPlanet.planet_SCANNED], 1 - jne TPlanet_Beam.L1930 - - mcLoadLocal esi, loc45.pTrekData - fld [esi + TREKDATA.HEIGHT] - fld [glb_dbl_3E_neg_5] - fmulp - fstp [esi + TREKDATA.TIME] - - cmp [esi + TREKDATA.LANDED], 1 - jne .L100 - cmp [esi + TREKDATA.ISCRAFT], 1 - jne .L98 - - mov cl, DEV_TRANSPORTER - call TArray_IsDamaged - jc .L95 - - call TConsole_SetCrewMsgAttr - mov ecx, 447 - call TConsole_Prout - mov ecx, 458 - call TGame_JA - jc TPlanet_Main.exit_main - -.L95: - call TConsole_SetGameMsgAttr - mov cl, DEV_TRANSPORTER - call TArray_IsDamaged - mov ecx, 448 - adc ecx, 0 - call TConsole_Cram - - mov ecx, 450 - call TConsole_Prout - - mcLoadLocal edi, loc45.pTrekData - mov [edi + TREKDATA.ISCRAFT], 0 - - mov eax, .L97 - mcStoreLocal loc45.pIWHERE, eax - -.L96: - call TConsole_ScrollUp - jmp TPlanet_Orbit.L16 - -.L97: - mov ecx, 451 - call TConsole_ProutGameMsg - jmp TPlanet_Main.exit_main - -.L98: - mov ecx, 452 - call TConsole_ProutGameMsg - mov ecx, 453 - call TConsole_Prout - call TConsole_ScrollUp - mov ecx, 454 - call TConsole_Prout - - mcLoadLocal edi, loc45.pTrekData - mov [edi + TREKDATA.ICRAFT], 1 - mov [edi + TREKDATA.LANDED], -1 - - mov eax, .L99 - mcStoreLocal loc45.pIWHERE, eax - jmp .L96 - -.L99: - mcLoadLocal edi, loc45.pTrekData - mov [edi + TREKDATA.ICRAFT], 0 - mov [edi + TREKDATA.ISCRAFT], 1 - - cmp [edi + TREKDATA.IMINE], 0 - je .L97 - - mov [edi + TREKDATA.ICRYSTL], 1 - mov [edi + TREKDATA.IMINE], 0 - jmp .L97 - -.L100: - mov ecx, 455 - call TConsole_ProutGameMsg - mov ecx, 456 - call TConsole_Prout - call TConsole_ScrollUp - mov ecx, 457 - call TConsole_Prout - - mcLoadLocal edi, loc45.pTrekData - mov [edi + TREKDATA.ICRAFT], 1 - mov [edi + TREKDATA.ISCRAFT], 0 - - mov eax, .L110 - mcStoreLocal loc45.pIWHERE, eax - jmp .L96 - -.L110: - mcLoadLocal edi, loc45.pTrekData - mov [edi + TREKDATA.LANDED], 1 - mov [edi + TREKDATA.ICRAFT], 0 - jmp .L97 - -; -------------------------------------------------------------------------- -; DEATHRA -; -------------------------------------------------------------------------- -TPlanet_DeathRay: - mcBeginLocals loc45.size - - mcLoadGameDataPtr esi - mcStoreLocal loc45.pTrekData, esi - - mov [esi + TREKDATA.IDIDIT], 0 - call TConsole_ScrollUp - - cmp [esi + TREKDATA.SHIP], CHAR_ENTERPRISE - je .L113 - - mov ecx, 459 - call TConsole_ProutGameMsg - jmp .done - -.L113: - cmp [esi + TREKDATA.NENHERE], 1 - jae .L115 - - call TConsole_SetCrewMsgAttr - mov ecx, 460 - call TConsole_Prout - jmp .done - -.L115: - mov cl, DEV_DEATHRAY - call TArray_IsDamaged - jnc .L116 - - mov ecx, 461 - call TConsole_ProutGameMsg - jmp .done - -.L116: - mcLoadLocal edi, loc45.pTrekData - mov [edi + TREKDATA.IDIDIT], 1 - - call TConsole_SetCrewMsgAttr - mov ecx, 462 - call TConsole_Prout - call TConsole_ScrollUp - invoke Sleep, 1600 - - mov ecx, 463 - call TConsole_Prout - invoke Sleep, 1000 - - mov ecx, 464 - call TConsole_Prout - call TConsole_ScrollUp - invoke Sleep, 1200 - - mov ecx, 465 - call TConsole_ProutGameMsg - invoke Sleep, 1200 - - call TConsole_SetCrewMsgAttr - mov ecx, 466 - call TConsole_Prout - invoke Sleep, 1200 - - call TRandom_Ranf - fld [glb_dbl_0dot3] - mc_CMP_ST0_ST1 - jc .L130 - - call TMove_RedAlert - mov ecx, 467 - call TConsole_ProutGameMsg - invoke Sleep, 1200 - jmp TPlanet_Crystal.L5610 - -.L130: - call TConsole_ScrollUp - - mcLoadLocal edx, loc45.pTrekData - movzx ecx, [edx + TREKDATA.NENHERE] - - lea esi, [edx + TREKDATA.KX] - lea edi, [edx + TREKDATA.KY] - -.next_enemy: - push edi esi ecx - - mov al, [esi] - mov dl, [edi] - call TPhasers_DeadKlingon - - pop ecx esi edi - loop .next_enemy - - call TConsole_ScrollUp - call TConsole_SetCrewMsgAttr - mov ecx, 468 - call TConsole_Prout - - mcLoadLocal esi, loc45.pTrekData - cmp [esi + TREKDATA.REMKL], 0 - je .game_won - - call TConsole_ScrollUp - mov ecx, 469 - call TConsole_Prout - - call TRandom_Ranf - fld [glb_dbl_0dot05] - mc_CMP_ST0_ST1 - jc .deathray_damaged - - mov ecx, 470 - call TConsole_Prout - jmp .done - -.deathray_damaged: - mov ecx, 471 - call TConsole_Prout - - mov cl, DEV_DEATHRAY - fld [glb_dbl_39dot95] - call TArray_SetDblDamage - jmp .done - -.game_won: - mov al, 1 - jmp TPlanet_Beam.finished - -.done: - mcEndLocals loc45.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TRandom.Asm b/programs/games/StarTrek/trunk/TRandom.Asm deleted file mode 100644 index 35ed15f7f5..0000000000 --- a/programs/games/StarTrek/trunk/TRandom.Asm +++ /dev/null @@ -1,324 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TRandom.Asm -; DATE: October 4, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_Create: - invoke HeapAlloc, [glb_Allocator], HEAP_NO_SERIALIZE, TRandom.size - mov [glb_pMersenne], eax - - mcZeroBits ecx - mov [eax + TRandom.rand_NextIndex], ecx - - rdtsc - call TRandom_Seed - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = seed value -; -------------------------------------------------------------------------- -virtual at 0 -loc7: - .index INDEX ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_Seed: - mcBeginLocals loc7.size - - mcLoad1 ecx - mcStoreLocal loc7.index, ecx - - mov edi, [glb_pMersenne] - stosd - -.set_next_value: - ; - ; MT [i-1] - ; - mov edx, [edi - 4] - ; - ; Right shift by 30 bits - ; - mov eax, edx - shr eax, 30 - ; - ; XOR it with MT [i-1] - ; - xor edx, eax - ; - ; Add current index - ; - add edx, [esp + loc7.index] - ; - ; Multiply by 6C078965h - ; - mov eax, 6C078965h - mul edx - ; - ; Store as MT [i] - ; - stosd - ; - ; Continue until index reaches 623 - ; - inc [esp + loc7.index] - cmp [esp + loc7.index], 623 - jbe .set_next_value - - mcEndLocals loc7.size - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = value -; Output: -; EAX = value MOD 624 -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_GetModulo624: - push ecx edx - mcZeroBits edx - mov ecx, 624 - div ecx - mov eax, edx - pop edx ecx - ret - -; -------------------------------------------------------------------------- -virtual at 0 -loc8: - .index INDEX ? - .y UINT32 ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_Generate624: - mcBeginLocals loc8.size - ; - ; i=0 - ; - mcZeroBits eax - mcStoreLocal loc8.index, eax - ; - ; MT array - ; - mov esi, [glb_pMersenne] - -.calc_y: - ; - ; MT [(i+1) MOD 624] - ; - mcLoadLocal eax, loc8.index - inc eax - call TRandom_GetModulo624 - mov ecx, [esi + eax*4] - ; - ; Get last 31 bits of ECX - ; - and ecx, 7FFFFFFFh - ; - ; 32nd bit of MT [i] - ; - mcLoadLocal eax, loc8.index - mov edx, [esi + eax*4] - and edx, 80000000h - ; - ; Combine them and store as Y - ; - or edx, ecx - mcStoreLocal loc8.y, edx - ; - ; MT [i] = MT [(i+397) MOD 624] xor (y >> 1) - ; - mcLoadLocal eax, loc8.index - add eax, 397 - call TRandom_GetModulo624 - mov ecx, [esi + eax*4] - - shr edx, 1 - xor ecx, edx - mcLoadLocal eax, loc8.index - mov [esi + eax*4], ecx - ; - ; IF ((Y MOD 2) == 1) THEN MT [i] ^= 9908B0DFh - ; - test [esp + loc8.y], 1 - jz .continue - - xor dword [esi + eax*4], 9908B0DFh - -.continue: - inc [esp + loc8.index] - cmp [esp + loc8.index], 623 - jbe .calc_y - - mcEndLocals loc8.size - ret - -; -------------------------------------------------------------------------- -; Output: -; EAX = next random value from a sequence -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_GetNextNumber: - push ebx - mov ebx, [glb_pMersenne] - ; - ; IF (index == 0) THEN generate next 624 values - ; - cmp [ebx + TRandom.rand_NextIndex], 0 - jne .get_it - - push esi - call TRandom_Generate624 - pop esi - mov ebx, [glb_pMersenne] - -.get_it: - mcLoadMember ecx, TRandom.rand_NextIndex - mov eax, [ebx + ecx*4] - - mov edx, eax - shr edx, 11 - xor eax, edx - - mov edx, eax - shl edx, 7 - and edx, 9D2C5680h - xor eax, edx - - mov edx, eax - shl edx, 15 - and edx, 0EFC60000h - xor eax, edx - - mov edx, eax - shr edx, 18 - xor eax, edx - ; - ; Index = (Index+1) MOD 624 - ; - push eax - mov eax, ecx - call TRandom_GetModulo624 - mcStoreMember TRandom.rand_NextIndex, eax - pop eax - pop ebx - ret - -; -------------------------------------------------------------------------- -; Input: -; EDX = N -; Output: -; EAX = random value in range [0..N-1] -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_IRan: - push edx - call TRandom_GetNextNumber - mcZeroBits edx - pop ecx - div ecx - mov eax, edx - ret - -; -------------------------------------------------------------------------- -; Output: -; ST(0) = random value in range [0..1] -; -------------------------------------------------------------------------- -virtual at 0 -loc9: - .dbl_2e31 DOUBLE ? - .dbl_padded DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_Ranf: - pushad - mcBeginLocals loc9.size - - fldz - fstp [esp + loc9.dbl_2e31] - - call TRandom_GetNextNumber - test eax, 80000000h - jz .add_two_parts - - fld [glb_dbl_2e31] - fstp [esp + loc9.dbl_2e31] - and eax, 7FFFFFFFh - -.add_two_parts: - call TCommon_FPU_Load_EAX - fld [esp + loc9.dbl_2e31] - faddp - - fld [glb_dbl_2e32] - fdivp - - mcEndLocals loc9.size - popad - ret - -; -------------------------------------------------------------------------- -; Output: -; EAX = value 1 or 10 (X,Y sector of Tholian!) -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_TholianSect: - call TRandom_Ranf - fld [glb_dbl_0dot5] - faddp - call TCommon_FP_Truncate - imul eax, 9 - inc eax - ret - -; -------------------------------------------------------------------------- -; Output: -; EAX = random X value in range [1..8] -; EDX = random Y value in range [1..8] -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_IRan8: - mcLoad8bitsToReg32 edx, 8 - call TRandom_IRan - inc eax - push eax - - mcLoad8bitsToReg32 edx, 8 - call TRandom_IRan - inc eax - - mov edx, eax - pop eax - ret - -; -------------------------------------------------------------------------- -; Output: -; EAX = random X value in range [1..10] -; EDX = random Y value in range [1..10] -; -------------------------------------------------------------------------- -align PROC_ALIGN -TRandom_IRan10: - mcLoad8bitsToReg32 edx, 10 - call TRandom_IRan - inc eax - push eax - - mcLoad8bitsToReg32 edx, 10 - call TRandom_IRan - inc eax - - mov edx, eax - pop eax - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TRandom.Inc b/programs/games/StarTrek/trunk/TRandom.Inc deleted file mode 100644 index f842c36189..0000000000 --- a/programs/games/StarTrek/trunk/TRandom.Inc +++ /dev/null @@ -1,13 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TRandom.Inc -; DATE: October 4, 2008 -; -------------------------------------------------------------------------- - -virtual at 0 -TRandom: - .rand_NumberSet INTEGERS 624 - .rand_NextIndex INT32 ? - .size = $ -end virtual - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TShields.Asm b/programs/games/StarTrek/trunk/TShields.Asm deleted file mode 100644 index ead23d15c1..0000000000 --- a/programs/games/StarTrek/trunk/TShields.Asm +++ /dev/null @@ -1,314 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TShields.Asm -; DATE: October 18, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; SHIELDS -; -------------------------------------------------------------------------- -virtual at 0 -loc35: - .pTrekData PVOID ? - .dbl_ETRANS DOUBLE ? - .dbl_reserved DOUBLE ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TShields_Main: - mcBeginLocals loc35.size - mcLoadGameDataPtr ebx - mcStoreLocal loc35.pTrekData, ebx - - mov [ebx + TREKDATA.IDIDIT], 0 - call TCmdBuf_Scan - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - jne TShields_Up.L30 - -.L15: - mcLoad8bitsToReg32 ecx, 225 - call TGame_JA - jc TShields_Up.L8010 - - mov cl, DEV_SHIELDS - call TArray_IsDamaged - jc TShields_Up.L60 - - mcLoadLocal esi, loc35.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - jne TShields_Up.L20 - jmp TShields_Up.ENTRY - -; -------------------------------------------------------------------------- -; SHLDSUP -; -------------------------------------------------------------------------- -align PROC_ALIGN -TShields_Up: - mcBeginLocals loc35.size - mcLoadGameDataPtr ebx - mcStoreLocal loc35.pTrekData, ebx - -.ENTRY: - mcLoad8bitsToReg32 ecx, 226 - call TGame_JA - jc .L40 - jmp .L90 - -.L20: - mcLoad8bitsToReg32 ecx, 227 - call TGame_JA - jc .L50 - jmp .L90 - -.L30: - mcLoad8bitsToReg32 ecx, 244 - call TCmdBuf_Crop - jc .L80 - - mov cl, DEV_SHIELDS - call TArray_IsDamaged - jc .L60 - - mcLoad8bitsToReg32 ecx, 245 - call TCmdBuf_Crop - jc .L40 - - mcLoad8bitsToReg32 ecx, 246 - call TCmdBuf_Crop - jc .L50 - jmp TShields_Main.L15 - -.L40: - ; - ; Raising shields - ; - mcLoadLocal esi, loc35.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - jne .L45 - - mov [esi + TREKDATA.SHLDUP], 1 - mov [esi + TREKDATA.SHLDCHG], 1 - - cmp [esi + TREKDATA.CONDIT], CONDITION_DOCKED - je .L401 - - fld [esi + TREKDATA.ENERGY] - fld [glb_dbl_50] - fsubp - fstp [esi + TREKDATA.ENERGY] - -.L401: - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 228 - call TConsole_Prout - - mcLoadLocal esi, loc35.pTrekData - fldz - fld [esi + TREKDATA.ENERGY] - mc_CMP_ST0_ST1 - jc .L70 - -.did_it: - mcLoadLocal edi, loc35.pTrekData - inc [edi + TREKDATA.IDIDIT] - jmp .done - -.L45: - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 230 - call TConsole_Prout - jmp .done - -.L50: - ; - ; Lowering shields - ; - mcLoadLocal esi, loc35.pTrekData - cmp [esi + TREKDATA.SHLDUP], 0 - je .L55 - - dec [esi + TREKDATA.SHLDUP] - mov [esi + TREKDATA.SHLDCHG], 1 - - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 229 - call TConsole_Prout - jmp .did_it - -.L55: - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 231 - call TConsole_Prout - jmp .done - -.L60: - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 232 - call TConsole_Prout - jmp .done - -.L70: - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 233 - call TConsole_Prout - mov al, 4 - call TFinish_Main - jmp .done - -.L80: - call TCmdBuf_Scan - fld [ebx + TCmdBuf.cmdbuf_FNUM] - fstp [esp + loc35.dbl_ETRANS] - - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_REAL - je .L81 - -.L8010: - mcLoad8bitsToReg32 ecx, 234 - call TGame_Prompt - jmp .L80 - -.L81: - fld [esp + loc35.dbl_ETRANS] - fldz - mc_CMP_ST0_ST1 - jz .L90 - - mcLoadLocal esi, loc35.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [esp + loc35.dbl_ETRANS] - mc_CMP_ST0_ST1 - jc .L82 - - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 235 - call TConsole_Prout - jmp .L90 - -.L82: - mcLoadLocal edi, loc35.pTrekData - inc [edi + TREKDATA.IDIDIT] - - fld [edi + TREKDATA.INSHLD] - fld [edi + TREKDATA.SHLD] - fld [esp + loc35.dbl_ETRANS] - faddp - mc_CMP_ST0_ST1 - jc .L83 - jz .L83 - - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 236 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 237 - call TConsole_Prout - - mcLoadLocal esi, loc35.pTrekData - fld [esi + TREKDATA.SHLD] - fld [esi + TREKDATA.INSHLD] - fsubp - fld [esi + TREKDATA.ENERGY] - faddp - fstp [esi + TREKDATA.ENERGY] - - fld [esi + TREKDATA.INSHLD] - fstp [esi + TREKDATA.SHLD] - jmp .L90 - -.L83: - fld [esp + loc35.dbl_ETRANS] - fldz - mc_CMP_ST0_ST1 - jc .L8310 - - mcLoadLocal esi, loc35.pTrekData - fld [esi + TREKDATA.INENRG] - fld [esi + TREKDATA.ENERGY] - fld [esp + loc35.dbl_ETRANS] - fsubp - mc_CMP_ST0_ST1 - jc .L8310 - jz .L8310 - - fld [esi + TREKDATA.INENRG] - fld [esi + TREKDATA.ENERGY] - fld [esi + TREKDATA.SHLD] - faddp - mc_CMP_ST0_ST1 - jc .L8310 - jz .L8310 - - call TConsole_SetCrewMsgAttr - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 148 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 238 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 239 - call TConsole_Prout - - mcLoadLocal edi, loc35.pTrekData - dec [edi + TREKDATA.IDIDIT] - jmp .L90 - -.L8310: - mcLoadLocal esi, loc35.pTrekData - fld [esi + TREKDATA.SHLD] - fld [esp + loc35.dbl_ETRANS] - faddp - fldz - mc_CMP_ST0_ST1 - jc .L84 - jz .L84 - - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 240 - call TConsole_Prout - - mcLoadLocal esi, loc35.pTrekData - fld [esi + TREKDATA.ENERGY] - fld [esi + TREKDATA.SHLD] - faddp - fstp [esi + TREKDATA.ENERGY] - - fldz - fstp [esi + TREKDATA.SHLD] - jmp .L90 - -.L84: - call TConsole_SetCrewMsgAttr - mcLoad8bitsToReg32 ecx, 242 - mcLoad8bitsToReg32 edx, 243 - fld [esp + loc35.dbl_ETRANS] - fldz - mc_CMP_ST0_ST1 - cmovnc ecx, edx - call TConsole_Prout - - mcLoadLocal ebx, loc35.pTrekData - fld [ebx + TREKDATA.SHLD] - fld [esp + loc35.dbl_ETRANS] - faddp - fstp [ebx + TREKDATA.SHLD] - - fld [ebx + TREKDATA.ENERGY] - fld [esp + loc35.dbl_ETRANS] - fsubp - fstp [ebx + TREKDATA.ENERGY] - -.L90: - mcLoadLocal esi, loc35.pTrekData - fld [esi + TREKDATA.SHLD] - fldz - mc_CMP_ST0_ST1 - jc .done - - dec [esi + TREKDATA.SHLDUP] - -.done: - mcEndLocals loc35.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TSrScan.Asm b/programs/games/StarTrek/trunk/TSrScan.Asm deleted file mode 100644 index b6930e30a0..0000000000 --- a/programs/games/StarTrek/trunk/TSrScan.Asm +++ /dev/null @@ -1,519 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TSrScan.Asm -; DATE: October 11, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; AL = character from QUAD array -; -------------------------------------------------------------------------- -align PROC_ALIGN -TSrScan_SetCosmosAttr: - push ecx - - mcOnRegEqu al, CHAR_ASTERISK, .attr_star - mcOnRegEqu al, CHAR_BLACK_HOLE, .attr_bhole - mcOnRegEqu al, CHAR_COMMANDER, .attr_klingon - mcOnRegEqu al, CHAR_ENTERPRISE, .attr_ship - mcOnRegEqu al, CHAR_FQUEENE, .attr_ship - mcOnRegEqu al, CHAR_KLINGON, .attr_klingon - mcOnRegEqu al, CHAR_PLANET, .attr_planet - mcOnRegEqu al, CHAR_ROMULAN, .attr_romulan - mcOnRegEqu al, CHAR_SCOM, .attr_klingon - mcOnRegEqu al, CHAR_STARBASE, .attr_base - mcOnRegEqu al, CHAR_THING, .attr_thing - mcOnRegEqu al, CHAR_THOLIAN, .attr_tholian - mcOnRegEqu al, CHAR_WEB, .attr_web - - mov cl, ATTR_COSMOS - jmp .apply - -.attr_star: - mov cl, ATTR_STAR - jmp .apply - -.attr_bhole: - mov cl, ATTR_BLACK_HOLE - jmp .apply - -.attr_klingon: - mov cl, ATTR_KLINGON - jmp .apply - -.attr_ship: - mov cl, ATTR_SHIP - jmp .apply - -.attr_planet: - mov cl, ATTR_PLANET - jmp .apply - -.attr_romulan: - mov cl, ATTR_ROMULAN - jmp .apply - -.attr_base: - mov cl, ATTR_BASE - jmp .apply - -.attr_thing: - mov cl, ATTR_BLACK_HOLE - jmp .apply - -.attr_tholian: - mov cl, ATTR_THOLIAN - jmp .apply - -.attr_web: - mov cl, ATTR_WEB - -.apply: - call TConsole_SetAttr - pop ecx - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = row index from 1 to 10 -; -------------------------------------------------------------------------- -align PROC_ALIGN -TSrScan_CramSpaceRow: - dec eax - imul eax, 10 - - mcLoadGameDataPtr edx - lea esi, [edx + eax + TREKDATA.QUAD] - mcLoad8bitsToReg32 ecx, 10 - -.dump_sector: - push ecx - - lodsb - call TSrScan_SetCosmosAttr - call TConsole_PutChar - mov al, CHAR_BLANK - call TConsole_PutChar - - pop ecx - loop .dump_sector - ret - -; -------------------------------------------------------------------------- -; Input: -; ECX = index of SRSCAN report item text -; -------------------------------------------------------------------------- -align PROC_ALIGN -TSrScan_Helper1: - call TConsole_Cram - mov cl, ATTR_REPORT_VALUE - call TConsole_SetAttr - mcLoadGameDataPtr ebx - ret - -; -------------------------------------------------------------------------- -align PROC_ALIGN -TSrScan_PrintTubesInfo: - mov ecx, 705 - call TConsole_Cram - - mcLoadGameDataPtr esi - movzx eax, [esi + TREKDATA.NPTUBES] - call TConsole_CramInt - - mcLoadGameDataPtr esi - cmp [esi + TREKDATA.QTORPS], 0 - je .close_bracket - cmp [esi + TREKDATA.TORPS], 0 - je .close_bracket - - mov ecx, 706 - call TConsole_Cram - -.close_bracket: - mov al, ')' - call TConsole_PutChar - ret - -; -------------------------------------------------------------------------- -; Input: -; EAX = row index from 1 to 10 -; -------------------------------------------------------------------------- -align PROC_ALIGN -TSrScan_CramStatusRow: - mov cl, ATTR_REPORT_TEXT - call TConsole_SetAttr - - mcOnRegEqu eax, 1, .print_stardate - mcOnRegEqu eax, 2, .print_condition - mcOnRegEqu eax, 3, .print_position - mcOnRegEqu eax, 4, .print_lsupport - mcOnRegEqu eax, 5, .print_warp - mcOnRegEqu eax, 6, .print_energy - mcOnRegEqu eax, 7, .print_torpedoes - mcOnRegEqu eax, 8, .print_shields - mcOnRegEqu eax, 9, .print_klingons - ; - ; Time left - ; - mcLoad8bitsToReg32 ecx, 103 - call TSrScan_Helper1 - - fld [ebx + TREKDATA.REMTIME] - mov cl, 2 - call TConsole_CramFloat - jmp .done - -.print_stardate: - mcLoad8bitsToReg32 ecx, 94 - call TSrScan_Helper1 - - fld [ebx + TREKDATA.DATE] - mov cl, 1 - call TConsole_CramFloat - jmp .done - -.print_condition: - mcLoad8bitsToReg32 ecx, 95 - call TSrScan_Helper1 - - cmp [ebx + TREKDATA.CONDIT], CONDITION_DOCKED - je .do_condition - - push ebx - call TCommon_NewCondition - pop ebx - -.do_condition: - movzx eax, [ebx + TREKDATA.CONDIT] - mov esi, glb_AttrCondition - mov cl, [esi + eax - 1] - call TConsole_SetAttr - - lea ecx, [eax + 103] - call TConsole_Cram - jmp .done - -.print_position: - mcLoad8bitsToReg32 ecx, 96 - call TSrScan_Helper1 - - mov al, [ebx + TREKDATA.QUADX] - mov dl, [ebx + TREKDATA.QUADY] - mcZeroBits ecx - push ebx - call TConsole_CramLoc - - mov al, ',' - call TConsole_PutChar - pop ebx - - mov al, [ebx + TREKDATA.SECTX] - mov dl, [ebx + TREKDATA.SECTY] - mcZeroBits ecx - call TConsole_CramLoc - jmp .done - -.print_lsupport: - mcLoad8bitsToReg32 ecx, 97 - call TSrScan_Helper1 - - mov cl, DEV_LIFE_SUPPORT - call TArray_IsDamaged - jc .L44 - - mcLoad8bitsToReg32 ecx, 108 - call TConsole_Cram - jmp .done - -.L44: - cmp [ebx + TREKDATA.CONDIT], CONDITION_DOCKED - jne .L45 - - mcLoad8bitsToReg32 ecx, 109 - call TConsole_Cram - jmp .done - -.L45: - mcLoad8bitsToReg32 ecx, 110 - push ebx - call TConsole_Cram - pop ebx - - fld [ebx + TREKDATA.LSUPRES] - mov cl, 2 - mov dl, 4 - call TConsole_CramFloatWidth - jmp .done - -.print_warp: - mcLoad8bitsToReg32 ecx, 98 - call TSrScan_Helper1 - - fld [ebx + TREKDATA.WARPFAC] - mov cl, 1 - call TConsole_CramFloat - jmp .done - -.print_energy: - mcLoad8bitsToReg32 ecx, 99 - call TSrScan_Helper1 - - fld [ebx + TREKDATA.ENERGY] - mov cl, 2 - call TConsole_CramFloat - jmp .done - -.print_torpedoes: - mcLoad8bitsToReg32 ecx, 100 - call TSrScan_Helper1 - - movzx eax, [ebx + TREKDATA.TORPS] - call TConsole_CramInt - call TSrScan_PrintTubesInfo - jmp .done - -.print_shields: - mcLoad8bitsToReg32 ecx, 101 - call TSrScan_Helper1 - - mov cl, DEV_SHIELDS - call TArray_IsDamaged - jc .shields_damaged - - movzx ecx, [ebx + TREKDATA.SHLDUP] - add cl, 120 - -.cram_shields_state: - push ebx - call TConsole_Cram - pop ebx - - fld [ebx + TREKDATA.SHLD] - fld [ebx + TREKDATA.INSHLD] - fdivp - fld [glb_dbl_100] - fmulp - frndint - call TCommon_FP_Truncate - push ebx - call TConsole_CramInt - - mcLoad8bitsToReg32 ecx, 111 - call TConsole_Cram - - pop ebx - fld [ebx + TREKDATA.SHLD] - frndint - call TCommon_FP_Truncate - call TConsole_CramInt - - mcLoad8bitsToReg32 ecx, 112 - call TConsole_Cram - jmp .done - -.shields_damaged: - mcLoad8bitsToReg32 ecx, 119 - jmp .cram_shields_state - -.print_klingons: - mcLoad8bitsToReg32 ecx, 102 - call TSrScan_Helper1 - - movzx eax, [ebx + TREKDATA.REMKL] - call TConsole_CramInt - -.done: - ret - -; -------------------------------------------------------------------------- -; STATUS -; -------------------------------------------------------------------------- -align PROC_ALIGN -TSrScan_Status: - call TConsole_ScrollUp - - mcLoad1 eax - mcLoad8bitsToReg32 ecx, 10 - -.dump_row: - push eax ecx - - call TSrScan_CramStatusRow - call TConsole_ScrollUp - - pop ecx eax - inc eax - loop .dump_row - - call TConsole_ScrollUp - ret - -; -------------------------------------------------------------------------- -; REQUEST -; -------------------------------------------------------------------------- -align PROC_ALIGN -TSrScan_Request: - -.L301: - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_ALPHA - je .L303 - -.L302: - mcLoad8bitsToReg32 ecx, 115 - call TGame_Prompt - jmp .L301 - -.L303: - mcLoad8bitsToReg32 edx, 1 - -.check_cmd: - mcLoad8bitsToReg32 ecx, 122 - add ecx, edx - push edx - call TCmdBuf_Crop - pop edx - jc .row_in_EDX - - inc edx - cmp edx, 10 - jbe .check_cmd - ; - ; List possible request items - ; - call TConsole_ScrollUp - call TConsole_SetGameMsgAttr - mcLoad8bitsToReg32 ecx, 116 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 117 - call TConsole_Prout - mcLoad8bitsToReg32 ecx, 118 - call TConsole_Prout - call TConsole_ScrollUp - jmp .L302 - -.row_in_EDX: - push edx - call TConsole_ScrollUp - pop eax - ; - ; Due to mapping we need to swap places of - ; TIME and TORPEDOES request. Basic logic here as follows: - ; - ; IF (EAX == 7) THEN EAX=10 - ; IF (EAX == 10) THEN EAX=7 - ; - mcOnRegEqu eax, 7, .load_10 - mcOnRegEqu eax, 10, .load_7 - -.dump_info: - call TSrScan_CramStatusRow - call TConsole_ScrollUp - call TConsole_ScrollUp - ret - -.load_7: - sub eax, 3 - jmp .dump_info - -.load_10: - add eax, 3 - jmp .dump_info - -; -------------------------------------------------------------------------- -; SRSCAN -; -------------------------------------------------------------------------- -virtual at 0 -loc24: - .bRightSide BOOL ? - .nRow INDEX ? - .size = $ -end virtual -; -------------------------------------------------------------------------- -align PROC_ALIGN -TSrScan_Main: - mcBeginLocals loc24.size - - mov cl, DEV_SR_SENSORS - call TArray_IsDamaged - jnc .proceed - - mcLoadGameDataPtr ebx - cmp [ebx + TREKDATA.CONDIT], CONDITION_DOCKED - jne .not_available - -.proceed: - mcLoad1 eax - mcStoreLocal loc24.bRightSide, eax - mcStoreLocal loc24.nRow, eax - - call TCmdBuf_Scan - cmp [ebx + TCmdBuf.cmdbuf_KEY], CMD_TOKEN_EOL - je .L3 - - mcLoad8bitsToReg32 ecx, 122 - call TCmdBuf_Crop - jnc .L3 - - dec [esp + loc24.bRightSide] - -.L3: - mcLoadLocal ecx, loc24.nRow - mcLoadGameDataPtr ebx - mcLoadMember al, TREKDATA.QUADX - mcLoadMember dl, TREKDATA.QUADY - call TArray_SetStarChartValue - call TArray_SetScanned - - call TConsole_ScrollUp - - mov cl, ATTR_SCAN_SCALE - call TConsole_SetAttr - mcLoad8bitsToReg32 ecx, 113 - call TConsole_Prout - -.dump_row: - mov cl, ATTR_SCAN_SCALE - call TConsole_SetAttr - - mcLoadLocal eax, loc24.nRow - mov cl, 3 - call TConsole_CramIntWidth - - mov al, CHAR_BLANK - call TConsole_PutChar - - mcLoadLocal eax, loc24.nRow - call TSrScan_CramSpaceRow - - cmp [esp + loc24.bRightSide], 0 - je .next_row - - mcLoadLocal eax, loc24.nRow - call TSrScan_CramStatusRow - -.next_row: - call TConsole_ScrollUp - - inc [esp + loc24.nRow] - cmp [esp + loc24.nRow], 10 - jbe .dump_row - - mov cl, ATTR_SCAN_SCALE - call TConsole_SetAttr - mcLoad8bitsToReg32 ecx, 113 - call TConsole_Prout - jmp .done - -.not_available: - call TConsole_SetGameMsgAttr - call TConsole_ScrollUp - mcLoad8bitsToReg32 ecx, 114 - call TConsole_Prout - -.done: - call TConsole_ScrollUp - mcEndLocals loc24.size - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/TString.Asm b/programs/games/StarTrek/trunk/TString.Asm deleted file mode 100644 index c47b937023..0000000000 --- a/programs/games/StarTrek/trunk/TString.Asm +++ /dev/null @@ -1,78 +0,0 @@ -; -------------------------------------------------------------------------- -; FILE: TString.Asm -; DATE: September 21, 2008 -; -------------------------------------------------------------------------- - -; -------------------------------------------------------------------------- -; Input: -; ESI = source string -; EDI = destination string -; -------------------------------------------------------------------------- -align PROC_ALIGN -TString_Copy: - mcZeroBits eax - -.more: - lodsw - stosw - mcOnRegNotZero eax, .more - - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = source string -; EDI = destination string -; -------------------------------------------------------------------------- -align PROC_ALIGN -TString_AnsiCopy: - mcZeroBits eax - -.more: - lodsb - stosb - mcOnRegNotZero eax, .more - - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = string #1 -; EDI = string #2 -; Output: -; CF=1 if strings are same -; -------------------------------------------------------------------------- -align PROC_ALIGN -TString_AnsiEqual: - push esi edi - -.check_both: - cmpsb - jne .ret_false - - cmp byte [esi - 1], 0 - jne .check_both - - pop edi esi - stc - ret - -.ret_false: - pop edi esi - clc - ret - -; -------------------------------------------------------------------------- -; Input: -; ESI = source string -; EDI = destination string -; Output: -; EDI = set to concatenate another string -; -------------------------------------------------------------------------- -align PROC_ALIGN -TString_CopyEx: - call TString_Copy - sub edi, 2 - ret - -; --- EOF --- diff --git a/programs/games/StarTrek/trunk/Win32.Inc b/programs/games/StarTrek/trunk/Win32.Inc deleted file mode 100644 index 90d329f19f..0000000000 --- a/programs/games/StarTrek/trunk/Win32.Inc +++ /dev/null @@ -1,255 +0,0 @@ -; ----------------------------------------------------------- -; Win32 API definitions -; ----------------------------------------------------------- - -; ----------------------------------------------------------- -; Type Alias Section -; ----------------------------------------------------------- - -INT32 equ dd -PINT32 equ dd -INT16 equ dw -SHORT equ dw -WNDPROC equ dd -COUNT equ dd -UINT32 equ dd -UINT8 equ db -WORD equ dw -BYTE equ db -CHAR equ db -PBYTE equ dd -NBYTES equ dd -HICON equ dd -HBRUSH equ dd -HBITMAP equ dd -HCURSOR equ dd -HINSTANCE equ dd -PWCHAR equ dd -PCHAR equ dd -PPCHAR equ dd -PDOUBLE equ dd -PPWCHAR equ dd -WCHARS equ rw -CHARS equ rb -HWND equ dd -DOUBLE equ dt -DOUBLES equ rt -HANDLE equ dd -HFILE equ dd -HDC equ dd -HFONT equ dd -BOOL equ dd -PBOOL equ dd -LONG equ dd -WPARAM equ dd -LPARAM equ dd -INDEX equ dd -COLORREF equ dd -PSIZE equ dd -PVOID equ dd -PCOORD equ dd -FUNCTOR equ dd -PDEVICE equ dd -STRINGS equ rd -INTEGERS equ rd -POINTERS equ rd -COLORREFS equ rd -CHARS equ rb -BYTES equ rb - -; ----------------------------------------------------------- -; Pointers to classes -; ----------------------------------------------------------- - -PTLine equ dd -PTOutputCell equ dd -PTCmdBuf equ dd -PTRandom equ dd -PTPalette equ dd -PTGameState equ dd -PTPlanet equ dd -PTKlingon equ dd -PTCharAttr equ dd -PTLineBuf equ dd -PTConsole equ dd -PTCharacter equ dd - -; ----------------------------------------------------------- -; Constants -; ----------------------------------------------------------- - -HEAP_NO_SERIALIZE = 1 -DEFAULT_CHARSET = 1 -LF_FACESIZE = 32 -IDC_ARROW = 32512 -IDI_EXCLAMATION = 32515 -SM_CXSCREEN = 0 -SM_CYSCREEN = 1 -WS_EX_APPWINDOW = 40000h -WS_THICKFRAME = 40000h -WS_SYSMENU = 80000h -WS_MINIMIZEBOX = 20000h -WS_CAPTION = 0C00000h -WS_OVERLAPPEDWND = WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX -WS_NOSIZEWND = WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX -WM_CREATE = 1 -WM_DESTROY = 2 -WM_PAINT = 0Fh -WM_CLOSE = 10h -WM_ERASEBKGND = 14h -WM_CHAR = 102h -WM_APP = 8000h -MEM_COMMIT = 1000h -MEM_RESERVE = 2000h -MEM_RELEASE = 8000h -PAGE_READWRITE = 4 -SW_SHOWNORMAL = 1 -SM_CYCAPTION = 4 -SM_CXBORDER = 5 -SM_CYBORDER = 6 -LOGPIXELSY = 90 -FW_NORMAL = 400 -CHAR_BACKSPACE = 8 -CHAR_ENTER = 0Dh -CHAR_ESC = 1Bh -CHAR_BLANK = 20h -CHAR_COSMOS = 0B7h -;CHAR_COSMOS = '.' -CHAR_ASTERISK = '*' -CHAR_ENTERPRISE = 'E' -CHAR_FQUEENE = 'F' -CHAR_ZERO = '0' -CHAR_PLANET = 'P' -CHAR_KLINGON = 'K' -CHAR_ROMULAN = 'R' -CHAR_SCOM = 'S' -CHAR_THOLIAN = 'T' -CHAR_WEB = '#' -CHAR_THING = '?' -CHAR_STARBASE = 'B' -CHAR_BLACK_HOLE = '@' -CHAR_COMMA = ',' -CHAR_COMMANDER = 'C' -SRCCOPY = 0CC0020h -FIXED_PITCH = 1 -TRANSPARENT = 1 -TA_UPDATECP = 1 -WHITE_BRUSH = 0 -BLACK_BRUSH = 4 -WM_CUSTOM_CMD_READY = (WM_APP + 1) -WM_CUSTOM_DO_PRELIM = (WM_APP + 2) -WM_CUSTOM_NEW_GAME = (WM_APP + 3) -GENERIC_READ = 80000000h -GENERIC_WRITE = 40000000h -CREATE_ALWAYS = 2 -OPEN_EXISTING = 3 -FILE_FLAG_SEQ_SCAN = 08000000h -FILE_ATTR_DIR = 10h - -; ----------------------------------------------------------- -; Structure Definitions -; ----------------------------------------------------------- - -virtual at 0 -SIZE: - .size_Width INT32 ? - .size_Height INT32 ? - .size = $ -end virtual - -virtual at 0 -RECT: - .rc_Left INT32 ? - .rc_Top INT32 ? - .rc_Right INT32 ? - .rc_Bottom INT32 ? - .size = $ -end virtual - -virtual at 0 -MSG: - .msg_hWnd HWND ? - .msg_uiMsg UINT32 ? - .msg_wParam WPARAM ? - .msg_lParam LPARAM ? - .msg_uiTime UINT32 ? - .msg_xCoord INT32 ? - .msg_yCoord INT32 ? - .size = $ -end virtual - -virtual at 0 -LOGFONT: - .lf_Height LONG ? - .lf_Width LONG ? - .lf_Escapement LONG ? - .lf_Orientation LONG ? - .lf_Weight LONG ? - .lf_Italic UINT8 ? - .lf_Underline UINT8 ? - .lf_StrikeOut UINT8 ? - .lf_CharSet UINT8 ? - .lf_OutPrecision UINT8 ? - .lf_ClipPrecision UINT8 ? - .lf_Quality UINT8 ? - .lf_PitchAndFamily UINT8 ? - .lf_FaceName WCHARS LF_FACESIZE - .size = $ -end virtual - -virtual at 0 -WIN32_FIND_DATA: - .dwAttr UINT32 ? - ._pad1 rd 10 - .strName WCHARS 260 - .strName2 WCHARS 14 - .size = $ -end virtual - -virtual at 0 -SYSTIME: - .wYear WORD ? - .wMonth WORD ? - .wDayOfWeek WORD ? - .wDay WORD ? - .wHour WORD ? - .wMinute WORD ? - .wSecond WORD ? - .wMillisecond WORD ? - .size = $ -end virtual - -virtual at 0 -PAINTSTRUCT: - .hDC HDC ? - .bErase BOOL ? - .rcPaint rb RECT.size - .bRestore BOOL ? - .bIncUpdate BOOL ? - .rgbReserved rb 32 - .size = $ -end virtual - -virtual at 0 -LOCATION: - .coord_X BYTE ? - .coord_Y BYTE ? - .size = $ -end virtual - -virtual at 0 -WNDCLASS: - .wc_style UINT32 ? - .wc_lpfnWndProc WNDPROC ? - .wc_cbClsExtra NBYTES ? - .wc_cbWndExtra NBYTES ? - .wc_hInstance HINSTANCE ? - .wc_hIcon HICON ? - .wc_hCursor HCURSOR ? - .wc_hbrBackground HBRUSH ? - .wc_lpszMenuName PWCHAR ? - .wc_lpszClassName PWCHAR ? - .size = $ -end virtual - -;