The Dink Network

Reply to Re: Help me Revise the DinkC reference.

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
August 4th 2021, 10:50 PM
custom_robj.png
Robj
Jester Male Australia
You feed the madness, and it feeds on you. 
Made some progress on the revision. The breakdown of what I changed (and what I changed it from), or added, is below.

Basing the revision off the DinkC Reference version 4.0, which is the latest, disregarding the physical hard copy book, which is basically a fancy version with images and stuff. I have a copy so am using it to check any differences/extra info that might be missing/incorrect as well.
For text I added that pertains to a specific Engine version, there will be a coloured tag with text in the final version that makes it obvious at a glance. In this thread I'll just be writing what version the additions/changes apply to.

**Changes So Far**

Chapter: What is DinkC?
Addition: Warning message
Applies to: FreeDink 109.6 only
Note that when DEBUG is active the DEBUG.TXT file will quickly grow in size and become bloated by several "Surface doesn't have a colorkey" reports.

===============================================
===============================================

Chapter: Scripts
Addition: Comment character limits.
In Dink Smallwood 1.08 comments have a character limit of 199(including the slashes). Any comments that exceed this limit can cause the game to crash.
This limit does not apply in certain specific circumstances and does not apply in Freedink. For best compatibility, avoid using comments that exceed 199 characters.


Change: Instructions on showing hidden file types. Old instructions were accurate to windows XP and older. New instructions accurate to ALL windows versions.
1. Locate the windows search box (on the task bar or in the start menu)
2. Search for 'Folder Options'
3. Select 'Folder Options' or 'File Explorer Options' (whichever is in your search list)
4. Select the 'View' tab
5. Uncheck the 'Hide extensions for known file types' checkbox.


Addition: Information given on when 'main.c' and 'start.c' are run. Added/changed to:
Main: When the game first starts up or `restart_game()` is called.
Start: When the game first starts up or `restart_game()` is called. After Main.c

===============================================
===============================================

Chapter: Variables
Change: Incorrect limit of local and gloabl variables that can be active at any given time.
FROM 248 TO 249

Change: Incorrect range of 'script number'.
FROM 1-299 TO 1-199

Change: Incorrect range of 'Active sprite number'.
FROM 1-300 TO 1-299

Change: Incorrect range of 'Soundbank Number'.
FROM 1-19 TO 1-20

===============================================
===============================================

Chapter: Procedures
Addition: Notes on changed behaviour and bugs pertaining to custom procedures in 1.08 and FreeDink.
Custom procedures called both externally and from within the same script will run on their own script number. Called procedures will not have access to previously declared local variables.

Calling custom procedures can randomly cause the calling script to continue past `}` and into code afterwards. In some cases it may even continue past a `return;`. A solution to this is using `goto` at the end of the calling procedure, and jump to the end of the script. Check out Jumps. (Jumps is a link that goes to the "Jumps" chapter, explaining 'goto')

Addition: Warning message of broken global procedures.
Note: Global Procedures are Bugged in Dink Smallwood 1.08 and Freedink. You can declare one Global Procedure and it will work fine, but declaring anymore will make none of them work(including the first one), and might cause the game to crash in some instances.

===============================================
===============================================

Chapter: Combat
Change/Addition: Changed the example of what the Dink engine's damage calculation might look in DinkC. Old example was correct for missiles, but wrong for physical hits. Here's the entire new section of step 1(damage calculation), revised and corrected:

Step 1. When Dink or a monster hits the other, a number of hitpoints is randomly selected from the upper half of its strength range. In DinkC terms, you might write it like this:

int &hit_work = sp_strength(<hitting-sprite> , -1);
int &hits = math_mod(&hit_work, 2);
&hit_work / 2;
int &add_remainder = &hit_work;
&add_remainder += &hits;
&hits = random( &add_remainder , &hit_work );
&hits += 1;


While the above example is true for melee combat, the damage calculation works slightly different for missiles.
When the missile's strength is an *odd* value, it's maximum possible damage potential will be one less than it's strength. In DinkC terms, it would look like this:

int &hit_work = sp_strength(<hitting-sprite>, -1);
&hit_work / 2;
int &hits = random(&hit_work, &hit_work);
&hits += 1;

===============================================
===============================================