Anyone remember Moria?

Game development specific discussions.
CommanderRaven
Posts: 86
Joined: Jan 22, 2009 18:52
Location: Houston, tx

Anyone remember Moria?

Post by CommanderRaven »

Hi everyone,

Anyone remember Moria? I'm about 70% done converting the 1987 Moria UB 5.0 source over to Free Basic. I got another 3 or 4 days left to go before I can start debuging my conversion. So far I've got working up to the point of displaying the town level. I got basic movement, and few commands working. But that's it. I've got a bug in the creature module that is preventing creatures from moving... I'll work on that tomorrow.

My conversion is going to be pretty faithful to the original pascal code on the VAX VMS system at the University of Buffalo. No version of Moria that has played on the PC, Unix, or Amiga is based on this version. All PC and non Mainframe versions are based on the 4.83 Unix conversion. Which stopped development back in 1994.

Once I get done with the conversion, and debug it, I'll work on a enhanced version with sound, graphics, etc. Hard part is going to be creating sprites for 295 creatures!

Not to mention attack graphics, 5 character classes, graphics for all of the attacks and magic spells. Sound for all of it.

I'll add a menu, and mouse control. Will always be able to play with the keyboard. But I want to modernize the game's interface.

It's going to be one hell of a project. I was considering a 3D view, but I decided against it. I want to update Moria, I don't want to completely change it's style and gameplay. Basically I want to change it's controls, add graphics, and sound, but I don't want to change the game play.

But anyway, if anyone is interested, I'll post the conversion using text graphics somewhere in a week or two. No idea when the graphic version will be out. I've worked on the conversion, and I've converted roughly 700,000 byte of code so far. I've got another 300,000 bytes of code left. Not bad for 15 days? Also pretty good since I haven't programmed in PASCAL since 1989.

I found the Byref String bug in subs and functions to be interesting. Moria has maybe a 100 or more subs and functions. Hard enough to debug code written in another language without finding a bug in the compiler!

Actually except for a Data type Boolean, Pascal and Free Basic are very similar. The Conversion has been pretty easy. But I wish Free Basic had a BIT data type. A variable you can make a bit. Then "Flag as Bit. Not(Bit) would produce 1 or 0. "

Other than that, just converting the program flow with if's and loops is a real challenge. I find most of my bugs are the End If should have been here, not here. These lines of code belong here, and not inside the if then else statement. Real pain.

I've already mapped out ideas on what to do after I do the graphics overhaul. I'm thinking of making a game server. That way people can play in the same Moria game universe. Should be interesting.... But difficult to do at the same time. I mean how do you create a game server for a TURN based game? I mean do you have to wait for all of the other players to do their turn first? How about just waiting for players on your dungeon level? What if they don't make a turn.... Are you just stuck? What I add timeouts? But then isn't the game almost real time then? I've got months to think about that part. But it is an interesting challenge.

These are the only changes I'm making to the game right now.

1. Title screen with Load Game, New Game options. Load game will now allow you to load from 1 to 10 slots per USERNAME. IE if you run this game from a remote PC, it should have your own save slots.

2. I'm doing away with the restriction of once you die, you can't restore a old save game. I did away with this because it was silly. You can die, start a new game, go into wizard mode, restore your DEAD character and continue. What was the point of keeping this there?

3. I've update the high score list to handle the multiple entries for the same character. Essential, a character cannot get on the high score list more than once. If you are already on there when you die/win, and your score is greater than the one on the list, you replace it. Otherwise nothing happens.

4. I changed save game to choose from 10 save slots... See #1 above.

5. Minimal mouse control. Except for the close button, and maybe choosing a save/load game slot, there will not be any mouse control. Not in the Text version.

Other than that, this should be the same game no one has seen in over 20 years.

Anyone interested?
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

* Raises hand...
rolliebollocks
Posts: 2655
Joined: Aug 28, 2008 10:54
Location: new york

Post by rolliebollocks »

Hey I'm a UB alumni too...

The North Campus is hideous. It looks like someone's aborted game of tetris.

Sorry, don't remember your game...
rdc
Posts: 1741
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Post by rdc »

That is a classic game. It will be cool to see it in FB.
CommanderRaven
Posts: 86
Joined: Jan 22, 2009 18:52
Location: Houston, tx

Game is progressing nicely

Post by CommanderRaven »

Hi everyone. Quick update.

The game is progressing well. I'm about 80%-90% done now.

Here is a link you use to see some screen shots of Moria, and of my other Free Basic game and update to Super Star Trek from the 70's.

Take a look on the screenshot page, scroll down to the TEXT picture of the original Star Trek game. Then scroll down to my unfinished Star Trek game. Should give you a idea of what Moria will look like when I'm done with it!

http://games.tcshouston.net

This link should work be working in the next few minutes.

Once I get a Beta 1 ready, I'll post the files for downloading.

Have fun!

PS. Yes my website is crap! I spend about 10 minutes working on it! And it shows!
rdc
Posts: 1741
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Post by rdc »

Moria looks just like I remember it. Star Trek looks quite good. It will be fun trying both of these out.
Jocke The Beast
Posts: 272
Joined: May 28, 2005 10:21
Contact:

Post by Jocke The Beast »

Cool news!
I've played Moria and Umoria quite alot long time ago (and I still play alot of roguelikes) so this is great news for all of us!
Keep at it :)
CommanderRaven
Posts: 86
Joined: Jan 22, 2009 18:52
Location: Houston, tx

Post by CommanderRaven »

Jocke The Beast wrote:Cool news!
I've played Moria and Umoria quite alot long time ago (and I still play alot of roguelikes) so this is great news for all of us!
Keep at it :)
Well the bad news for Umoria, is that it does not Run on Windows 7 64 Bit. It does run in Dos Box, on Windows 7 though.

My version should run on Windows XP, Vista, or Windows 7. The last release of Umoria was in 1995, 15 years ago! So I think it's time for an update.

In theory 5.0, and 5.1 could be ported to Linux with Free Basic. As they won't be using any libaries or windows dll's per se.

I've added a few more screen shots over at my temporary web site. Here's one of the new ones...

Image

I've got about 90-95% of the code converted. Tracked down some heinious bugs that I created during my conversion. But now the game is semi playable. Should be 90% or better playable by Beta 1.

I plan on releasing BETA 1 this weekend. I encourage everyone to give it a try, and let me know what bugs you find. Trust me there will be bugs! It is BETA 1 release!

But I'm working through every command one at a time, once I get them all working, then it's a matter of trying all spells and prayers.

I've already started outlining the changes I plan to make for the 5.1 release. 6.0 will have a graphic look, simiilar to the original Civilization. Game tiles that represent each creature, and you the player.

Then I'll start animating each class. Spell animation. Sound, background music... Then animate the creatures. It will all be simple sprites animation. Probably 12 by 12 or so. At 1024 by 768 using 12 by 12 sprites, I should be able display the current screen map and still have a little room for stats, messages, and a mini map.

Cool thing about the game, it allows you to adjust the dungeon size, and screen display. So higher resolutions won't be a problem. And even Widescreen displays.

The list goes on and on for the 6.0 release.... Don't expect it anytime soon.

But the 5.0 (I hope final) release should be in a few weeks. I'll release a new Beta once a week, unless someone finds a disasterous bug!

This game is a work in progress. Anyone wanting to help out, just let me know!

Comments, feedback, etc. are always welcome. Just keep in mind, I'm trying not to change the interface on 5.0 at all. I really don't like the message display routine. Actually hate it. And I will replace it in 5.1. Screen size is 640by400 resolution. So running it fullscreen is a joke!

The 5.1 version I'll bump it up to 800 by 600 so I can add a message Window, and a mini map. 6.0 will have require 1024x768 minimum. I should be able to do widescreen, and full screen versions too.

But for now 5.0 is going to be as close as the original as I can make it.

And if anyone is interested, I'll release my source code once I'm done with 5.0, 5.1 and 6.0.

Have fun everyone.
Jocke The Beast
Posts: 272
Joined: May 28, 2005 10:21
Contact:

Post by Jocke The Beast »

Sounds super :)
I'm eager to try the first beta release.
Keep at it!!!!
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

"I found the Byref String bug in subs and functions to be interesting. Moria has maybe a 100 or more subs and functions. Hard enough to debug code written in another language without finding a bug in the compiler!
What do you mean by this?

Actually except for a Data type Boolean, Pascal and Free Basic are very similar. The Conversion has been pretty easy. But I wish Free Basic had a BIT data type. A variable you can make a bit. Then "Flag as Bit. Not(Bit) would produce 1 or 0. "
I agree.
rdc
Posts: 1741
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Post by rdc »

Jocke The Beast
Posts: 272
Joined: May 28, 2005 10:21
Contact:

Post by Jocke The Beast »

I think it's good that you make this step-by-step, by first consentrating on getting a 5.0 release done. I'll be sure to be the first to download the first beta release, I'm really eager to try this old-school Roguelike remade in FB!

One question, how do you convert the source code? Step by step, function by function? Or is there a easier way to convert to FB?

Keep the good work up, the screenshots makes me drewl already!
CommanderRaven
Posts: 86
Joined: Jan 22, 2009 18:52
Location: Houston, tx

Post by CommanderRaven »

Jocke The Beast wrote:I think it's good that you make this step-by-step, by first consentrating on getting a 5.0 release done. I'll be sure to be the first to download the first beta release, I'm really eager to try this old-school Roguelike remade in FB!

One question, how do you convert the source code? Step by step, function by function? Or is there a easier way to convert to FB?

Keep the good work up, the screenshots makes me drewl already!
Well I downloaded the old 5.0 pascal source code. I pulled up the program, it and saw it was broken up in the a small main program with lots of includes. Each include was just a bunch of functions and procedures(Subs in FB). So I simply started with the main program, and almost everything was commented out.

Then I added the first include, and convert each sub and function. I refer to each include a module. IO module handles Input/Output. The type module was all of the data types.

Since the program was broken up in the modules that made sense, and into a million subroutines and functions it was actually best to convert as it was written. And instead of 25,000 lines of code to deal with, now your dealing with 10-50 line code functions/subs. Which isn't so bad to think about. My Star Trek game is 18,000, and 75% finished. This monster is huge! And once I get 6.0 out the door, I bet it will be 50,000 lines of code or more. I took a 1300 line of code Star Trek game and made it 18,000 lines long so far. Now I'm starting with 25,000 lines of code... 300,000 after I'm done? I hope not!

Slowly I converted enough subs and functions the games started to work, and I debugged my conversion.

For the most part the conversion was easy. I had to get created with a few Pascal commands that are not in Free Basic, nor would they be easy to implement. So I found another way to do some things.

This should scare the crap out of most people. This is my Declare.bi which is included in the main program... All it is, are my sub and function declarations!

Code: Select all

Declare Sub gethelp_data () 
Declare Sub display_help (help_level As String)
Declare sub sleeper (int_time As UInteger)
Declare sub no_controly ()
Declare sub controly () 
Declare Sub put_buffer (out_str As String, row As Integer, col As Integer)
Declare Sub flush ()
Declare Sub erase_line ( row As integer,col as integer )
Declare Sub clearscn(row As integer, col as integer)
Declare Sub printscn (str_buff As String,row As Integer, col As Integer)
Declare Sub prt(str_buff As String, row as Integer, col as integer )
declare Sub msg_print(str_buff As String)
Declare Sub pause(prt_line as integer)
Declare Sub pause_exit(prt_line As Integer, delay As integer)
Declare Sub get_paths ()
Declare Sub get_foreign (ByRef filenam As String)    ' --------------  Might need bug patch
Declare Sub tlink ()
Declare Sub mlink ()
Declare Sub init_m_level ()
Declare Sub init_t_level ()
Declare sub price_adjust ()
Declare sub loc_symbol(y As Integer, x as Integer, byref sym As String) '  - Patched for bug in FB
Declare Sub prt_map ()
Declare Sub compact_monsters ()
Declare Sub popm(byref x As integer)
Declare Sub pushm (x as integer)
Declare Sub place_monster(y As integer,x As integer,z as Integer, slp As Byte)
Declare Sub place_win_monster ()
Declare Sub alloc_monster (alloc_set AS obj_set, num As Integer, dis as Integer, slp as byte)
Declare Sub compact_objects ()
Declare Sub popt(byref x As integer)
Declare Sub pusht(x As Integer)
Declare Sub sort_objects ()
Declare Sub magic_treasure(x As Integer ,level As integer)
Declare Sub place_trap(y As integer,x As Integer ,typ As Integer ,subval as integer)
Declare Sub place_rubble(y As Integer ,x as integer)
Declare Sub place_open_door(y As integer,x as integer)
Declare Sub place_broken_door(y As integer,x as integer)
Declare Sub place_closed_door(y As integer,x as integer)
Declare Sub place_locked_door(y As integer,x as integer)
Declare Sub place_stuck_door(y As Integer ,x as integer)
Declare Sub place_secret_door(y As integer,x as integer)
Declare Sub place_door(y As integer,x as integer)
Declare Sub place_up_stairs(y As integer,x as integer)
Declare Sub place_down_stairs(y As integer,x as integer)
Declare Sub place_stairs(typ As Integer, num As Integer ,walls as integer)
Declare Sub place_gold(y As integer,x as integer)
Declare Sub place_object(y As Integer, x as integer)
Declare Sub alloc_object(alloc_set As obj_set,typ As integer, num as Integer)
Declare Sub random_object(y As integer,x As integer,num as integer)
Declare Sub cnv_stat(stat as byteint, ByRef out_val as String)   '------------------  Patch for bug in FB
Declare Sub prt_stat(stat_name As String, stat as byteint, row As Integer, column as Integer)
Declare Sub prt_field(info As String, row As Integer, column as integer)
Declare Sub prt_num(header As String,num As integer,row As integer,column as integer)
Declare Sub prt_title ()
Declare Sub prt_strength ()
Declare Sub prt_intelligence ()
Declare Sub prt_wisdom ()
Declare Sub prt_dexterity ()
Declare Sub prt_constitution ()
Declare Sub prt_charisma ()
Declare Sub prt_level ()
Declare Sub prt_mana ()
Declare Sub prt_mhp ()
Declare Sub prt_chp ()
Declare Sub prt_pac ()
Declare Sub prt_gold ()
Declare Sub prt_cur_weight ()
Declare Sub prt_max_weight ()
Declare Sub prt_depth ()
Declare Sub prt_hunger ()
Declare Sub prt_blind ()
Declare Sub prt_confused ()
Declare Sub prt_afraid ()
Declare Sub prt_poisoned ()
Declare Sub prt_search()
Declare Sub prt_rest ()
Declare Sub prt_winner ()
Declare Sub prt_stat_block ()
Declare Sub draw_cave ()
Declare sub put_character ()
Declare Sub put_stats ()
Declare Sub put_misc1 ()
Declare Sub put_misc2 ()
Declare Sub put_misc3 ()
Declare Sub display_char ()
Declare Sub get_name ()
Declare Sub change_name ()
Declare sub inven_destroy(item_val As integer)
Declare Sub inven_drop(item_val As Integer,y As integer,x as integer)
Declare SUB insert(Posit As integer,wgt as integer)
Declare Sub inven_carry(ByRef item_val as integer)
Declare Sub spell_chance(byref spell as spl_rec)
Declare Sub print_new_spells(spell as spl_type, num As Integer, byref redraw As byte)
Declare Sub gain_mana(amount as integer)
Declare Sub insert_str (ByRef object_str As String, mtc_str As string, insert_str2 As string)  ' -  Byref Patched
Declare Sub insert_num(ByRef object_str as String, mtc_str As String, number As Integer, show_sign As Byte )  ' -  byref patched
Declare Sub char_inven_init ()
Declare Sub blank_cave ()
Declare Sub place_boundry ()
Declare Sub gain_level ()
Declare Sub prt_experience ()
Declare sub dprint(str1 as string, row as integer)
Declare sub print_tomb ()
Declare sub top_forty ()
Declare Sub kingly ()
Declare Sub upon_death ()
Declare Sub ident_char ()
Declare Sub help ()
Declare Sub do_all_mons ()
Declare Sub mon_info ()
Declare Sub wizard_help ()
Declare Sub moria_help(help_level as String)
Declare Sub randes()
Declare Sub rantitle(ByRef title as String) ' -  byref patched
Declare Sub magic_init(random_seed As UInteger)
Declare Sub known1(ByRef object_str As String) ' -  byref patched
Declare Sub known2(ByRef object_str As String) ' -  byref patched
Declare Sub unquote(byref object_str As String) ' -  byref patched
Declare Sub identify(item as treasure_type)
Declare Sub objdes(ByRef out_val as String, ptrn as Integer, pref As byte) ' -  byref patched
Declare Sub add_tohit(a As integer,b As integer,c As Integer,i As Integer, ByRef r As integer)
Declare Sub add_todam(a As integer,b As integer,c As Integer,i As Integer, ByRef r As integer)
Declare Sub add_ac(a As integer,b As integer,c As Integer,i As Integer, ByRef r As integer)
Declare Sub add_toac(a As integer,b As integer,c As Integer,i As Integer, ByRef r As integer)
Declare Sub add_p1(a As integer,b As integer,c As Integer,i As Integer, ByRef r As integer)
Declare Sub add_p1_rods(a As integer,b As integer,c As Integer,i As Integer, ByRef r As integer)
Declare Sub soup_up_black_market(indx As integer)
Declare Sub do_black_market ()
Declare Sub Opusii_vomit(percentage As integer)
Declare Sub intro(ByRef finam as String)  '-----------------   Might need to be patch for FB bug
Declare Sub print_map ()
Declare Sub print_objects ()
Declare Sub print_monsters ()
Declare Sub file_character ()
Declare Sub read_creatures () 
Declare Sub read_data ()
Declare Sub inserter(store_num As Integer,posit As Integer,icost as integer)
Declare sub store_carry ( store_num As Integer, byref ipos as integer)
Declare Sub store_destroy(store_num As integer,item_val as Integer, one_of As byte)
Declare Sub store_init ()
Declare Sub store_create(store_num as integer)
Declare Sub store_maint ()
Declare Sub data_exception ()
Declare Sub data_exception1 ()
Declare Sub coder (byref lined As String)
Declare Sub encrypt(byref lined As String)
Declare Sub decrypt(ByRef lined As String)
Declare Sub restore_char ()
Declare Sub create_character ()
Declare Sub print_history ()
Declare Sub get_history ()
Declare Sub get_ahw ()
Declare Sub get_money ()
Declare Sub correct_dir(byref rdir As Integer, ByRef cdir as Integer, y1 As integer,x1 As integer,y2 As integer,x2 as integer)
Declare Sub rand_dir(byref rdir As Integer, ByRef cdir as Integer, y1 As Integer, x1 As Integer, y2 As Integer, x2 As Integer, chance As integer)
Declare Sub fill_cave(fill as floor_type)
Declare Sub place_streamer(rock as floor_type, treas_chance as integer)
Declare Sub vault_trap(y As Integer,x As integer,yd As integer,xd As integer,num as integer)
Declare Sub vault_monster(y As Integer,x As integer,num As integer)
Declare Sub build_room(yval As Integer,xval as integer)
Declare Sub build_type1(yval As integer,xval as integer)
Declare Sub build_type2(yval As integer,xval as integer)
Declare Sub build_type3(yval As Integer,xval as integer)
Declare Sub tunnel(row1 As integer,col1 As integer,row2 As integer,col2 as integer)
Declare Sub try_door(y As Integer,x As integer)
Declare Sub cave_gen ()
Declare Sub build_store(store_num As Integer,y As integer,x As integer,num_in_row as integer)
Declare Sub town_gen ()
Declare sub generate_cave ()
Declare Sub change_stat2(byref stat as byteint,amount As Integer, factor as integer)
Declare Sub change_speed(num as integer)
Declare Sub py_bonuses(tobj as treasure_type, factor as integer)
Declare Sub show_inven(r1 As Integer,r2 as integer)
Declare Sub show_equip(r1 as integer)
Declare Sub unwear ()
Declare Sub wear ()
Declare Sub switch_weapon ()
Declare Sub panel_bounds ()
Declare Sub move_rec(y1 As integer,x1 As integer,y2 As integer,x2 as integer)
Declare Sub find_light(y1 as integer,x1 as integer,y2 as integer,x2 As integer)
Declare Sub light_room(y As integer,x as integer)
Declare Sub lite_spot(y as Integer,x as integer)
Declare Sub unlite_spot(y As Integer,x as integer)
Declare Sub draw_block(y1 as integer,x1 as integer,y2 as integer,x2 as integer)
Declare Sub sub1_move_light(y1 as integer,x1 as integer,y2 as integer,x2 as integer)
Declare Sub sub2_move_light(y1 as integer,x1 as integer,y2 as integer,x2 as integer)
Declare Sub sub3_move_light(y1 as integer,x1 as integer,y2 as integer,x2 as integer) 
Declare Sub sub4_move_light(y1 as integer,x1 as Integer,y2 as integer,x2 as integer) 
Declare Sub move_light(y1 as integer,x1 as Integer,y2 as integer,x2 as integer)
Declare Sub new_spot(byref y As integer, ByRef x as integer)
Declare Sub search_on ()
Declare Sub search_off ()
Declare Sub rest_off ()
Declare Sub rest ()
Declare Sub take_hit(damage as Integer, hit_from As string)
Declare Sub regenhp(percent As single)
Declare Sub regenmana(percent As single)
Declare Sub change_trap(y as integer,x as integer)
Declare Sub search(y as integer,x as integer,chance as integer)
Declare Sub area_affect(dirt as Integer,y as integer,x as integer)
Declare Sub corrode_gas(kb_str as String)
Declare Sub poison_gas(dam as Integer, kb_str As string)
Declare Sub fire_dam(dam as Integer, kb_str As String)
Declare Sub cold_dam(dam as Integer, kb_str As String)
Declare Sub light_dam(dam as Integer, kb_str As String)
Declare Sub acid_dam(dam as Integer, kb_str As String)
Declare Sub teleport(dis as integer)
Declare Sub hit_trap(ByRef y As integer,ByRef x as integer)
Declare Sub examine_book ()
Declare Sub carry(y As integer,x as integer)
Declare Sub drop ()
Declare Sub delete_monster(i2 as integer)
Declare Sub check_mon_lite(y as Integer,x as integer)
Declare Sub multiply_monster(y as Integer,x as Integer,z as Integer, slp As byte)
Declare Sub summon_object(y as integer,x as integer,num as integer,typ as integer)
Declare Sub monster_death(y As integer,x as Integer, flags As uinteger)
Declare Sub move_char (dirt As Integer)
Declare Sub chest_trap(y As integer,x as integer)
Declare Sub openobject ()
Declare Sub closeobject ()
Declare Sub go_up ()
Declare Sub go_down () 
Declare Sub tunnel2()
Declare Sub disarm_trap ()
Declare Sub look ()
Declare Sub add_food(num as integer)
Declare Sub desc_charges(item_val as Integer)
Declare Sub desc_remain(item_val as integer) 
Declare Sub inven_throw(item_val as integer)
Declare Sub facts(byref tbth as integer,tpth as integer,tdam as integer,tdis as integer)
Declare Sub drop_throw(y as integer,x as integer)
Declare Sub throw_object ()
Declare Sub bash ()
Declare Sub jamdoor ()
Declare Sub refill_lamp ()
Declare Sub dungeon ()
Declare Sub get_flags (Type As Integer, ByRef weapon_type As Integer, ByRef harm_type As Integer, ByRef destroy As obj_set)
Declare Sub lose_exp(amount as integer)
Declare Sub replace_spot(y as integer,x as integer,typ as integer)
Declare Sub game_version ()
Declare Sub wizard_light ()
Declare Sub change_character ()
Declare Sub wizard_create ()
Declare Sub update_mon(monptr as integer)
Declare Sub get_moves(monptr as Integer, byref mm as mm_type)
Declare Sub make_attack(monptr as integer)
Declare Sub creatures (attack As byte)
Declare Sub Read_scroll ()
Declare Sub quaff ()
Declare Sub eat ()
Declare Sub aim ()
Declare Sub use ()
Declare Sub cast_magic ()
Declare Sub pray ()
Declare Sub extra_cast ()
Declare Sub prt_comment1 ()
Declare Sub prt_comment2(offer as integer,asking as integer,final as integer)
Declare Sub prt_comment3(offer as integer,asking as integer,final as integer)
Declare Sub prt_comment4 ()
Declare Sub prt_comment5 ()
Declare Sub prt_comment6 ()
Declare Sub display_commands(store_num As integer)
Declare Sub haggle_commands(typ as integer)
Declare Sub display_inventory(store_num as integer,start as integer)
Declare Sub display_cost(store_num as Integer,posit as integer)
Declare Sub store_prt_gold ()
Declare Sub display_store(store_num as Integer,cur_top as integer)
Declare Sub decrease_insults(store_num as integer)
Declare Sub enter_store(store_num as integer)

' Functions
Declare Function uand(cmove As UInteger, check As String) As UInteger
Declare Function uand2(check As String, cmove As UInteger) As UInteger
Declare Function uand3(check As UInteger, cmove As UInteger) As UInteger
Declare Function uor(check As String, cmove As UInteger) As UInteger
Declare Function uor2(cmove As UInteger,check As String) As UInteger
Declare Function uor3(cmove As UInteger,cmove2 As uinteger) As UInteger
Declare function odd(number As Integer) As Byte
Declare Function pad(basestring As String ,padding As String,length As UInteger) As String
Declare function get_com (prompt As String, ByRef key As string ) As Byte   ' -----------------------   Patched for FB bug
Declare function get_string (ByRef in_str As String,row As integer,column As integer,slen as integer ) As Byte   '---------------  patched for FB bug
Declare function get_hex_value(row As Integer ,col As integer, slen as integer) as Integer
Declare function weight_limit () as integer
Declare function day_num () as Integer
Declare function hour_num () As Integer
Declare function check_time () As Byte
Declare Function randint ( maxval as integer ) as Integer
Declare function get_seed () As UInteger
Declare function rand_rep ( num as Integer, die As integer ) as Integer
Declare function randnor(mean As Integer,stand As integer) As Integer
Declare function bit_pos ( ByRef test As uinteger ) As Integer
Declare function in_bounds(y As integer,x as integer) As Byte
Declare function distance (y1 as Integer, x1 As Integer, y2 as Integer, x2 as integer) as Integer
Declare function next_to4 ( y As integer,x as Integer, group_set as obj_set ) As Integer
Declare function next_to8 (y As integer, x as Integer, group_set as obj_set ) as Integer
Declare function damroll (dice as String) as Integer
Declare function los(y1 As Integer,x1 As Integer,y2 As Integer,x2 as integer) As Byte
Declare function test_light(y As integer,x as integer) As Byte
Declare function max_hp(hp_str as String) as Integer
Declare function summon_monster(ByRef y As Integer, ByRef x As Integer, slp As Byte) As Byte
Declare function summon_undead(ByRef y As integer,ByRef x as integer) As Byte
Declare function magik(chance as integer) as Byte
Declare function m_bonus(base As Integer,max_std As Integer,level as integer) as Integer
Declare function get_obj_num(level as integer) as Integer
Declare function wis_adj () as Integer
Declare function int_adj () As Integer
Declare function chr_adj () As Single
Declare function con_adj () As Integer
Declare function get_hitdie () as Integer
Declare function in_statp(stat as byteint) as byteint
Declare function de_statp(stat as byteint) as byteint
Declare function in_statt(stat as byteint) as byteint
Declare function de_statt(stat As byteint) as byteint
Declare function tohit_adj () as Integer
Declare function toac_adj () As Integer
Declare function todis_adj () As Integer
Declare function todam_adj () As Integer
Declare function likert(x As Integer, y as integer) As String
Declare function inven_damage(typ as obj_set, perc As Integer) As Integer
Declare function inven_check_weight () As Byte
Declare function inven_check_num () As Byte
Declare function get_spell(spell As spl_type, num as Integer, byref sn As Integer, ByRef sc as Integer, prompt as string, byref redraw As byte) As Byte
Declare function learn_spell(byref redraw As byte) As Byte
Declare Function learn_extra(ByRef redraw as Byte) As byte
Declare Function learn_prayer () As Byte
Declare function attack_blows(weight as Integer, ByRef wtohit As Integer) As Integer
Declare function critical_blow(weight As Integer,plus As Integer,dam as integer) as Integer
Declare function mover(direction as Integer, ByRef y As Integer ,ByRef x as integer) As Byte
Declare function player_saves(adjust As integer) As Byte
Declare function get_stat () as Integer
Declare function change_stat(cur_stat As integer,amount as integer) as Integer
Declare function roll_stats(i2 As integer) As Byte
Declare function choose_race () As Byte
Declare function get_class () As Byte
Declare Function get_username () As String
Declare function fill_str (p1 As string) As String
Declare function total_points () As Integer
Declare function search_list(x1 As Integer, x2 as integer) As Integer
Declare function item_value(item as treasure_type) As Integer
Declare function sell_price (snum As Integer, ByRef max_sell As Integer, ByRef min_sell as Integer, item as treasure_type ) as Integer
Declare function store_check_num(store_num as integer) as Byte
Declare function save_char () As Byte
Declare function get_char(fnam As String ) As Byte
Declare Function next_to(y As Integer,x as integer) as Byte
Declare Function check_balrog(mi1 As Integer,mi2 as integer) As Byte
declare Function cur_char1(item_val As integer) As String
Declare function cur_char2(item_val as integer) As String
Declare function inven_command(commander As String, r1 As integer,r2 as integer) As Byte
Declare function remove_item(item_val as integer) as Integer
Declare function get_item( byref com_val as Integer, pmt as string, ByRef redraw As Byte, i1 As Integer,i2 as integer) As Byte
Declare function get_panel(y As integer,x as integer) As Byte
Declare function panel_contains(y As integer,x as integer) As Byte
Declare function no_light () As Byte
Declare function get_dir(prompt As String, ByRef dirt As Integer, ByRef com_val As integer, ByRef y As integer, byref x as integer) As Byte
Declare function maxmin (x As Integer,y As Integer, z As integer ) as Integer
Declare Function minmax (x As Integer,y As Integer, z As integer ) as Integer
Declare function test_hit(bth as integer,level as integer,pth as integer,ac as integer) As Byte
Declare function movement_rate(speed as integer) as Integer
Declare function pick_dir(dirt as integer) As Byte
Declare function minus_ac(typ_dam as integer) As Byte
Declare Function cast_spell(prompt As String, item_val as Integer,ByRef sn As integer,ByRef sc as Integer, ByRef redraw As byte ) As Byte
Declare Function find_range(item_val as obj_set, byref i2 As integer,ByRef i3 as integer) As byte
Declare Function delete_object(y as Integer,x as integer) As Byte
Declare function mon_take_hit(monptr as integer,dam As integer) As Integer
Declare function tot_dam(item as treasure_type, tdam as Integer, monster as creature_type) As Integer
Declare function py_attack(y As integer,x as integer) As Byte
Declare function twall(y as integer,x as integer,t1 as integer,t2 as integer) As Byte
Declare function sleep_monsters2_3(y as integer,x as integer,rad as integer) As Byte
Declare function detect_treasure () As Byte
Declare function detect_object () As Byte
Declare function detect_trap () As Byte
Declare function detect_sdoor () As Byte
Declare function detect_invisible () As Byte
Declare function light_area(y as integer,x as integer) As Byte
Declare function unlight_area(y as integer,x as integer) As Byte
Declare function map_area () As Byte
Declare function ident_spell () As Byte
Declare function aggravate_monster(dis_affect as integer ) As Byte
Declare function trap_creation () As Byte
Declare function door_creation () As Byte
Declare function td_destroy () As Byte
Declare function detect_monsters () As Byte
Declare function light_line(dirt as integer,y as integer,x as integer) As Byte
Declare function starlite(y as Integer,x as Integer) As Byte
Declare function fire_bolt  ( typ As Integer, dirt As Integer, y As Integer, x As Integer, dam As Integer, bolt_typ As String) As Byte
Declare function fire_ball (typ as Integer,dirt as Integer,y as Integer,x as Integer,dam_hp as Integer, descrip As string ) As Byte
Declare function breath (typ as integer,y as integer,x as integer,dam_hp as Integer,ddesc As string ) As Byte
Declare function recharge(num as integer) As Byte
Declare function hp_monster(dirt as integer,y as integer,x as integer,dam as integer) As Byte
Declare function drain_life(dirt as integer,y as integer,x as integer) As Byte
Declare function speed_monster(dirt as integer,y as integer,x as integer,spd as integer) As Byte
Declare function confuse_monster(dirt as integer,y as integer,x as integer) As Byte
Declare function sleep_monster(dirt as integer,y as integer,x as integer) As Byte
Declare function wall_to_mud(dirt as integer,y as integer,x as integer) As Byte
Declare function td_destroy2(dirt as integer,y as integer,x as integer) As Byte
Declare function poly_monster(dirt as integer,y as integer,x as integer) As Byte
Declare function build_wall(dirt as integer,y as integer,x as integer) As Byte
Declare function clone_monster(dirt as Integer,y as integer,x as integer) As Byte
Declare function teleport_away(monptr as integer,dis as integer) As Byte
Declare function teleport_to(ny as integer,nx as integer) As Byte
Declare function teleport_monster(Dirt as integer,y as integer,x as integer) As Byte
Declare function mass_genocide () As Byte
Declare function genocide () As Byte
Declare function speed_monsters(spd as integer) As Byte
Declare function mass_poly () As Byte
Declare function detect_evil () As Byte
Declare function hp_player(num as Integer, kind As string) As Byte
Declare function cure_confusion () As Byte
Declare function cure_blindness () As Byte
Declare function cure_poison () As Byte
Declare function remove_fear () As Byte
Declare function earthquake () As Byte
Declare function protect_evil () As Byte
Declare function create_food () As Byte
Declare function dispell_creature(cflag as Integer, damage as integer) As Byte
Declare function turn_undead () As Byte
Declare function warding_glyph () As Byte
Declare function lose_str () As Byte
Declare function lose_int () As Byte
Declare function lose_wis () As Byte
Declare function lose_dex () As Byte
Declare function lose_con () As Byte
Declare function lose_chr () As Byte
Declare function slow_poison () As Byte
Declare function bless(amount as integer) As Byte
Declare function detect_inv2(amount as integer) As Byte
Declare function destroy_area(y as integer,x as integer) As Byte
Declare function enchant(byref pluses as worlint) As Byte
Declare function remove_curse () As Byte
Declare function restore_level () As Byte
Declare FUNCTION mon_move(monptr as integer) As Byte
Declare function get_store_item(byref com_val as Integer, pmt As String, i1 As integer,i2 as integer) As Byte
Declare function increase_insults(store_num as integer) As Byte
Declare function haggle_insults(store_num as integer) As Byte
Declare Function get_haggle(comment As String, byref num as integer) As Byte
Declare function recieve_offer(store_num As Integer, comment As String, ByRef new_offer As Integer, last_offer As Integer,factor as integer) as Integer
Declare function purchase_haggle(store_num as Integer, byref price as Integer, item As treasure_type) as Integer
Declare function sell_haggle(store_num as Integer, ByRef price as Integer,item as treasure_type) As Integer
Declare function store_purchase(store_num as Integer, ByRef cur_top as integer) As Byte
Declare function store_sell(store_num As Integer,cur_top As integer) As Byte
Declare FUNCTION make_move(monptr as Integer, mm as mm_type) As Byte
Declare FUNCTION mcast_spell( monptr as Integer, byref took_turn As Byte) As Byte
Slowly scroll up and down and you get the idea of the huge task this is to convert, and debug. Monster program. It's even bigger than my star trek game. Ball park 25,000-30,000 lines of code.

And so far I've only worked on it for 22 days.

Beta 1 is coming this weekend.....
CommanderRaven
Posts: 86
Joined: Jan 22, 2009 18:52
Location: Houston, tx

Post by CommanderRaven »

I considered using these commands. As they would allow me to have a single big for control.

But the problem is the source code for the pascal program, just doesn't work right using the FB NOT command. It doesn't work the same way as the NOT in Pascal.

The NOT is Pascal would return TRUE or FALSE.

IF NOT(FLAG) - If flag is false, then this is true. If FLAG is true, then this is FALSE.

The NOT in FB returns true binary inverse of integer value. If it could return a NOT of just a BIT then I could have used the other bit functions.

Bottom line, just not useable in this case. But hey is it really that hard to change the code from IF NOT(FLAG) to IF FLAG=0....

And change FLAG= TRUE to FLAG=1, or FLAG=FALSE to FLAG=0....

Not really....
CommanderRaven
Posts: 86
Joined: Jan 22, 2009 18:52
Location: Houston, tx

Post by CommanderRaven »

agamemnus wrote:
"I found the Byref String bug in subs and functions to be interesting. Moria has maybe a 100 or more subs and functions. Hard enough to debug code written in another language without finding a bug in the compiler!
What do you mean by this?
There is a strange byref bug with strings. I read about on the forum after I was having problems. Say for example

Code: Select all

Sub Alpha (Byref test as string)

test = "Hello"
print test

end sub
From the main program...

Code: Select all

Dim teststr as string

teststr = "erase"

alpha (teststr)

print teststr


This results in
Hello - From the Sub
Hello - From the main program

Ok so far.

However if we do this.

Code: Select all

sub Beta ()

dim testing as string

testing="Tom"

alpha (testing)
print testing

end sub
We change our main program to...

Code: Select all

Dim teststr as string

teststr = "erase"

alpha (teststr)

print teststr

beta



What I saw for output would be like this
Hello - From the Sub Alpha
Hello - From the main program
Hello - From the Sub Alpha
Tom - From Sub Beta

Sub Alpha should have change the string to Hello, but the bug is call a sub or function from another sub or function, and the byref string usually does not work.

I found that single character strings seem to work most of the time.

My "workaround" was to use a temporary global variable. And right before END SUB, I'd assign the global variable the value.

Then in my code that call the sub, the next line after the sub call, I would make the variable that was supposed to change = the global variable.

Πss poor solution per se. But I hope a new version of FB comes out that fixes this bug, and then I can take my patch code out.

It will be easy to remove. Remove the global DIM, then compile, and remove all of the error lines!

Only other way around it would be to use global variables and not use the Byref string command.

But that would have required me to change SO MUCH CODE. Easier to just patch it.

My sample code may actually work right. It was strange some of my subs and functions did work. I could put a print right before the end sub, see the sub had the right value, print right after the sub call, value is back to the original value.

The problem with Moria is this, the main progam is like 100 lines lone. It's just a bunch of includes. A few data definations, and tiny bit of code, and then 4 line loop that calls subs.

So basically the program calls a sub, which calls subs, which calls subs, and functions..... The byref bug really made it a little tough.

Anyway, it's a bug. They happen. It's annoying, but I worked around it.
Post Reply