<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Castle Room Viewer</title>
</head>

<body bgcolor="#000000">

<font face="Terminal,Courier New" size="1" color="#FFFFFF">

<h3>Castle Room Viewer <a href="room_viewer.phps">(source)</a></h3>

<?php
  $fp 
fopen'castle.ran''r' );

  
// room 83 is the text on on the wall
  
for( $room 0$room <= 83$room++ )
  {
    
/*
      18 rows a' 24 chars for the room
      5 rows a' 25 chars for the description text
      18 chars for the locator
    */
    
$buffer fread$fp, (18*24)+(5*25)+18 );
    
$room_buffer substr$buffer0, (18*24) );
    
$text_buffer substr$buffer, (18*24), (5*25) );
    
$locator_buffer substr$buffer, (18*24)+(5*25), 18 );
    
/*
      -> problem: there are no struct/record constructs in php
      in c i could write
      struct room
      {
        char design[18][24];
        char description[5][25];
        char locator[18];
      };
      room map[83];
      fread( fp, &map, sizeof( map ));
    */

    
echo( 'room: '.($room+1).'<br />');
    
    
// room 
    
for( $row 0$row <= 17$row ++ ){
      echo( 
str_replace' ''&nbsp;'substr$room_buffer$row*24,24) ).'<br />' );
    }

    
// the description text
    
for( $row 0$row <= 5$row ++ ){
      echo( 
str_replace' ''&nbsp;'substr($text_buffer,$row*25,25) ).'<br />' );
    }

    
// where can i go
    
echo( $locator_buffer );

    echo(
'<hr />');
  }
  
  
fclose$fp );
?>
</font>
</body>
</html>