diff options
Diffstat (limited to 'src/iso')
-rw-r--r-- | src/iso/hackdef.h | 44 | ||||
-rw-r--r-- | src/iso/readme.txt | 6 | ||||
-rw-r--r-- | src/iso/simgraph.c | 1429 | ||||
-rw-r--r-- | src/iso/simgraph.h | 159 | ||||
-rw-r--r-- | src/iso/simsys.h | 197 | ||||
-rw-r--r-- | src/iso/simview.c | 87 | ||||
-rw-r--r-- | src/iso/simview.h | 41 | ||||
-rw-r--r-- | src/iso/walls4.h | 288 | ||||
-rw-r--r-- | src/iso/walls9.h | 288 | ||||
-rw-r--r-- | src/iso/world_adaptor.c | 226 | ||||
-rw-r--r-- | src/iso/world_adaptor.h | 117 | ||||
-rw-r--r-- | src/iso/world_view.c | 499 | ||||
-rw-r--r-- | src/iso/world_view.h | 49 |
13 files changed, 0 insertions, 3430 deletions
diff --git a/src/iso/hackdef.h b/src/iso/hackdef.h deleted file mode 100644 index 413d77ad..00000000 --- a/src/iso/hackdef.h +++ /dev/null @@ -1,44 +0,0 @@ -/* hackdef.h - * - * Copyright (c) 2001 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph<->Angband adaption code. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* hackdef.c - * definion of hacklevel for iso view - * - * Hj. Maltahner, Feb. 2001 - */ - - -/* - * this enables somthing like a bigscreen mode but keeps a - * resonable clean interfacing between iso-view and angband - * this requires changes to map_info() to support clipping. - * - * Hj. Maltahner, Feb. 2001 - */ -#define USE_SMALL_ISO_HACK diff --git a/src/iso/readme.txt b/src/iso/readme.txt deleted file mode 100644 index ecef9638..00000000 --- a/src/iso/readme.txt +++ /dev/null @@ -1,6 +0,0 @@ -The iso view sources will reside here. - -At the moment this is just a test for CVS access. - --- -Hansjoerg Malthaner diff --git a/src/iso/simgraph.c b/src/iso/simgraph.c deleted file mode 100644 index 1797f037..00000000 --- a/src/iso/simgraph.c +++ /dev/null @@ -1,1429 +0,0 @@ -/* simgraph.c - * - * Copyright (c) 2001 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph graphics engine. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/* simgraph.c - * - * Versuch einer Graphic fuer Simulationsspiele - * Hj. Malthaner, Aug. 1997 - * - * A try to create a graphics engine for simulation games. - * - * 3D, isometrische Darstellung - * - * 3D, isometric display - * - * - * 18.11.97 lineare Speicherung fuer Images -> hoehere Performance - * 22.03.00 run längen Speicherung fuer Images -> hoehere Performance - * 15.08.00 dirty tile verwaltung fuer effizientere updates - */ - -//#define DEBUG 1 - - -#if defined(MSDOS) || defined(__MINGW32__) -#define USE_SOFTPOINTER -#endif - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <math.h> - -#include "simgraph.h" -#include "simsys.h" - -extern unsigned int class; -extern unsigned int code; -extern int mx,my; /* es sind negative Koodinaten mgl */ - -#ifdef USE_SOFTPOINTER -static int softpointer = 261; -static int old_my = -1; // die icon leiste muss neu gezeichnet werden wenn der - // Mauszeiger darueber schwebt -#endif - -static unsigned char dr_fonttab[2048]; /* Unser Zeichensatz sitzt hier */ - -/* - * pixel value type, RGB 555 - */ -typedef unsigned short PIXVAL; - - -struct imd { - int y; // offset top - int h; // image height - int len; // data length in entities of PIXVAL size - PIXVAL * data; // iamge data -}; - - -static int anz_images = 0; - -static int disp_width = 640; -static int disp_height = 480; - -/** - * Tile size in pixels - * - * @author Hj. Malthaner - */ -static int tile_size = 32; - -static struct imd *images = NULL; -static struct imd *images1 = NULL; -static struct imd *images2 = NULL; - - -static PIXVAL *textur = NULL; - - -static struct clip_dimension clip_rect; - - -// dirty tile management strcutures - -#define DIRTY_TILE_SIZE 32 -#define DIRTY_TILE_SHIFT 5 - -static char *tile_dirty = NULL; -static char *tile_dirty_old = NULL; - -static int tiles_per_line = 0; -static int tile_lines = 0; - - -// colormap management structures - -static unsigned char day_pal[256*3]; -static unsigned char night_pal[256*3]; -static unsigned char base_pal[256*3]; - -static int light_level = 0; -static int color_level = 1; - - -// ------------ procedure like defines -------------------- - - -#define mark_tile_dirty(x,y) tile_dirty[(x) + (y)*tiles_per_line] = 1 -#define is_tile_dirty(x,y) ((tile_dirty[(x) + (y)*tiles_per_line]) || (tile_dirty_old[(x) + (y)*tiles_per_line]) ) - -// ----------------- procedures --------------------------- - - -/** - * Markiert ein Tile as schmutzig, ohne Clipping - * @author Hj. Malthaner - */ -static void mark_rect_dirty_nc(int x1, int y1, int x2, int y2) -{ - int x, y; - - // floor to tile size - - x1 >>= DIRTY_TILE_SHIFT; - y1 >>= DIRTY_TILE_SHIFT; - x2 >>= DIRTY_TILE_SHIFT; - y2 >>= DIRTY_TILE_SHIFT; - - for(y=y1; y<=y2; y++) { - for(x=x1; x<=x2; x++) { - mark_tile_dirty(x, y); - } - } -} - -/** - * Markiert ein Tile as schmutzig, mit Clipping - * @author Hj. Malthaner - */ -void mark_rect_dirty_wc(int x1, int y1, int x2, int y2) -{ - if(x1 < 0) x1 = 0; - if(x1 >= disp_width) x1 = disp_width-1; - - if(y1 < 0) y1 = 0; - if(y1 >= disp_height) y1 = disp_height-1; - - if(x2 < 0) x2 = 0; - if(x2 >= disp_width) x2 = disp_width-1; - - if(y2 < 0) y2 = 0; - if(y2 >= disp_height) y2 = disp_height-1; - - mark_rect_dirty_nc(x1, y1, x2, y2); -} - -/** - * Clipped einen Wert in Intervall - * @author Hj. Malthaner - */ -static int clip(int w, int u, int o) -{ - return w < u ? u : w > o ? o : w; -} - - -/** - * Laedt den Font - * @author Hj. Malthaner - */ -static void init_font() -{ - FILE *f = NULL; - - // suche in ./draw.fnt - - if(f==NULL ) { - f=fopen("./draw.fnt","rb"); - } - - if(f==NULL) { - printf("Cannot open draw.fnt!\n"); - exit(1); - } else { - int i; - for(i=0;i<2048;i++) dr_fonttab[i]=getc(f); - fclose(f); - } -} - -/** - * Laedt die Palette - * @author Hj. Malthaner - */ -static int -load_palette(const char *fname, unsigned char *palette) -{ - FILE *file = fopen(fname,"rb"); - - if(file) { - - int x; - int anzahl=256; - int r,g,b; - - fscanf(file, "%d", &anzahl); - - for(x=0; x<anzahl; x++) { - fscanf(file,"%d %d %d", &r, &g, &b); - - palette[x*3+0] = r; - palette[x*3+1] = g; - palette[x*3+2] = b; - } - dr_setRGB8multi(0, anzahl, palette); - - fclose(file); - - return TRUE; - } else { - fprintf(stderr, "Error: can't open file '%s' for reading\n", fname); - return FALSE; - } -} - - -/** - * Dims (darkens) a color. - * @return darkended color. - * @author Hj. Malthaner - */ -static inline int darken(const int dunkel, const PIXVAL farbe) -{ - int r,g,b; - - r = (farbe & 0x7C00) - (dunkel << 10); - - if(r < 0) { - r = 0; - } - - g = (farbe & 0x03E0) - (dunkel << 5); - - if(g < 0) { - g = 0; - } - - b = (farbe & 0x001F) - dunkel; - - if(b < 0) { - b = 0; - } - - return (r & 0x7C00) + (g & 0x03E0) + b; -} - - -int display_get_width() -{ - return disp_width; -} - -int display_get_height() -{ - return disp_height; -} - - -/** - * returns the currently used tile size in pixels - * - * @author Hj. Malthaner - */ -int display_get_tile_size() -{ - return tile_size; -} - - -/** - * selects a tile size - * - * @param n 0 means 64x64 tiles, 1 are 32x32 tiles - * @author Hj. Malthaner - */ -void display_select_tile_size(int n) -{ - switch(n) { - case 0: - tile_size = 64; - images = images1; - break; - - case 1: - tile_size = 32; - images = images2; - break; - - default: - tile_size = 64; - images = images1; - } - - printf("Switching to tile size %d\n", tile_size); -} - - -/** - * Holt Helligkeitseinstellungen - * @author Hj. Malthaner - */ -int display_get_light() -{ - return light_level; -} - - -/** - * Setzt Helligkeitseinstellungen - * @author Hj. Malthaner - */ -void display_set_light(int new_light_level) -{ - unsigned char palette[256*3]; - const double ll = 1.0 - light_level/20.0; - int i; - - light_level = new_light_level; - - for(i=0; i<256; i++) { - const int n = i*3; - palette[n+0] = clip(pow(base_pal[n+0]/255.0, ll)*255.0, 0, 255); - palette[n+1] = clip(pow(base_pal[n+1]/255.0, ll)*255.0, 0, 255); - palette[n+2] = clip(pow(base_pal[n+2]/255.0, ll)*255.0, 0, 255); - } - - dr_setRGB8multi(0, 256, palette); -} - -/** - * Holt Farbeinstellungen - * @author Hj. Malthaner - */ -int display_get_color() -{ - return color_level; -} - - -/** - * Setzt Farbeinstellungen - * @author Hj. Malthaner - */ -void display_set_color(int new_color_level) -{ - color_level = new_color_level; - - if(color_level < 0) { - color_level = 0; - } - - if(color_level > 3) { - color_level = 3; - } - - switch(color_level) { - case 0: - load_palette("./simud70.pal", day_pal); - load_palette("./simun70.pal", night_pal); - break; - case 1: - load_palette("./simud80.pal", day_pal); - load_palette("./simun80.pal", night_pal); - break; - case 2: - load_palette("./simud90.pal", day_pal); - load_palette("./simun90.pal", night_pal); - break; - case 3: - load_palette("./simud100.pal", day_pal); - load_palette("./simun100.pal", night_pal); - break; - } - - memcpy(base_pal, day_pal, 256*3); - display_set_light(display_get_light()); -} - - -static int night_shift = -1; - -static void calc_base_pal_from_night_shift(const int night) -{ - const int day = 4 - night; - int i; - - for(i=0; i<256; i++) { - base_pal[i*3+0] = (day_pal[i*3+0] * day + night_pal[i*3+0] * night) >> 2; - base_pal[i*3+1] = (day_pal[i*3+1] * day + night_pal[i*3+1] * night) >> 2; - base_pal[i*3+2] = (day_pal[i*3+2] * day + night_pal[i*3+2] * night) >> 2; - } -} - - -void display_day_night_shift(int night) -{ - if(night != night_shift) { - night_shift = night; - - calc_base_pal_from_night_shift(night); - - display_set_light(light_level); - mark_rect_dirty_nc(0,0, disp_width-1, disp_height-1); - } -} - - - -/** - * Setzt Farbeintrag - * @author Hj. Malthaner - */ -void display_set_player_colors(const unsigned char *day, const unsigned char *night) -{ - memcpy(day_pal, day, 12); - memcpy(night_pal, night, 12); - - calc_base_pal_from_night_shift(night_shift); - - display_set_light(light_level); - mark_rect_dirty_nc(0,0, disp_width-1, disp_height-1); -} - - -/** - * Liest 32Bit wert Plattfromunabhängig - * @author Hj. Malthaner - */ -static int fread_int(FILE *f) -{ - int i = 0; - - i += fgetc(f); - i += fgetc(f) << 8; - i += fgetc(f) << 16; - i += fgetc(f) << 24; - - return i; -} - - -/** - * Laedt daten.pak - * @author Hj. Malthaner - */ -static struct imd * init_images(const char *filename) -{ - FILE *f = fopen(filename, "rb"); - struct imd * images = NULL; - - if( f ) { - int i; - - anz_images = fread_int(f); - images = malloc(sizeof(struct imd)*anz_images); - - - for(i=0; i<anz_images; i++) { - images[i].y = fread_int(f); - images[i].h = fread_int(f); - images[i].len = fread_int(f); - -// printf("len = %d\n", images[i].len); - - if(images[i].h > 0) { - images[i].data = malloc(images[i].len*sizeof(PIXVAL)); - fread(images[i].data, images[i].len*sizeof(PIXVAL), 1, f); - - } else { - images[i].data = NULL; - } - } - - fclose(f); - } else { - printf("Kann '%s' nicht lesen.\n", filename); - exit(1); - } - - return images; -} - -/** - * Holt Maus X-Position - * @author Hj. Malthaner - */ -int gib_maus_x() -{ - return mx; -} - -/** - * Holt Maus y-Position - * @author Hj. Malthaner - */ -int gib_maus_y() -{ - return my; -} - - -/** - * this sets width < 0 if the range is out of bounds - * so check the value after calling and before displaying - * @author Hj. Malthaner - */ -static int clip_wh(int *x, int *width, const int min_width, const int max_width) -{ - // doesnt check "wider than image" case - - if(*x < min_width) { - const int xoff = min_width - (*x); - - *width += *x; - *x = min_width; - return xoff; - } else if(*x + *width >= max_width) { - *width = max_width - *x; - } - return 0; -} - - -/** - * Ermittelt Clipping Rechteck - * @author Hj. Malthaner - */ -struct clip_dimension display_gib_clip_wh(void) -{ - return clip_rect; -} - - -/** - * Setzt Clipping Rechteck - * @author Hj. Malthaner - */ -void display_setze_clip_wh(int x, int y, int w, int h) -{ - clip_wh(&x, &w, 0, disp_width); - clip_wh(&y, &h, 0, disp_height); - - clip_rect.x = x; - clip_rect.y = y; - clip_rect.w = w; - clip_rect.h = h; - - clip_rect.xx = x+w-1; - clip_rect.yy = y+h-1; -} - -// ----------------- basic painting procedures ---------------- - - -/** - * Kopiert Pixel von src nach dest - * @author Hj. Malthaner - */ -static void pixcopy(PIXVAL *dest, - const PIXVAL *src, - int len) -{ - memcpy(dest, src, len*sizeof(PIXVAL)); -} - - -/** - * Zeichnet Bild mit Clipping - * @author Hj. Malthaner - */ -static void -display_img_wc(const int n, const int xp, const int yp, const int dirty) -{ - if(n >= 0 && n < anz_images) { - - int h = images[n].h; - int y = yp + images[n].y; - - int yoff = clip_wh(&y, &h, 0, clip_rect.yy); - - if(h > 0) { - const int width = disp_width; - const PIXVAL *sp = images[n].data; - PIXVAL *tp = textur + y*width; - - if(dirty) { - mark_rect_dirty_wc(xp, y, xp+tile_size-1, y+h+1); - } - - // oben clippen - - while(yoff) { - yoff --; - do { - if(*(++sp)) { - sp += *sp + 1; - } - } while(*sp); - sp ++; - } - - do { // zeilen dekodieren - int xpos = xp; - - // bild darstellen - - int runlen = *sp++; - - do { - // wir starten mit einem clear run - - xpos += runlen; - - // jetzt kommen farbige pixel - runlen = *sp++; - - if(runlen) { - - if(xpos >= 0 && runlen+xpos < width) { -// pixcopy(tp+xpos, sp, runlen); - memcpy(tp+xpos, sp, runlen*sizeof(PIXVAL)); - } else if(xpos < 0) { - if(runlen+xpos > 0) { -// pixcopy(tp, sp-xpos, runlen+xpos); - memcpy(tp, sp-xpos, (runlen+xpos)*sizeof(PIXVAL)); - } - } else if(width > xpos) { -// pixcopy(tp+xpos, sp, width-xpos); - memcpy(tp+xpos, sp, (width-xpos)*sizeof(PIXVAL)); - } - sp += runlen; - xpos += runlen; - runlen = *sp ++; - } - } while(runlen); - - tp += width; - - } while(--h > 0); - } - } -} - -/** - * Zeichnet Bild ohne Clipping - * @author Hj. Malthaner - */ -static void -display_img_nc(const int n, const int xp, const int yp, const int dirty) -{ - if(n >= 0 && n < anz_images) { - - int h = images[n].h; - - if(h > 0) { - const PIXVAL *sp = images[n].data; - PIXVAL *tp = textur + (yp + images[n].y)*disp_width + xp; - - if(dirty) { - mark_rect_dirty_nc(xp, yp+images[n].y, xp+tile_size-1, yp+images[n].y+h-1); - } - - do { // zeilen dekodieren - - // bild darstellen - - int runlen = *sp++; - - do { - - // wir starten mit einem clear run - tp += runlen; - - // jetzt kommen farbige pixel - runlen = *sp++; - - if(runlen) { -// pixcopy(tp, sp, runlen); - memcpy(tp, sp, runlen*sizeof(PIXVAL)); - sp += runlen; - tp += runlen; - runlen = *sp++; - } - } while(runlen); - - tp += (disp_width-tile_size); - - } while(--h); - } - } -} - -/** - * Zeichnet Bild - * @author Hj. Malthaner - */ -void -display_img(const int n, const int xp, const int yp, const int dirty) -{ - if(xp>=0 && yp>=0 && xp < disp_width-tile_size-1 && yp < disp_height-tile_size-1) { - display_img_nc(n, xp, yp, dirty); - } else { - if(xp>-tile_size && yp>-tile_size && xp < disp_width && yp < disp_height) { - display_img_wc(n, xp, yp, dirty); - } - } -} - - - -/** - * Copies and shades colors - * @param shade the amount to darken the color - * @author Hj. Malthaner - */ -static void colorpixcpy(PIXVAL *dest, const PIXVAL *src, - const PIXVAL * const end, - const PIXVAL shade) -{ - while(src < end) { - *dest++ = darken(shade, *src++); - } -} - - -/** - * Zeichnet Bild, ersetzt Spielerfarben - * @author Hj. Malthaner - */ -static void -display_color_img_aux(const int n, const int xp, const int yp, const int color, const int dirty) -{ - if(n >= 0 && n < anz_images) { - - int h = images[n].h; - int y = yp + images[n].y; - - int yoff = clip_wh(&y, &h, 0, clip_rect.yy); - - if(h > 0) { - const int width = disp_width; - const PIXVAL *sp = images[n].data; - PIXVAL *tp = textur + y*width; - -// printf("textur = %p tp = %p\n", textur, tp); - - if(dirty) { - mark_rect_dirty_wc(xp, y+yoff, xp+tile_size-1, y+yoff+h-1); - } - - // oben clippen - - while(yoff) { - yoff --; - do { - if(*(++sp)) { - sp += *sp + 1; - } - } while(*sp); - sp ++; - } - - do { // zeilen dekodieren - int xpos = xp; - - // bild darstellen - - do { - // wir starten mit einem clear run - - xpos += *sp ++; - - // jetzt kommen farbige pixel - - if(*sp) { - const int runlen = *sp++; - - if(xpos >= 0 && runlen+xpos < width) { - colorpixcpy(tp+xpos, sp, sp+runlen, color); - } else if(xpos < 0) { - if(runlen+xpos > 0) { - colorpixcpy(tp, sp-xpos, sp+runlen, color); - } - } else if(width > xpos) { - colorpixcpy(tp+xpos, sp, sp+width-xpos, color); - } - - sp += runlen; - xpos += runlen; - } - } while(*sp); - - tp += width; - sp ++; - - } while(--h); - } - } -} - - -/** - * Zeichnet Bild, ersetzt Farben - * @author Hj. Malthaner - */ -void -display_color_img(const int n, const int xp, const int yp, const int color, const int dirty) -{ - // since the colors for player 0 are already right, - // only use the expensive replacement routine for colored images - // of other players - - // printf("color=%d\n", color); - - if(color) { - display_color_img_aux(n, xp, yp, color, dirty); - } else { - display_img_wc(n, xp, yp, dirty); - } -} - -/** - * Zeichnet ein Pixel - * @author Hj. Malthaner - */ -void -display_pixel(int x, int y, const int color) -{ - if(x >= clip_rect.x && x<=clip_rect.xx && - y >= clip_rect.y && y<clip_rect.yy) { - - PIXVAL * const p = textur + x + y*disp_width; - *p = color; - - mark_tile_dirty(x >> DIRTY_TILE_SHIFT, y >> DIRTY_TILE_SHIFT); - } -} - - -/** - * Zeichnet einen Text, lowlevel Funktion - * @author Hj. Malthaner - */ -static void -dr_textur_text(PIXVAL *textur,int x,int y,const char *txt, - const int chars, const int fgpen, const int dirty) -{ - int p; - - y+=4; /* Korektu amiga <-> pc */ - - if(y < 0 || y+8 >= disp_height) - return; /* out of clip */ - - - if(dirty) { - mark_rect_dirty_nc(x, y, x+chars*8-1, y+8-1); - } - - - for(p=0; p<chars; p++) { /* Zeichen fuer Zeichen ausgeben */ - int base=((unsigned char *)txt)[p] << 3; /* 8 Byte je Zeichen */ - const int end = base+8; - int screen_pos = x + (p << 3) + y*disp_width; - - - do { - const int c=dr_fonttab[base++]; /* Eine Zeile des Zeichens */ - int b; - - for(b=0; b<8; b++) { - if(c & (128 >> b)) { - textur[screen_pos+b] = fgpen; - } - } - screen_pos += disp_width; - }while(base < end); - } -} - - -/** - * Zeichnet Text, highlevel Funktion - * @author Hj. Malthaner - */ -void -display_text(int x, int y, const char *txt, const int color, int dirty) -{ - const int chars = strlen(txt); - const int text_width = chars*8; - - if(y >= 8 && y < disp_height-12) { - - if(x >= 0 && x+text_width < disp_width) { - dr_textur_text(textur, x, y, txt, chars, color, dirty); - } else { - if(x < 0 && x+text_width > 8) { - const int left_chars = (-x+7)/8; - - dr_textur_text(textur, (x & 7), y, txt+left_chars, chars-left_chars, color, dirty); - } else if(x > 0 && x < disp_width-7) { - const int rest_chars = (disp_width-x-1) / 8; - - dr_textur_text(textur, x, y, txt, rest_chars, color, dirty); - } - } - } -} - -/** - * Zeichnet gefuelltes Rechteck, ohne clipping - * @author Hj. Malthaner - */ -void display_fb_internal(int xp, int yp, int w, int h, - const int color, const int dirty, - int cL, int cR, int cT, int cB) -{ - clip_wh(&xp, &w, cL, cR); - clip_wh(&yp, &h, cT, cB); - - if(w > 0 && h > 0) { - PIXVAL *p = textur + xp + yp*disp_width; - - if(dirty) { - mark_rect_dirty_nc(xp, yp, xp+w-1, yp+h-1); - } - - do { - memset(p, color, w*sizeof(PIXVAL)); - p += disp_width; - } while(--h); - } -} - -void -display_fillbox_wh(int xp, int yp, int w, int h, - const int color, const int dirty) -{ - display_fb_internal(xp,yp,w,h,color,dirty, - 0,disp_width-1,0,disp_height-1); -} -void -display_fillbox_wh_clip(int xp, int yp, int w, int h, - const int color, const int dirty) -{ - display_fb_internal(xp,yp,w,h,color,dirty, - clip_rect.x, clip_rect.xx, clip_rect.y, clip_rect.yy); -} - -/** - * Zeichnet vertikale Linie - * @author Hj. Malthaner - */ -void -display_vl_internal(const int xp, int yp, int h, const int color, int dirty, - int cL, int cR, int cT, int cB) -{ - clip_wh(&yp, &h, cT, cB); - - if(xp >= cL && xp <= cR && h > 0) { - PIXVAL *p = textur + xp + yp*disp_width; - - if (dirty) { - mark_rect_dirty_nc(xp, yp, xp, yp+h-1); - } - - do { - *p = color; - p += disp_width; - } while(--h); - } -} - -void -display_vline_wh(int xp, int yp, int h, const int color, const int dirty) -{ - display_vl_internal(xp,yp,h,color,dirty, - 0,disp_width-1,0,disp_height-1); -} - -void -display_vline_wh_clip(int xp, int yp, int h, const int color, const int dirty) -{ - display_vl_internal(xp,yp,h,color,dirty, - clip_rect.x, clip_rect.xx, clip_rect.y, clip_rect.yy); -} - -/** - * Zeichnet rohe Pixeldaten - * @author Hj. Malthaner - */ -void -display_array_wh(int xp, int yp, int w, int h, const unsigned char *arr) -{ - const int arr_w = w; - - clip_wh(&xp, &w, 0, disp_width); - clip_wh(&yp, &h, 0, disp_height); - - if(w > 0 && h > 0) { - PIXVAL *p = textur + xp + yp*disp_width; - - mark_rect_dirty_nc(xp, yp, xp+w-1, yp+h-1); - - if(xp == 0) { - arr += arr_w - w; - } - - do { - // FIXME!!! - memcpy(p, arr, w); - p += disp_width; - arr += arr_w; - } while(--h); - } -} - - -// --------------- compound painting procedures --------------- - - -/** - * Zeichnet schattiertes Rechteck - * @author Hj. Malthaner - */ -void -display_ddd_box(int x1, int y1, int w, int h, int tl_color, int rd_color) -{ - display_fillbox_wh(x1, y1, w, 1, tl_color, TRUE); - display_fillbox_wh(x1, y1+h-1, w, 1, rd_color, TRUE); - - h-=2; - - display_vline_wh(x1, y1+1, h, tl_color, TRUE); - display_vline_wh(x1+w-1, y1+1, h, rd_color, TRUE); -} - -/** - * Zeichnet schattierten Text - * @author Hj. Malthaner - */ -void -display_ddd_text(int xpos, int ypos, int hgt, - int ddd_farbe, int text_farbe, - const char *text, int dirty) -{ - const int len = strlen(text)*4; - - display_fillbox_wh(xpos-2-len, - ypos-hgt-6, - 4 + len*2, 1, - ddd_farbe+1, - dirty); - display_fillbox_wh(xpos-2-len, - ypos-hgt-5, - 4 + len*2, 8, - ddd_farbe, - dirty); - display_fillbox_wh(xpos-2-len, - ypos-hgt+3, - 4 + len*2, 1, - ddd_farbe-1, - dirty); - - display_text(xpos - len, - ypos-hgt-9, - text, - text_farbe, - dirty); -} - - -/** - * Zaehlt Vorkommen eines Buchstabens in einem String - * @author Hj. Malthaner - */ -int -count_char(const char *str, const char c) -{ - int count = 0; - - while(*str) { - count += (*str++ == c); - } - return count; -} - -/** - * Zeichnet einen mehrzeiligen Text - * @author Hj. Malthaner - */ -void -display_multiline_text(int x, int y, const char *inbuf, int color) -{ - char tmp[4096]; - char *buf = tmp; - char *next; - int y_off = 0; - - // be sure not to copy more than buffer size - strncpy(buf, inbuf, 4095); - - // always close with a 0 byte - buf[4095] = 0; - - while( (*buf != 0) && (next = strchr(buf,'\n')) ) { - *next = 0; - display_text(x,y+y_off, buf, color, TRUE); - buf = next+1; - y_off += LINESPACE; - } -} - - -/** - * Loescht den Bildschirm - * @author Hj. Malthaner - */ -void -display_clear() -{ - memset(textur+32*disp_width, 32, disp_width*(disp_height-17-32)); - - mark_rect_dirty_nc(0, 0, disp_width-1, disp_height-1); -} - - -#if 0 -void display_flush_buffer() -{ - int x, y; - char * tmp; - -#ifdef USE_SOFTPOINTER - display_img(softpointer, mx, my, TRUE); - old_my = my; -#endif - -#ifdef DEBUG - // just for debugging - int tile_count = 0; -#endif - - for(y=0; y<tile_lines; y++) { -#ifdef DEBUG - - for(x=0; x<tiles_per_line; x++) { - if(is_tile_dirty(x, y)) { - display_fillbox_wh(x << DIRTY_TILE_SHIFT, - y << DIRTY_TILE_SHIFT, - DIRTY_TILE_SIZE/4, - DIRTY_TILE_SIZE/4, - 3, - FALSE); - - - - dr_textur(x << DIRTY_TILE_SHIFT, - y << DIRTY_TILE_SHIFT, - DIRTY_TILE_SIZE, - DIRTY_TILE_SIZE); - - tile_count ++; - } else { - display_fillbox_wh(x << DIRTY_TILE_SHIFT, - y << DIRTY_TILE_SHIFT, - DIRTY_TILE_SIZE/4, - DIRTY_TILE_SIZE/4, - 0, - FALSE); - - - - dr_textur(x << DIRTY_TILE_SHIFT, - y << DIRTY_TILE_SHIFT, - DIRTY_TILE_SIZE, - DIRTY_TILE_SIZE); - - } - } -#else - x = 0; - - do { - if(is_tile_dirty(x, y)) { - const int xl = x; - do { - x++; - } while(x < tiles_per_line && is_tile_dirty(x, y)); - - dr_textur(xl << DIRTY_TILE_SHIFT, - y << DIRTY_TILE_SHIFT, - (x-xl)<<DIRTY_TILE_SHIFT, - DIRTY_TILE_SIZE); - - } - x++; - } while(x < tiles_per_line); -#endif - } - -#ifdef DEBUG -// printf("%d von %d tiles wurden gezeichnet\n", tile_count, tile_lines*tiles_per_line); -#endif - - dr_flush(); - - // swap tile buffers - tmp = tile_dirty_old; - tile_dirty_old = tile_dirty; - - tile_dirty = tmp; - memset(tile_dirty, 0, tile_lines*tiles_per_line); -} -#endif /* 0 */ - -void display_flush_buffer() -{ - dr_textur(0, 0, disp_width, disp_height); -} - -/** - * Bewegt Mauszeiger - * @author Hj. Malthaner - */ -void display_move_pointer(int dx, int dy) -{ - move_pointer(dx, dy); -} - - -/** - * Schaltet Mauszeiger sichtbar/unsichtbar - * @author Hj. Malthaner - */ -void display_show_pointer(int yesno) -{ -#ifdef USE_SOFTPOINTER - if(yesno) { - softpointer = 261; - } else { - softpointer = 52; - } -#else - show_pointer(yesno); -#endif -} - -/** - * unbenutzt ? - * @author Hj. Malthaner - */ -void -my_save_exit() -{ - dr_os_close(); -} - - -/** - * Inits. Grafikmodul - * @author Hj. Malthaner - */ -int -simgraph_init(int width, int height) -{ - int parameter[2]; - int ok; - - dr_os_init(0, parameter); - - ok = dr_os_open(width, height); - - if(ok) { - - disp_width = dr_get_width(); - disp_height = dr_get_height(); - - textur = dr_textur_init(); - - // not needed for iso-band - // init_font(".drawrc"); - - -// display_set_color(1); - - - images1 = init_images("daten.pak"); - - images2 = init_images("daten2.pak"); - - display_select_tile_size(0); - - printf("Init. done.\n"); - -// dr_use_color(rp, SCHWARZ); -// dr_fillbox_wh(rp, 0, 0, disp_width, WIN_disp_height); - - } else { - puts("Error : can't open window!"); - exit(-1); - } - - - // allocate dirty tile flags - tiles_per_line = (disp_width + DIRTY_TILE_SIZE - 1) / DIRTY_TILE_SIZE; - tile_lines = (disp_height + DIRTY_TILE_SIZE - 1) / DIRTY_TILE_SIZE; - - tile_dirty = malloc( tile_lines*tiles_per_line ); - tile_dirty_old = malloc( tile_lines*tiles_per_line ); - - memset(tile_dirty, 1, tile_lines*tiles_per_line); - memset(tile_dirty_old, 1, tile_lines*tiles_per_line); - - display_setze_clip_wh(0, 0, disp_width, disp_height); - - return TRUE; -} - -/** - * Prueft ob das Grafikmodul schon init. wurde - * @author Hj. Malthaner - */ -int is_display_init() -{ - return textur != NULL; -} - -/** - * Schliest das Grafikmodul - * @author Hj. Malthaner - */ -int -simgraph_exit() -{ - free(tile_dirty); - free(tile_dirty_old); - - - return dr_os_close(); -} - - -/** - * Laedt Einstellungen - * @author Hj. Malthaner - */ -void display_laden(FILE* file) -{ - int i,r,g,b; - - unsigned char day[12]; - unsigned char night[12]; - - fscanf(file, "%d %d %d\n", &light_level, &color_level, &night_shift); - - display_set_light(light_level); - display_set_color(color_level); - - for(i=0; i<4; i++) { - fscanf(file, "%d %d %d\n", &r, &g, &b); - day[i*3+0] = r; - day[i*3+1] = g; - day[i*3+2] = b; - - fscanf(file, "%d %d %d\n", &r, &g, &b); - night[i*3+0] = r; - night[i*3+1] = g; - night[i*3+2] = b; - } - - display_set_player_colors(day, night); -} - - -/** - * Speichert Einstellungen - * @author Hj. Malthaner - */ -void display_speichern(FILE* file) -{ - int i; - fprintf(file, "%d %d %d\n", light_level, color_level, night_shift); - - for(i=0; i<4; i++) { - fprintf(file, "%d %d %d\n", day_pal[i*3+0], day_pal[i*3+1], day_pal[i*3+2]); - fprintf(file, "%d %d %d\n", night_pal[i*3+0], night_pal[i*3+1], night_pal[i*3+2]); - } -} - diff --git a/src/iso/simgraph.h b/src/iso/simgraph.h deleted file mode 100644 index 938edb95..00000000 --- a/src/iso/simgraph.h +++ /dev/null @@ -1,159 +0,0 @@ -/* simgraph.h - * - * Copyright (c) 2001 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph graphics engine. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* simgraph.h - * - * Versuch einer Graphic fuer Simulationsspiele - * Hj. Malthaner, Aug. 1997 - * - * - * 3D, isometrische Darstellung - * - */ - -#ifndef simgraph_h -#define simgraph_h - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -#define LINESPACE 11 - - -struct clip_dimension { - int x, xx, w, y, yy, h; -}; - - -// helper macros - -// save the current clipping and set a new one -#define PUSH_CLIP(x,y,w,h) \ -{\ -const struct clip_dimension p_cr = display_gib_clip_wh(); \ -display_setze_clip_wh(x, y, w, h); - -// restore a saved clipping rect -#define POP_CLIP() \ -display_setze_clip_wh(p_cr.x, p_cr.y, p_cr.w, p_cr.h); \ -} - - -// function prototypes - -int simgraph_init(int width, int height); -int is_display_init(); -int simgraph_exit(); - -int gib_maus_x(); -int gib_maus_y(); - -void mark_rect_dirty_wc(int x1, int y1, int x2, int y2); - - -/** - * returns the currently used tile size in pixels - * - * @author Hj. Malthaner - */ -int display_get_tile_size(); - - -/** - * selects a tile size - * - * @param n 0 means 64x64 tiles, 1 are 32x32 tiles - * @author Hj. Malthaner - */ -void display_select_tile_size(int n); - - - -int display_get_width(); -int display_get_height(); - - -int display_get_light(); -void display_set_light(int new_light_level); - -int display_get_color(); -void display_set_color(int new_color_level); - -void display_day_night_shift(int night); - -//void display_set_rgb(int n, int r, int g, int b); -void display_set_player_colors(const unsigned char *day, const unsigned char *night); - -void display_img(const int n, const int xp, const int yp, const int dirty); -void display_color_img(const int n, const int xp, const int yp, const int color, const int dirty); -void display_fillbox_wh(int xp, int yp, int w, int h, int color, int dirty); -void display_fillbox_wh_clip(int xp, int yp, int w, int h, int color, int d); -void display_vline_wh(const int xp, int yp, int h, const int color, int dirty); -void display_vline_wh_clip(const int xp, int yp, int h, const int c, int d); -void display_clear(); - -void display_flush_buffer(); - -void display_move_pointer(int dx, int dy); -void display_show_pointer(int yesno); - - -void display_pixel(int x, int y, int color); - -void display_ddd_text(int xpos, int ypos, int hgt, - int ddd_farbe, int text_farbe, - const char *text, int dirty); - -void display_text(int x, int y, const char *txt, const int color, int dirty); -void display_array_wh(int xp, int yp, int w, int h, const unsigned char *arr); -void display_ddd_box(int x1, int y1, int w, int h, int tl_color, int rd_color); - -// compound painting routines - -int count_char(const char *str, const char c); -void display_multiline_text(int x, int y, const char *inbuf, int color); - -void zeige_banner(void); - -void display_setze_clip_wh(int x, int y, int w, int h); -struct clip_dimension display_gib_clip_wh(void); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/iso/simsys.h b/src/iso/simsys.h deleted file mode 100644 index c4b7dd6c..00000000 --- a/src/iso/simsys.h +++ /dev/null @@ -1,197 +0,0 @@ -/* simsys.h - * - * Copyright (c) 2001 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph graphics engine. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef simsys_h -#define simsys_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - - -/* Variablen zur Messageverarbeitung */ - -/* Klassen */ - -#define SIM_NOEVENT 0 -#define SIM_MOUSE_BUTTONS 1 -#define SIM_KEYBOARD 2 -#define SIM_MOUSE_MOVE 3 -#define SIM_IGNORE_EVENT 255 - -/* Aktionen */ /* added RIGHTUP and MIDUP */ -#define SIM_MOUSE_LEFTUP 1 -#define SIM_MOUSE_RIGHTUP 2 -#define SIM_MOUSE_MIDUP 3 -#define SIM_MOUSE_LEFTBUTTON 4 -#define SIM_MOUSE_RIGHTBUTTON 5 -#define SIM_MOUSE_MIDBUTTON 6 -#define SIM_MOUSE_MOVED 7 - - -/** - * inits operating system stuff - * @author Hj. Malthaner - */ -int dr_os_init(int n, int *parameter); - - -/** - * opens graphics device/context/window of size w*h - * @param w width - * @param h height - * @author Hj. Malthaner - */ -int dr_os_open(int w, int h); - - -/** - * closes operating system stuff - * @author Hj. Malthaner - */ -int dr_os_close(); - - -/** - * retrieve display width - * @author Hj. Malthaner (hansjoerg.malthaner@gmx.de) - */ -int dr_get_width(); - - -/** - * retrieve display height - * @author Hj. Malthaner (hansjoerg.malthaner@gmx.de) - */ -int dr_get_height(); - - -/** - * creates a (maybe virtual) array of graphics data - * @author Hj. Malthaner - */ -unsigned short * dr_textur_init(); - - -/** - * displays the array of graphics data - * @author Hj. Malthaner - */ -void dr_textur(int xp, int yp, int w, int h); - - -/** - * use this method to flush graphics pipeline (undrawn stuff) onscreen. - * @author Hj. Malthaner - */ -void dr_flush(); - - -/** - * set colormap entries - * @author Hj. Malthaner - */ -void dr_setRGB8multi(int first, int count, unsigned char * data); - - -/** - * display/hide mouse pointer - * @author Hj. Malthaner (hansjoerg.malthaner@gmx.de) - */ -void show_pointer(int yesno); - - -/** - * move mouse pointer - * @author Hj. Malthaner (hansjoerg.malthaner@gmx.de) - */ -void move_pointer(int x, int y); - - -/** - * update softpointer position - * @author Hj. Malthaner (hansjoerg.malthaner@gmx.de) - */ -void ex_ord_update_mx_my(); - - -/** - * get events from the system - * @author Hj. Malthaner (hansjoerg.malthaner@gmx.de) - */ -void GetEvents(); - - -/** - * get events from the system without waiting - * @author Hj. Malthaner (hansjoerg.malthaner@gmx.de) - */ -void GetEventsNoWait(); - - -/** - * @returns time since progrma start in milliseconds - * @author Hj. Malthaner - */ -long long dr_time(void); - - -/** - * sleeps some microseconds - * @author Hj. Malthaner - */ -void dr_sleep(unsigned long usec); - - -/** - * loads a sample - * @return a handle for that sample or -1 on failure - * @author Hj. Malthaner - */ -int dr_load_sample(const char *filename); - - -/** - * plays a sample - * @param key the key for the sample to be played - * @author Hj. Malthaner - */ -void dr_play_sample(int key, int volume); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/src/iso/simview.c b/src/iso/simview.c deleted file mode 100644 index 4e972841..00000000 --- a/src/iso/simview.c +++ /dev/null @@ -1,87 +0,0 @@ -/* simview.c - * - * Copyright (c) 2001,2002 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#include "simview.h" -#include "world_view.h" -#include "world_adaptor.h" -#include "simgraph.h" - - -/** - * Draws the full iso-view display - * @author Hj. Malthaner - */ -void display() -{ - const int IMG_SIZE = display_get_tile_size(); - - const int const_x_off = display_get_width()/2 + get_x_off(); - const int dpy_width = display_get_width()/IMG_SIZE + 2; - const int dpy_height = (display_get_height()*4)/IMG_SIZE; - - - const int i_off = get_i_off(); - const int j_off = get_j_off(); - - int x,y; - -// puts("displaying"); - - - // Hajo: draw grounds first - - for(y=-5; y<dpy_height+10; y++) { - const int ypos = y*IMG_SIZE/4+16 + get_y_off(); - - for(x=-dpy_width + (y & 1); x<=dpy_width+2; x+=2) { - - const int i = ((y+x) >> 1) + i_off; - const int j = ((y-x) >> 1) + j_off; - const int xpos = x*IMG_SIZE/2 + const_x_off; - - display_boden(i, j, xpos, ypos); - } - } - - // Hajo: then draw the objects - - for(y=-5; y<dpy_height+10; y++) { - const int ypos = y*IMG_SIZE/4+16 + get_y_off(); - - for(x=-dpy_width + (y & 1); x<=dpy_width+2; x+=2) { - - const int i = ((y+x) >> 1) + i_off; - const int j = ((y-x) >> 1) + j_off; - const int xpos = x*IMG_SIZE/2 + const_x_off; - - - display_dinge(i, j, xpos, ypos); - } - } -} - diff --git a/src/iso/simview.h b/src/iso/simview.h deleted file mode 100644 index a1cac864..00000000 --- a/src/iso/simview.h +++ /dev/null @@ -1,41 +0,0 @@ -/* simview.h - * - * Copyright (c) 2001, 2002 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph graphics engine. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef simview_h -#define simview_h - - -/** - * Draws the full iso-view display - * @author Hj. Malthaner - */ -void display(); - - -#endif diff --git a/src/iso/walls4.h b/src/iso/walls4.h deleted file mode 100644 index 5f57d09e..00000000 --- a/src/iso/walls4.h +++ /dev/null @@ -1,288 +0,0 @@ -/* walls4.h - * - * Copyright (c) 2001 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph<->Angband adaption code. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -int wall_table[256] = -{ -0, // 0 -0, // 1 -2, // 2 -0, // 3 -0, // 4 -0, // 5 -0, // 6 -0, // 7 -1, // 8 -0, // 9 -3, // 10 -3, // 11 -0, // 12 -0, // 13 -3, // 14 -3, // 15 -4, // 16 -0, // 17 -6, // 18 -6, // 19 -0, // 20 -0, // 21 -6, // 22 -0, // 23 -5, // 24 -5, // 25 -7, // 26 -0, // 27 -5, // 28 -0, // 29 -7, // 30 -5, // 31 -0, // 32 -0, // 33 -0, // 34 -0, // 35 -0, // 36 -0, // 37 -0, // 38 -0, // 39 -0, // 40 -0, // 41 -0, // 42 -0, // 43 -0, // 44 -0, // 45 -0, // 46 -0, // 47 -0, // 48 -0, // 49 -0, // 50 -0, // 51 -0, // 52 -0, // 53 -0, // 54 -0, // 55 -5, // 56 -5, // 57 -0, // 58 -0, // 59 -5, // 60 -0, // 61 -0, // 62 -0, // 63 -8, // 64 -0, // 65 -10, // 66 -10, // 67 -0, // 68 -0, // 69 -10, // 70 -10, // 71 -9, // 72 -9, // 73 -0, // 74 -10, // 75 -0, // 76 -0, // 77 -0, // 78 -0, // 79 -12, // 80 -0, // 81 -0, // 82 -0, // 83 -0, // 84 -0, // 85 -10, // 86 -0, // 87 -13, // 88 -0, // 89 -0, // 90 -0, // 91 -13, // 92 -0, // 93 -0, // 94 -0, // 95 -0, // 96 -0, // 97 -10, // 98 -0, // 99 -0, // 100 -0, // 101 -10, // 102 -0, // 103 -9, // 104 -0, // 105 -10, // 106 -10, // 107 -0, // 108 -0, // 109 -0, // 110 -10, // 111 -12, // 112 -0, // 113 -0, // 114 -0, // 115 -0, // 116 -0, // 117 -0, // 118 -0, // 119 -0, // 120 -12, // 121 -0, // 122 -0, // 123 -0, // 124 -0, // 125 -0, // 126 -0, // 127 -0, // 128 -0, // 129 -0, // 130 -0, // 131 -0, // 132 -0, // 133 -0, // 134 -0, // 135 -0, // 136 -0, // 137 -0, // 138 -0, // 139 -0, // 140 -0, // 141 -0, // 142 -0, // 143 -0, // 144 -0, // 145 -0, // 146 -6, // 147 -0, // 148 -0, // 149 -0, // 150 -0, // 151 -5, // 152 -5, // 153 -0, // 154 -0, // 155 -5, // 156 -0, // 157 -0, // 158 -0, // 159 -0, // 160 -0, // 161 -0, // 162 -0, // 163 -0, // 164 -0, // 165 -0, // 166 -0, // 167 -0, // 168 -0, // 169 -0, // 170 -0, // 171 -0, // 172 -0, // 173 -0, // 174 -0, // 175 -0, // 176 -0, // 177 -0, // 178 -0, // 179 -0, // 180 -0, // 181 -0, // 182 -0, // 183 -5, // 184 -0, // 185 -7, // 186 -0, // 187 -0, // 188 -0, // 189 -0, // 190 -0, // 191 -0, // 192 -0, // 193 -10, // 194 -10, // 195 -0, // 196 -0, // 197 -0, // 198 -0, // 199 -9, // 200 -0, // 201 -0, // 202 -0, // 203 -0, // 204 -0, // 205 -0, // 206 -0, // 207 -12, // 208 -0, // 209 -10, // 210 -0, // 211 -0, // 212 -0, // 213 -10, // 214 -10, // 215 -0, // 216 -0, // 217 -0, // 218 -0, // 219 -0, // 220 -0, // 221 -0, // 222 -0, // 223 -0, // 224 -0, // 225 -10, // 226 -0, // 227 -0, // 228 -0, // 229 -0, // 230 -0, // 231 -0, // 232 -0, // 233 -0, // 234 -10, // 235 -0, // 236 -0, // 237 -0, // 238 -0, // 239 -0, // 240 -0, // 241 -14, // 242 -0, // 243 -0, // 244 -0, // 245 -10, // 246 -0, // 247 -5, // 248 -0, // 249 -0, // 250 -0, // 251 -0, // 252 -0, // 253 -0, // 254 -0, // 255 -}; diff --git a/src/iso/walls9.h b/src/iso/walls9.h deleted file mode 100644 index 038dadf1..00000000 --- a/src/iso/walls9.h +++ /dev/null @@ -1,288 +0,0 @@ -/* walls9.h - * - * Copyright (c) 2001 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph<->Angband adaption code. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -int wall_table[256] = -{ -0, // 0 -1, // 1 -2, // 2 -3, // 3 -4, // 4 -5, // 5 -2, // 6 -7, // 7 -8, // 8 -8, // 9 -10, // 10 -11, // 11 -12, // 12 -13, // 13 -10, // 14 -11, // 15 -16, // 16 -17, // 17 -18, // 18 -18, // 19 -16, // 20 -21, // 21 -22, // 22 -22, // 23 -24, // 24 -24, // 25 -26, // 26 -27, // 27 -24, // 28 -24, // 29 -30, // 30 -31, // 31 -32, // 32 -33, // 33 -34, // 34 -35, // 35 -36, // 36 -37, // 37 -38, // 38 -39, // 39 -40, // 40 -41, // 41 -10, // 42 -43, // 43 -44, // 44 -45, // 45 -46, // 46 -47, // 47 -48, // 48 -49, // 49 -50, // 50 -51, // 51 -52, // 52 -53, // 53 -54, // 54 -55, // 55 -24, // 56 -24, // 57 -58, // 58 -27, // 59 -24, // 60 -61, // 61 -62, // 62 -31, // 63 -64, // 64 -65, // 65 -66, // 66 -66, // 67 -68, // 68 -69, // 69 -66, // 70 -66, // 71 -72, // 72 -72, // 73 -74, // 74 -75, // 75 -76, // 76 -77, // 77 -74, // 78 -75, // 79 -80, // 80 -81, // 81 -82, // 82 -82, // 83 -80, // 84 -85, // 85 -86, // 86 -86, // 87 -88, // 88 -88, // 89 -90, // 90 -91, // 91 -88, // 92 -93, // 93 -94, // 94 -95, // 95 -64, // 96 -97, // 97 -66, // 98 -66, // 99 -100, // 100 -101, // 101 -66, // 102 -103, // 103 -104, // 104 -105, // 105 -106, // 106 -107, // 107 -108, // 108 -109, // 109 -106, // 110 -107, // 111 -80, // 112 -113, // 113 -82, // 114 -115, // 115 -116, // 116 -117, // 117 -118, // 118 -119, // 119 -120, // 120 -121, // 121 -122, // 122 -123, // 123 -124, // 124 -125, // 125 -126, // 126 -127, // 127 -128, // 128 -129, // 129 -130, // 130 -131, // 131 -132, // 132 -133, // 133 -134, // 134 -135, // 135 -136, // 136 -137, // 137 -138, // 138 -139, // 139 -140, // 140 -141, // 141 -142, // 142 -143, // 143 -16, // 144 -145, // 145 -18, // 146 -147, // 147 -148, // 148 -149, // 149 -22, // 150 -22, // 151 -24, // 152 -24, // 153 -154, // 154 -155, // 155 -24, // 156 -157, // 157 -158, // 158 -31, // 159 -160, // 160 -161, // 161 -66, // 162 -163, // 163 -164, // 164 -165, // 165 -166, // 166 -167, // 167 -168, // 168 -169, // 169 -170, // 170 -171, // 171 -172, // 172 -173, // 173 -174, // 174 -175, // 175 -176, // 176 -177, // 177 -178, // 178 -179, // 179 -180, // 180 -181, // 181 -182, // 182 -183, // 183 -24, // 184 -185, // 185 -26, // 186 -187, // 187 -24, // 188 -189, // 189 -190, // 190 -31, // 191 -64, // 192 -193, // 193 -66, // 194 -66, // 195 -196, // 196 -197, // 197 -66, // 198 -66, // 199 -72, // 200 -201, // 201 -74, // 202 -203, // 203 -204, // 204 -205, // 205 -206, // 206 -207, // 207 -208, // 208 -209, // 209 -210, // 210 -211, // 211 -208, // 212 -213, // 213 -214, // 214 -214, // 215 -216, // 216 -217, // 217 -218, // 218 -219, // 219 -220, // 220 -221, // 221 -222, // 222 -223, // 223 -224, // 224 -225, // 225 -66, // 226 -227, // 227 -228, // 228 -229, // 229 -230, // 230 -231, // 231 -104, // 232 -233, // 233 -234, // 234 -107, // 235 -236, // 236 -237, // 237 -238, // 238 -239, // 239 -208, // 240 -241, // 241 -210, // 242 -243, // 243 -244, // 244 -245, // 245 -214, // 246 -214, // 247 -248, // 248 -248, // 249 -250, // 250 -251, // 251 -248, // 252 -248, // 253 -254, // 254 -255, // 255 -}; diff --git a/src/iso/world_adaptor.c b/src/iso/world_adaptor.c deleted file mode 100644 index a483780f..00000000 --- a/src/iso/world_adaptor.c +++ /dev/null @@ -1,226 +0,0 @@ -/* world_adaptor.cc - * - * Copyright (c) 2001, 2002 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph<->Angband adaption code. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* world_adaptor.c - * - * adaption between angband world and simugraph data model - * Hj. Maltahner, Jan. 2001 - */ - -#include "hackdef.h" - -#include "world_adaptor.h" -#include "world_view.h" -#include "simview.h" -#include "simgraph.h" - -#undef MIN -#undef MAX - -#include "../angband.h" - - -/* - * Highlit location - */ -int high_x = -1; -int high_y = -1; - -/** - * remember targetted location - * (hook is ToME3 only, for now) - * @author J. Frieling - */ -bool iso_target_hook(char* fmt) -{ - high_y = get_next_arg(fmt); - high_x = get_next_arg(fmt); - - return FALSE; -} - -/** - * Highlite (mark) location x,y - * @author Hj. Malthaner - */ -void highlite_spot(int x, int y) -{ - high_x = x; - high_y = y; -} - - -/** - * Grid type, default is grid for items and monsters - * 0: No grid - * 1: Item/monster grid - * 2: Full grid - * @author Hj. Malthaner - */ -static int grid = 1; - - -/** - * Show shadow below items and monsters? - * 0 = no - * 1 = yes - * @author Hj. Malthaner - */ -//int shadow = 1; - - -/** - * Set a grid type (takes argument modulo 3) - * @author Hj. Malthaner - */ -void set_grid(int no) -{ - grid = no % 3; -} - - -/** - * Show which grid type ? - * @author Hj. Malthaner - */ -int get_grid() -{ - return grid; -} - - -/** - * Turn shadows on/off (0=off, 1=on) - * @author Hj. Malthaner - */ -/*void set_shadow(int yesno) -{ - shadow = yesno; -} -*/ - - -/** - * Determines i-offset of the watch point - * @author Hj. Malthaner - */ -int get_i_off() -{ - const int p_off = display_get_width() >> 7; - const int mult = display_get_tile_size() == 32 ? 2 : 1; - -#ifdef USE_SMALL_ISO_HACK - - int i_off; - - if(p_ptr) { - i_off = p_ptr->px-p_off*mult; - } - - return i_off; -#else - - return 47-p_off; - - -#endif -} - - -/** - * Determines j-offset of the watch point - * @author Hj. Malthaner - */ -int get_j_off() -{ - const int p_off = display_get_width() >> 7; - const int mult = display_get_tile_size() == 32 ? 2 : 1; - -#ifdef USE_SMALL_ISO_HACK - - int j_off; - if(p_ptr) { - j_off = p_ptr->py-p_off*mult; - } - - return j_off; -#else - - return 10-p_off; - -#endif -} - - - -/** - * Ermittelt x-Offset gescrollter Karte - * @author Hj. Malthaner - */ -int get_x_off() -{ - return 0; -} - - -/** - * Ermittelt y-Offset gescrollter Karte - * @author Hj. Malthaner - */ -int get_y_off() -{ - return 0; -} - - - -int init_adaptor() -{ - printf("Preparing display ...\n"); - simgraph_init(672, 480); - - return TRUE; -} - - -int refresh_display() -{ - display(); - display_flush_buffer(); - - return TRUE; -} - - -int close_adaptor() -{ - simgraph_exit(); - - return TRUE; -} diff --git a/src/iso/world_adaptor.h b/src/iso/world_adaptor.h deleted file mode 100644 index d5b5b63e..00000000 --- a/src/iso/world_adaptor.h +++ /dev/null @@ -1,117 +0,0 @@ -/* world_adaptor.h - * - * Copyright (c) 2001 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph<->Angband adaption code. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef hajo_world_adaptor_h -#define hajo_world_adaptor_h - -/* world_adapter.h - * - * adpater between angband code and simugraph engine - * Hj. Malthaner, Jan 2001 - */ - -// I need angband's bool -#include "../h-type.h" - -/* - * Highlit location - use read only! - */ -extern int high_x; -extern int high_y; - -int init_adaptor(); -int close_adaptor(); - -int refresh_display(); - -/** - * remember targetted location - * @author J. Frieling - */ -bool iso_target_hook(char *fmt); - -/** - * Highlite (mark) location x,y - * @author Hj. Malthaner - */ -void highlite_spot(int x, int y); - -/** - * Set a grid type (takes argument modulo 3) - * @author Hj. Malthaner - */ -void set_grid(int no); - - -/** - * Show which grid type ? - * @author Hj. Malthaner - */ -int get_grid(); - - -/** - * Turn shadows on/off (0=off, 1=on) - * @author Hj. Malthaner - */ -//void set_shadow(int yesno); - - - -/** - * Ermittelt x-Offset gescrollter Karte - * @author Hj. Malthaner - */ -int get_x_off(); - - -/** - * Ermittelt y-Offset gescrollter Karte - * @author Hj. Malthaner - */ -int get_y_off(); - - -/** - * Determines i-offset of the watch point - * @author Hj. Malthaner - */ -int get_i_off(); - - -/** - * Determines j-offset of the watch point - * @author Hj. Malthaner - */ -int get_j_off(); - - -#endif - diff --git a/src/iso/world_view.c b/src/iso/world_view.c deleted file mode 100644 index 0a4b47fe..00000000 --- a/src/iso/world_view.c +++ /dev/null @@ -1,499 +0,0 @@ -/* world_view.c
- *
- * Copyright (c) 2001, 2002 Hansjörg Malthaner
- * hansjoerg.malthaner@gmx.de
- *
- * This file is part of the Simugraph<->Angband adaption code.
- *
- *
- * This file may be copied and modified freely so long as the above credits,
- * this paragraph, and the below disclaimer of warranty are retained; no
- * financial profit is derived from said modification or copying; and all
- * licensing rights to any modifications are granted to the original author,
- * Hansjörg Malthaner.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <stdio.h>
-#include "simgraph.h"
-#include "world_view.h"
-#include "world_adaptor.h"
-
-//#include "walls4.h"
-#include "walls9.h"
-
-#include "hackdef.h"
-
-
-#undef MIN
-#undef MAX
-
-
-#include "../angband.h"
-#include "../defines.h"
-
-
-/* from isov-x11.c */
-extern unsigned char **iso_ap;
-extern unsigned char **iso_cp;
-extern unsigned char **iso_atp;
-extern unsigned char **iso_ctp;
-# ifdef USE_EGO_GRAPHICS
-extern unsigned char **iso_aep;
-extern unsigned char **iso_cep;
-# endif /* USE_EGO_GRAPHICS */
-
-
-#ifdef USE_SMALL_ISO_HACK
-
-static bool is_valid_position(int x, int y) {
- return x >= 0 && y >= 0 && x<cur_wid && y<cur_hgt;
-}
-
-static bool is_valid_to_show(int x, int y) {
- return is_valid_position(x, y);
-}
-
-static int get_feat_nc(int x, int y)
-{
- /* this is for Angabdn 2.9.1
- return cave_feat[y][x];
- */
-
- /* Pernangband 4.1.5 */
- cave_type *c_ptr;
-
- /* Get the cave */
- c_ptr = &cave[y][x];
-
-
- /* Feature code */
- return c_ptr->feat;
-}
-
-
-static int get_feat_wc(int x, int y)
-{
- if(is_valid_position(x,y)) {
- return get_feat_nc(x,y);
- } else {
- return FEAT_PERM_SOLID;
- }
-}
-
-
-static int get_info_nc(int x, int y)
-{
- /* this is for Angabdn 2.9.1
- return cave_info[y][x];
- */
-
- /* Pernangband 4.1.5 */
- cave_type *c_ptr;
-
- /* Get the cave */
- c_ptr = &cave[y][x];
-
-
- /* Info code */
- return c_ptr->info;
-}
-
-
-static int get_info_wc(int x, int y)
-{
- if(is_valid_position(x,y)) {
- return get_info_nc(x,y);
- } else {
- return 0;
- }
-}
-
-
-static bool is_door(int feat)
-{
- return
- (feat == FEAT_OPEN) ||
- (feat == FEAT_BROKEN) ||
- (feat == FEAT_SECRET) ||
- (feat >= FEAT_DOOR_HEAD && feat <= FEAT_DOOR_TAIL) ||
- (feat == FEAT_SHOP);
-}
-
-
-static bool is_wall(int feat)
-{
- return
- (feat >= FEAT_MAGMA && feat <= FEAT_PERM_SOLID) ||
- (feat >= FEAT_TREES && feat <= FEAT_SANDWALL_K) ||
- (feat >= FEAT_QUEST1 && feat <= FEAT_QUEST4);
-}
-
-
-static int is_wall_or_door(int x, int y)
-{
- const int feat = get_feat_wc(x, y);
-
- return is_door(feat) || is_wall(feat);
-}
-
-
-static bool is_lit(int x, int y)
-{
- const int info = get_info_wc(x, y);
-
- return (info & CAVE_GLOW) && (info & CAVE_VIEW) && (info & CAVE_MARK);
-}
-
-
-static bool is_torch_lit(int x, int y)
-{
- const int info = get_info_wc(x, y);
-
- return (info & CAVE_PLIT) && (info & CAVE_VIEW) && (info & CAVE_MARK);
-}
-
-
-static bool is_only_torch_lit(int x, int y)
-{
- return is_torch_lit(x, y) & !is_lit(x, y);
-}
-
-
-static bool is_blind()
-{
- // PernAngband variant
- return p_ptr->blind;
-}
-
-
-/**
- * Calculates distance from player to point (x,y).
- * Uses the distance guess from cave.c
- * @author Hj. Malthaner
- */
-static int get_distance_to_player(int x, int y)
-{
- return distance(y, x, p_ptr->py, p_ptr->px);
-}
-
-#else
-
-
-static int iso_access(unsigned char **field, int x, int y)
-{
- if(x >= 0 && y >= 0 && x<80 && y<24) {
- return field[y][x] & 0x7f;
- } else {
- return 0;
- }
-}
-
-static int is_wall_or_door(int x, int y)
-{
- const int atp = iso_access(iso_atp, x, y);
- const int ctp = iso_access(iso_ctp, x, y);
-
- return (atp == 0x01 && (ctp >= 0x70 && ctp <= 0x75)) ||
- (atp == 0x00 && (ctp =='+' || ctp == '\'')) ;
-}
-
-#endif
-
-
-/**
- * Draw ground of location i,j onto screen position xpos,ypos
- * @author Hj. Malthaner
- */
-void display_boden(int x, int y, int xpos, int ypos)
-{
- // unused in Iso-Angband
-}
-
-
-static int check_wall(int x, int y)
-{
-
- int o = 0;
-
-#if 0
- o |= (is_wall_or_door(x-1, y-1)) << 0;
- o |= (is_wall_or_door(x , y-1)) << 1;
- o |= (is_wall_or_door(x+1, y-1)) << 2;
- o |= (is_wall_or_door(x-1, y )) << 3;
- o |= (is_wall_or_door(x+1, y )) << 4;
- o |= (is_wall_or_door(x-1, y+1)) << 5;
- o |= (is_wall_or_door(x , y+1)) << 6;
- o |= (is_wall_or_door(x+1, y+1)) << 7;
-
-
- return wall_table[o];
-#endif
- // jue: new algorithm as suggested by James Andrewartha
- //
- o |= (is_wall_or_door(x-1, y-1)
- && is_wall_or_door(x, y-1)
- && is_wall_or_door(x-1,y)) << 0;
-
- o |= (is_wall_or_door(x , y-1)) << 1;
-
- o |= (is_wall_or_door(x+1, y-1)
- && is_wall_or_door(x, y-1)
- && is_wall_or_door(x+1, y)) << 2;
-
- o |= (is_wall_or_door(x-1, y )) << 3;
-
- o |= (is_wall_or_door(x+1, y )) << 4;
-
- o |= (is_wall_or_door(x-1, y+1)
- && is_wall_or_door(x-1, y)
- && is_wall_or_door(x, y+1)) << 5;
-
- o |= (is_wall_or_door(x , y+1)) << 6;
-
- o |= (is_wall_or_door(x+1, y+1)
- && is_wall_or_door(x+1, y)
- && is_wall_or_door(x, y+1)) << 7;
-
- return o;
-}
-
-
-static int door_direction(int x, int y)
-{
- if(is_wall_or_door(x-1, y) && is_wall_or_door(x+1, y)) {
- return 1;
- } else {
- return 0;
- }
-}
-
-static int calc_nc(int c, int a)
-{
- return ((a & 0x7F) << 7) + (c & 0x7F);
-}
-
-
-/**
- * Draw objects of location i,j onto screen position xpos,ypos
- * @author Hj. Malthaner
- */
-void display_dinge(int x, int y, int xpos, int ypos)
-{
- const int grid = get_grid();
-
- int feat_nc = -1;
- int obj_nc = -1;
-#ifdef USE_EGO_GRAPHICS
- int ego_nc = -1;
-#endif
-
- int shade;
- int i;
-
- // relative to view position
-// int xoff = x - p_ptr->px + (SCREEN_WID/2 + 13);
-// int xoff = x - p_ptr->px + (SCREEN_WID/2 + 13);
-//
-// new (jue):
-// look at cave.c, panel_col_of and the places it's used...
- int xoff = x - panel_col_min + COL_MAP;
- int yoff = y - panel_row_prt;
-
- // try to use output of the term package
- if(xoff >= 0 && yoff >= 1 && xoff < 80 && yoff < 23) {
- // floor, walls
-
- const int c = iso_cp[yoff][xoff];
- const int a = iso_ap[yoff][xoff];
-
- // object/monster
- const int tc = iso_ctp[yoff][xoff];
- const int ta = iso_atp[yoff][xoff];
-
-#ifdef USE_EGO_GRAPHICS
- // transparent overlay
- const int ec = iso_cep[yoff][xoff];
- const int ea = iso_aep[yoff][xoff];
-
- ego_nc = calc_nc(ec, ea);
-#endif
- feat_nc = calc_nc(tc, ta);
- obj_nc = calc_nc(c, a);
-
- } else {
- // outside 80x24 view, try to read map
-
- if(is_valid_to_show(x,y)) {
-
- byte a, ta;
- char c, tc;
-#ifdef USE_EGO_GRAPHICS
- byte ea;
- char ec;
-
- map_info(y, x, &a, &c, &ta, &tc, &ea, &ec);
- ego_nc = calc_nc(ec, ea);
-#else
- map_info(y, x, &a, &c, &ta, &tc);
-#endif
- feat_nc = calc_nc(tc, ta);
- obj_nc = calc_nc(c, a);
- }
-
- }
-
-
-
- shade = 1;
-
- if(is_lit(x, y)) {
- shade = 2;
- } else if(is_torch_lit(x, y)) {
- shade = 0;
- }
-
-
- // did we get some data ?
- if(feat_nc != -1) {
-
- // check shading
- // printf("%d %d -> %d\n", x, y, shade);
-
- if(feat_nc >= 240 && feat_nc <= 245) {
- // old shading
- // const int shade = (feat_nc-240);
- const int set_base = 240+shade*9;
- const int bits = check_wall(x, y);
-
-
- display_img(316+(shade%3), xpos, ypos, TRUE);
-
- if(bits) {
- for(i=0; i<4; i++) {
- if(bits & (1 << i)) {
- display_img(set_base+i, xpos, ypos, TRUE);
- }
- }
-
- display_img(set_base+8, xpos, ypos, TRUE);
-
- for(i=4; i<8; i++) {
- if(bits & (1 << i)) {
- display_img(set_base+i, xpos, ypos, TRUE);
- }
- }
-
- } else {
- // a pillar
- display_img(set_base+8, xpos, ypos, TRUE);
- }
-
- // fields with walls never contain anything else
- // so we can quit now
- return;
-
- } else if(feat_nc == 0x27) {
- // open doors
- display_img(138+door_direction(x,y), xpos, ypos, TRUE);
-
-
- } else if(feat_nc == 0x2B) {
- // closed doors
- display_img(136+door_direction(x,y), xpos, ypos, TRUE);
-
- } else if(feat_nc == 0x8C || // a between gate
- feat_nc == 0x20 || // empty square
- feat_nc == 0x16E || // brick roof
- feat_nc == 0x16F || // brick roof top
- feat_nc == 0x176 || // grass roof
- feat_nc == 0x177 || // grass roof chimney
- feat_nc == 0x17E || // grass roof top
- (feat_nc >= 0x31 && feat_nc <= 0x39) || // shop with number
- (feat_nc >= 0x576 && feat_nc <= 0x57D) || // trap
- feat_nc == 0x3E || // down stairs
- feat_nc == 0x3C // up stairs
- ) {
- // this features should not be shaded
-
- display_img(feat_nc, xpos, ypos, TRUE);
-
- } else if(feat_nc > 2){
- // this features should be shaded
-
- // floor
- // known grids get shaded floors
- if(is_only_torch_lit(x,y)) {
- display_color_img(feat_nc+2,
- xpos, ypos,
- get_distance_to_player(x, y) << 1,
- TRUE);
- } else {
- display_img(feat_nc+shade, xpos, ypos, TRUE);
- }
- }
-
- // printf("%d a=%x c=%x (%c)\n", nc, a, c, c);
-
- /* Hajo: display a complete grid if the user wants to */
- if(grid == 2) {
- display_img(6, xpos, ypos, TRUE);
- }
-
-
-#ifdef USE_EGO_GRAPHICS
- if( ego_nc != feat_nc &&
- ego_nc > 2 &&
- ego_nc != 0x27 &&
- ego_nc != 0x2B ) {
-
- display_img(ego_nc, xpos, ypos, TRUE);
- }
-#endif
-
- if( obj_nc != feat_nc &&
- obj_nc > 2 &&
- obj_nc != 0x27 &&
- obj_nc != 0x2B ) {
-
- /* Hajo: display a grid below items/monsters if the user wants to */
- if(grid == 1) {
- display_img(5, xpos, ypos, TRUE);
- }
-
- display_img(obj_nc, xpos, ypos, TRUE);
-
- }
- } else {
-
- // outside of dungeon
- display_img(32, xpos, ypos, TRUE);
- }
-
- /* display cursor ? */
- if(
- high_x >= 1 &&
- high_y >= 1) {
- if(xoff == high_x &&
- yoff == high_y) {
- display_img(7, xpos, ypos, TRUE);
-
- /* only draw once, wait until next request */
- high_x = high_y = -1;
- }
- }
-}
-
diff --git a/src/iso/world_view.h b/src/iso/world_view.h deleted file mode 100644 index 426627e2..00000000 --- a/src/iso/world_view.h +++ /dev/null @@ -1,49 +0,0 @@ -/* world_view.h - * - * Copyright (c) 2001 Hansjörg Malthaner - * hansjoerg.malthaner@gmx.de - * - * This file is part of the Simugraph<->Angband adaption code. - * - * - * This file may be copied and modified freely so long as the above credits, - * this paragraph, and the below disclaimer of warranty are retained; no - * financial profit is derived from said modification or copying; and all - * licensing rights to any modifications are granted to the original author, - * Hansjörg Malthaner. - * - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef hajo_world_view_h -#define hajo_world_view_h - - - -/** - * Draw ground of location i,j onto screen position xpos,ypos - * @author Hj. Malthaner - */ -void display_boden(int i, int j, int xpos, int ypos); - - -/** - * Draw objects of location i,j onto screen position xpos,ypos - * @author Hj. Malthaner - */ -void display_dinge(int i, int j, int xpos, int ypos); - - -#endif |