Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - AGKorson

Pages: 1 ... 16 17 [18] 19
AGI Syntax Help / Re: AGI and changing font
« on: December 29, 2017, 06:40:27 PM »
AGI definitely uses the video card font data for fonts. It does some weird stuff with them though, that I haven't been able to fully decipher. According to MSDOS reference material, there are 8x8 font data for characters 00 - 7Fh at INT 43h (memory location F000:FA6E) and 8x8 font data for characters 80h - FFh at INT 1Fh. When AGI puts characters to screen, it looks like it grabs the font data from INT 43h, regardless of the character value (which explains the garbled output, since >7Fh will be using data outside the range for this location). But during startup, when various DOS interrupt vectors are reassigned, AGI does reassign the vector for INT 1Fh (the extended character data) to the location where each character is output before being sent to the screen. I don't know yet why this is being done, or what effect it ends up having.

Regardless, original Sierra AGI does not display/support extended characters.

But NAGI can; I actually wrote a NAGI font editor ten years ago that you can use to edit/create your own NAGI fonts, including creating characters for all 255 byte codes. I'm attaching the install file for NAGI Font Editor if you want to give it a try; just open one of the *.nbf files included in NAGI to change the fonts however you want. I've also attached a 'spanish' version of the 16x16 font file I used for testing.  (You can also get NFE from -

Note that WinAGI can handle messages using extended codes, if you want to create a sample game to test the fonts in NAGI. BUT, the rich text editor used for syntax highlighting reacts a bit goofy when extended codes are involved, so I'm adding a feature to turn off syntax highlighting in case anyone wants to use extended codes.

But just be aware that while you can use NAGI to display extended characters, AGI input is strictly limited to the regular characters; the text input/parsing routines and words encoding in the WORDS.TOK file were written to explicitly preclude the possibility of entering extended characters as input.

AGI Development Tools / Re: WinAGI 1.2 BETA available for download
« on: December 28, 2017, 01:59:25 AM »
Hi there! Sorry for delayed response- been busy with the holiday.

Amiga OBJECT support is included in 1.2.1. (I forgot to include that in the list of enhancements)

Would you mind trying it out and let me know if it is ok, or if there are any bugs? And if you have a full set of Amiga files for any Sierra games, I'd love to have a copy to help with decompiling efforts.

AGI Syntax Help / Re: AGI Random Number Generator
« on: November 23, 2017, 01:19:12 AM »
I've decompiled the PC versions, and the random function is the same in all of them.

random(byt LOWER, byt UPPER, var vRESULT);

A. The two values passed as LOWER and UPPER are stored on the stack. A third stack variable, DELTA is stored as UPPER-LOWER+1.

B. The AX register is loaded with a 8 bit pseudo-random number by function call rand() as follows:
   -if the RNDSEED(unsigned 16 bit memory location) value is zero, it is loaded with current clock count (the DX value after a call to INT 1Ah), otherwise current RNDSEED value is used
   -a constant value of 7C4Dh is multiplied (unsigned  16 bit) by the RNDSEED value; result stored as 32 bit value in DX:AX
   -AX value (lower 16 bits of result) are incremented by 1
   -AX is then stored as new RNDSEED value
   -AL is XOR'ed with AH
   -AH is cleared
   -AX value returned to calling function (since AH is cleared, result is pseudo-random 8 bit unsigned integer)

C. The random value from B is divided (unsigned 16 bit) by DELTA. Quotient stored in AX, remainder stored in DX

D. Remainder (DX) moved to AX; LOWER added to AX

E. AL stored in vRESULT.

If DELTA is positive, result will be (pseudo)random number between (and including) LOWER and UPPER
If DELTA is zero (i.e. LOWER=UPPER+1), AGI will freeze due to attempted DIVIDE BY ZERO
If DELTA is negative, result will be (pseudo)random number between 0 and 255

The seed value (RNDSEED) is initially set using the cpu internal clock; unless you can manipulate the clock so AGI has the exact same clock count when the rand() function is called each time AGI is run, it's not possible to know the starting seed; thus the pattern of random numbers can't be guessed/calculated easily.

The AGI functions wander(obj oA) and follow.ego(obj oA, byt STEP, flg fDONE) also use the rand() function. Since these will change the seed value, even if you were able to control the initial seed value (by manipulating the internal clock) you need to make sure you account for calls to these functions as well.

NAGI is closest to the original.

AGI Development Tools / Re: Looking for specific versions of AGI files
« on: October 10, 2017, 10:25:01 PM »
Thanks guys. This is very helpful.

AGI Development Tools / Looking for specific versions of AGI files
« on: October 09, 2017, 10:34:40 PM »
Seems awful quiet here in the AGI forum. I guess everyone had a busy summer.

I've made a ton of progress on WinAGI v1.2.2. I'm working on the help file now. To make sure it's as accurate as possible, I've been working with a decompiler on the AGI files. I've been working with primarily with version 2.917, and have it almost fully decompiled, which has led to a ton of new information and corrections regarding the AGI specs.

I've been able to check other versions I have to look for differences among versions, but unfortunately I'm missing a few versions that I would like to have in order to validate my assumptions about what's different.

Years ago, I got a zip file with most DOS versions from someone (I think from MegaTokyo days). But I found out that three of the versions included are not what they seem. The files for v2.425,2.439 and 2.903 all include a version stamp of "2.CBC" in the AGIDATA.OVL file, and have a bit of extra code at the end of the executable that's associated with a Sierra loader for Windows 98 - other than that, they're byte for byte equal to v2.936. It looks like they're from a Windows 98 compatible version of Space Quest that included both SQ1 and SQ2.

So if anyone has the 'real' versions 2.425, 2.439 and 2.903, I'd love to have them for comparison against the other versions I have. Oh, and I don't have any version 1 files; I wouldn't mind getting my hands on those too, but they're less of a need for me.


AGI Development Tools / Re: WinAGI 1.1 BETA available for download
« on: May 22, 2017, 01:08:32 AM »
Here's the list of bug fixes and other changes/additions being worked for v1.2.1:

Please check here to see if any bugs or improvements you want to report are already listed here. As I get feedback, I'll add them to this list, and also track the status of fixes.

AGI Development Tools / Re: WinAGI 1.1 BETA available for download
« on: May 22, 2017, 12:39:59 AM »
Great! Will definitely give this a go as I get time.

The first thing to report is with regards to installation. I assumed I should probably uninstall the earlier version, so I did that. I'm on Windows 8.1. After uninstalling the old version and then executing the installer for the new version, I got two different error messages during installation but neither appears to have stopped the tool from working.

The error messages I saw are shown in the attachment below. The user I installed with is an Administrator.

wshom.ocx is a Windows Scripting Host Object Model wrapper. I used it for folder management when changing a game's directory (which probably isn't going to be done very often). It's old code, and in other places where I need to access directories, I use API calls. I should probably clean this up and replace it with API calls too, so that OCX isn't needed anymore.

Regarding the second error, it's nothing as nefarious as compatibility errors - it's a result of changing some setting variable types between versions and failing to check for it when loading settings. ugh, I should know better. I've already fixed that bug.

I've already identified over 25 new things (either minor bugs [thank goodness no major issues found yet!], or feature improvements) that I'm working on - mostly in Picture Editor and Sound Editor. I'll upload that here and keep it updated as new things are reported so you can avoid reporting what's already known.

Thx all for the feedback!

AGI Development Tools / Re: WinAGI 1.1 BETA available for download
« on: May 18, 2017, 12:41:08 PM »
Your link says 1.1.1, but the file is 1.2.1 :3

Good catch. Fixed.

AGI Development Tools / WinAGI 1.2.1 BETA available for download
« on: May 18, 2017, 07:25:07 AM »
Took a bit longer than I had planned, but here is next version of WinAGI:
WinAGI 1.2.1 BETA

There are a lot of improvements since last version. Here's a short list of the more significant changes:

  • converted Interpreter Version property to string type, so no more errors when trying to open templates when using non-US country settings
  • Better validation of default settings on startup so no more 1 point fonts in editors
  • Colors can be edited in Settings, so custom palettes can be created for pictures and views
  • Graphics features make more use of API calls to manage transparencies, masking. Should improve overall performance as API calls much faster than native VB graphics methods
  • Layout Editor overhauled, significantly improved performance and features; editor is now much more resilient to changes made by user both inside and outside of the editor to rooms and exits
  • added ability to show pics on layout editor as inset to room boxes
  • a ton of picture editor improvements:
  • added ability to resize/reposition background image on picture editor
  • background feature now includes transparency option for drawn image (to see background through the drawn picture)
  • Test Mode in picture editor does not force background to hide and switch to full draw state; user can do tests on partially drawn pictures, and background image can be visible during testing
  • added mousewheel support to Picture Editor to zoom in/out
  • added export feature for picture images (export as bmp, gif, png, tif, jpg), you can export visual image, priority or both
  • new option for cursor highlighting in picture editor: small square for current coordinate; all others marked with x OR original WinAGI, with flashing cursor around selected coordinates and all others not marked
  • added new gif export feature for view loops - you can convert any loop into an animated gif
  • fixed menu editor to extract actual message strings if arguments in the menu commands are local/global defines or variable tag(e.g. m1, m2)
  • double-clicking menu editor lets you change background picture so you can see your how your menu looks against actual in-game pictures
  • compiler warnings are displayed in a separate window; double-click a warning to go directly to corresponding line in logic source
  • made improvements to argument tips feature
  • when using reserved names, they can be viewed in the global defines editor on a separate tab (can't be edited, but can be copied, search-in-logic enabled)
  • diasbled VB syntax as an advertised option. (It is still available as an undocumented feature: on settings form, use Ctrl+Shift+? to show vb option checkbox on Logics tab. In Logic editor, use Alt+S to switch a logic to/from VB syntax)

I haven't updated the Help file yet; I'll do that after I polish things up for full release. I'd love to get as much feedback as I can. If you find a problem/bug, let me know here. The more information you can give to help me reproduce any errors or bugs the better.

If you have any questions about features (old or new),  I'd love to hear those too. WinAGI has a ton of capabilities that many of you probably aren't aware of. Please post those questions in a separate thread, or PM me directly.

I only have the one version... I think. I'll check.

And AGI required more steps because I couldn't just click Export All. So I used SV-CLI to extract and convert the pictures, Paintshop Pro's batch processor to convert them to PNG because PNGOUT wouldn't take them even though it takes any other BMP file I have and ImageMagick frightens me, then another round in PNGOUT to optimize them. Same for QFG3, which crashes SCI Companion's export-all feature. The others only get a combined convert-optimize pass.
If you can wait just a few more days (I plan on realeasing beta of WinAGI 1.2 by 13 May 2017), you'll have a better option. You can export pictures (visual and/or priority) as BMP or GIF, individually, or all at once. I have only implemented these two formats since I haven't had time to figure out how to implement the file format/compression algorithms for PNG and JPG - they're much more complicated. But once you get BMPs or GIFs, I imagine it'd be pretty simple to batch change those into another format using different tool.

That looks really good. I can still see a few pixels here and there that aren't quite right.

What are you using for your line drawing algorithm? The exact algorithm used by Sierra in AGI is pretty simple, and uses only integers. If you implement that algorithm, you'll get lines that come out exactly as Sierra drew them.

Here's a pseudo-code example of the Sierra line algorithm:
Code: [Select]
void drawline(int X1, int Y1, int X2, int Y2)
  //assumes X1 != X2 and Y1 != Y2
  //assumes pset knows correct color to set
  int xPos, yPos, DX, DY, vDir, hDir;
  int XC, YC, MaxDelta, i;
  //determine delta x/delta y and direction
  DY = Y2 - Y1; vDir = (DY<0? -1, 1);
  DX = X2 - X1; hDir = (DX<0? -1, 1);
  //set starting pixel
  xPos = X1; yPos = Y1;

  //invert DX and DY if they are negative
  if(DX < 0) DX *= -1;
  if(DY < 0) DY *= -1;
  //set up the loop, depending on which direction is largest
  if(DX >= DY) {
    MaxDelta = DX;
    YC = DX / 2;
    XC = 0;
  else {
    MaxDelta = DY;
    XC = DY / 2;
    YC = 0;
  //draw line
  for(i == 1; i == MaxDelta; i++) {
    YC += DY;
    if(YC >= MaxDelta) {
      YC -= MaxDelta;
      yPos += vDir;
    XC += DX;
    if(XC >= MaxDelta) {
      XC -= MaxDelta;
      xPos += hDir;
    pset(xpos, ypos);

For plotting, there's good information in the WinAGI help file that explains how to code that, including brush sizes and shapes. For splatter plotting, the actual algorithm that Sierra used is a lot simpler than the bit array in the AGI specifications that has been used for years. Here's the actual Sierra algorithm:
Code: [Select]
//read starting pattern from picture data stream
pattern = pattern | 1
//set starting pixel to first pixel on top row of desired pen shape
do {
    newPatt = pattern >> 2
    if ((pattern & 1) == 1) {
      newPatt = newPatt ^ 0xB8
    pattern = newPatt
    if ((pattern & 3) == 2) {
    //draw this pixel
  //move to next pixel, in left-to-right, top-to-bottom order
while !done //loop until all pixels in desired pen shape are tested

If you haven't already done it, make sure your fill algorithm handles cases where the visual and priority pens are set/not set; if only visual pen is set, fill will use boundary lines it finds in the visual picture; if only priority pen is set, fill will use boundary lines it finds on the priority screen; if both pens are set, fill will set pixels in both images, but will only use the visual screen boundaries it finds.

If you have any questions about AGI resources, take a look at the WinAGI help file - it's got a ton of information. Or you can message me/post here.

Everything-Else / Re: How old is everyone?
« on: April 22, 2017, 12:01:26 PM »
Looks like I'm the greybeard around here. I'm 52. My first computer was a RadioShack Color Computer with a whopping 16K of memory and a cassette tape storage system.

I was in college when Sierra hit its prime, and bought/played most of their games as they were released.

I also remember the Apple Lisa - it came out in '84 IIRC, and we had them in our computer labs at University of Michigan. They were pretty cool. I started writing a text based adventure game about escaping from a prison on the Lisa. All long gone now.

Also remember when the first Macs came out. By then, I was really entrenched in IBM PC/DOS systems, so I never got bit by the Mac bug. I do remember working with Excel for the first time on a Mac and realizing it was a big step forward from Lotus 1-2-3 (in which I had become quite good at writing macros, getting it to do some pretty cool stuff).

What I remember most from those days was the excitement of going to bookstores/software stores, and checking out the latest releases. There was a ton of great stuff being made back those days.

I'm working on a new release of WinAGI. It's got a lot of improvements and bug fixes. Most of the big changes are done (I am still working on an improvement to line editing in the Picture Editor), so hopefully only a few more days of testing, then I'll build and release a beta.

I've decided I need to to something with all the old disk-based games I have - a bunch of Sierra titles, all the AD&D/SSI Goldbox games, a bunch of Microprose games, and others. Hopefully the disks haven't died yet. I was able to get a 5.25 drive USB adaptor, so with that attached to the last system I had with a built-in 3.5 drive, I should be able to capture all the disk images. Maybe this will inspire to play some of them again...

I need to learn C# as well. Once I'm done with WinAGI, I think I'll jump in and see how hard it is for an old dog to learn these fancy new tricks.

I am also trying to get more experience with java because I recently bought a Mazda, and I discovered on the user forums that it's pretty easy to write custom apps for the entertainment system - IF you know java. I wrote a speedometer/clock app, but haven't gotten enough courage to upload it to the car yet. This project's been back-burnered until WinAGI is done.

AGI Development Tools / Re: WinAGI is Back
« on: April 13, 2017, 01:58:31 PM »
I just want to say again that I'm really impressed with the WinAGI help file. I've been using it as the go to place for checking how things work in AGI. It's far more detailed with its explanations of the AGI commands than other sources, and what it says I've been verifying against the interpreter and the original source code fragments and so far it has been spot on.

Nice to know it's useful. I spent a lot of work on that back in the day, mostly by disassembling the interpreters. If there are still questions about how things work, I still have all my disassembly notes, and can usually find answers pretty quickly (depending on nature of question of course!) Oddly enough, I kind of enjoy the process of digging answers out of the assembly code.

AGI Development Tools / Re: WinAGI is Back
« on: April 13, 2017, 01:30:00 PM »
Hello pabuslem, thx for the compliment. I am almost done with the next version of WinAGI - just polishing up a few new added features and tracking down miscellaneous bugs as I find them. If you've had a chance to do much with the last version (1.1.22), I would love to get any feedback on it, in case you've uncovered something I haven't.

For me, my 'return' to AGI honestly is driven mostly by moving from 'kids in the house' to 'kids in college, and eventually on their own'. I wonder if that might be true with some of the rest of you. Anyway, after a long hiatus, I've been spending a lot of time relearning what I used to know, and remembering how much I enjoyed it. I never did write an AGI game myself, but it's still on my to-do list.

I'll post a link to a beta version of WinAGI 1.2.1 soon.

Pages: 1 ... 16 17 [18] 19

SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.031 seconds with 21 queries.