Jump to content

Recommended Posts

Posted

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 data
  • Show game Intro
  • Show Menu and process menu events
Main Loop:
  • If House is not specified Ask For House
  • Clear data buffers - clear various data buffers
  • Read Icons
  • Init Color Convertion table
  • I called it Buffer Manager - it works on Graphics Buffers
  • If scenario is not loaded Load New Scenario
  • Setup Boolean Maps (used for map Shroud)
  • Set Graphics Buffer to 0
  • Process Buttons of graphics user interface
  • Show Unit Description at text panel
  • Redraw Side Bar - redraws all side-bar related graphics
  • Process Mouse Events - processes selection and map scrolling
  • Print amount of Credits
  • Get Key Event
  • Process All Units on map
  • Process All Structures on map
  • Redraw Map
  • Init Text Panel
  • Check Win / Lose Conditions. If mission completed exit loop
Done! Do you have any questions related to this?
Posted

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.

Posted

Here is a Structure Handling - it's very easy:

  • Get First Structure
  • Handle Palace - beacuse it's special building
  • Update Side Bar
  • Do trivial damage
  • Upgrade Progress
  • Repair Progress
  • Construction / Repair Unit progress
  • Execute EMC script for that building
  • Get Next Structure

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! :)

Unit Handling is easy too:

  • Timing Stuff - so the handling is performed every period of time
  • Get First Unit
  • Turret angle stuff
  • Movement / attack stuff
  • Rotation stuff
  • Deviated unit stuff
  • Execute EMC script for that unit
  • Get Next Unit

Global display refreshing is as follows:

  • Display iconmap in current view
  • Display sandworms
  • Display cursor
  • Display all ground units in display
  • Display extra animations (this is for example explosions)
  • Display air units

Greets! I hope it will be of any help for people which write Dune 2 clone projects :)

Posted

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#msg348627

also, one small 'wtf' moment I got.. is the cursor actually being drawn before the rest of the units?

Posted

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.

Posted

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

  • 7 months later...
Posted

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 DATA

I 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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.