minniat Posted November 11, 2009 Share Posted November 11, 2009 Hi! Today I copied all Dune 2 database from my Amiga hard disk to PC and examined it. There is many interesting stuff worth publishing. I'm working on the WWW page which will contain the informations gathered about Dune 2 sources, but here I would like to publish very interesting thing: Dune 2 main loop! It describes how the things are done during the initiation and gameplay: Dune2 Main Procedure:Allocate memory for dataShow game IntroShow Menu and process menu eventsMain Loop:If House is not specified Ask For HouseClear data buffers - clear various data buffersRead IconsInit Color Convertion tableI called it Buffer Manager - it works on Graphics BuffersIf scenario is not loaded Load New ScenarioSetup Boolean Maps (used for map Shroud)Set Graphics Buffer to 0Process Buttons of graphics user interfaceShow Unit Description at text panelRedraw Side Bar - redraws all side-bar related graphicsProcess Mouse Events - processes selection and map scrollingPrint amount of CreditsGet Key EventProcess All Units on mapProcess All Structures on mapRedraw MapInit Text PanelCheck Win / Lose Conditions. If mission completed exit loopDone! Do you have any questions related to this? Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted November 11, 2009 Share Posted November 11, 2009 looks pretty much the same as C&C :)Though a lot of the checking for keyboard commands, redrawing the sidebar, playing the music, and stuff like that, are all separate threads. Quote Link to comment Share on other sites More sharing options...
minniat Posted November 12, 2009 Author Share Posted November 12, 2009 Here is a Structure Handling - it's very easy:Get First StructureHandle Palace - beacuse it's special buildingUpdate Side BarDo trivial damageUpgrade ProgressRepair ProgressConstruction / Repair Unit progressExecute EMC script for that buildingGet Next StructureDID YOU KNOW that Palace is repaired for free because its HP is very high so the repair costs evaluated by the division is zero! :)Unit Handling is easy too:Timing Stuff - so the handling is performed every period of timeGet First UnitTurret angle stuffMovement / attack stuffRotation stuffDeviated unit stuffExecute EMC script for that unitGet Next UnitGlobal display refreshing is as follows:Display iconmap in current viewDisplay sandwormsDisplay cursorDisplay all ground units in displayDisplay extra animations (this is for example explosions)Display air unitsGreets! I hope it will be of any help for people which write Dune 2 clone projects :) Quote Link to comment Share on other sites More sharing options...
Xaroth Posted November 12, 2009 Share Posted November 12, 2009 Nice work on the list, hopefully OpenDUNE will be able to expand on that list with more detail where it applies, like in this bit:DID YOU KNOW that Palace is repaired for free because its HP is very high so the repair costs evaluated by the division is zero! :)TrueBrain made a post regarding this, to explain it in a bit more detail:http://forum.dune2k.com/index.php?topic=20212.msg348627#msg348627also, one small 'wtf' moment I got.. is the cursor actually being drawn before the rest of the units? Quote Link to comment Share on other sites More sharing options...
minniat Posted November 12, 2009 Author Share Posted November 12, 2009 Thanks for the link.Your question: Yeah, the cursor actually is being redrawn in Unit Drawing part of the routine if the unit is current! So the cursor appears over the current unit. Quote Link to comment Share on other sites More sharing options...
minniat Posted November 12, 2009 Author Share Posted November 12, 2009 Here I attach as a ZIP file Side Bar redrawing procedure translated to C. It contains also many functions and structures that appears in Dune 2. So this is second function (besides seed map generator) which I wrote based on the ASM source. Notice that this function is based on Amiga version of the game thus it refers to some Amiga structures and functions like for example RastPort - this is structure used in rendering into display. Later I will gather all the info into WWW page.All functions in this source are based on original, and this code can be compiled on Amiga to working one (I tested it and it generates SideBar exactly like Dune 2 does). Note that I didn't touch this code for a couple of years, it's copied from my database.Note that the Side Bar rendering function only renders things that were changed since last call to this function.Besides this function I translated to C also the Shape Color Convertion function, Flip Shape function, basic drawing functions like Draw Line and Rect Fill and it's probably all. But I still have much stuff that is incomplete and needs description before I can publish it.Dune2SideBar.zip Quote Link to comment Share on other sites More sharing options...
minniat Posted June 24, 2010 Author Share Posted June 24, 2010 Hey, here's a link to Function List of Amiga version of Dune 2. The list contains only brief description of functions but more detailed description will be placed further on my homepage. The functions are sorted by addresses. Of course it's incomplete list and still needs much work.The begin/end are the addresses in memory where the code was relocated.The type is the CODE, JUMP (jump addresses) or DATAI hope my work will help in OD2 and OpenDune projects. If you have any questions please feel free to write.Here's an example:68167236 68167338 CODEĀ Reveal_Terrain( Pos, Sight )This function reveals terrain at position Pos and within Sight radius.Here's a description of some terms I use:Interface Region - this is just button!Screen Region - this is a part of the screen (map, mini-map, sidebar, topbar etc.)Carrier - this is the container that can be a cell, unit or structure. Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted June 25, 2010 Share Posted June 25, 2010 Nice, thanks for input! BTW, I it seems that the guys from the OpenDUNE don't frequent our forums here, so maybe you'd also post this at their forum too? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.