void z_picture_data (void) { zword pic = zargs[0]; zword table = zargs[1]; int height, width; int i; bool avail = os_picture_data (pic, &height, &width); for (i = 0; mapper[i].story_id != UNKNOWN; i++) if (story_id == mapper[i].story_id) { if (pic == mapper[i].pic) { int height2, width2; avail &= os_picture_data (mapper[i].pic1, &height2, &width2); avail &= os_picture_data (mapper[i].pic2, &height2, &width2); height += height2; } else if (pic == mapper[i].pic1 || pic == mapper[i].pic2) avail = FALSE; } storew ((zword) (table + 0), (zword) (height)); storew ((zword) (table + 2), (zword) (width)); branch (avail); }/* z_picture_data */
void Processor::z_read_mouse() { zword btn; // Read the mouse position, the last menu click and which buttons are down btn = os_read_mouse(); hx_mouse_y = mouse_y; hx_mouse_x = mouse_x; storew((zword)(zargs[0] + 0), hx_mouse_y); storew((zword)(zargs[0] + 2), hx_mouse_x); storew((zword)(zargs[0] + 4), btn); // mouse button bits storew((zword)(zargs[0] + 6), menu_selected); // menu selection }
void memory_open (zword table, zword xsize, bool buffering) { if (++depth < MAX_NESTING) { if (!buffering) xsize = 0xffff; else { if ((short) xsize >= 0) xsize = get_max_width (xsize); else xsize = -xsize; } storew (table, 0); redirect[depth].table = table; redirect[depth].width = 0; redirect[depth].total = 0; redirect[depth].xsize = xsize; ostream_memory = TRUE; } else runtime_error (ERR_STR3_NESTING); }/* memory_open */
void z_get_cursor (void) { zword y, x; flush_buffer (); y = cwp->y_cursor; x = cwp->x_cursor; if (h_version != V6) { /* convert to grid positions */ y = (y - 1) / h_font_height + 1; x = (x - 1) / h_font_width + 1; } storew ((zword) (zargs[0] + 0), y); storew ((zword) (zargs[0] + 2), x); }/* z_get_cursor */
/* * z_pop_stack, pop n values off the game or user stack and discard them. * * zargs[0] = number of values to discard * zargs[1] = address of user stack (optional) * */ void z_pop_stack (void) { if (zargc == 2) { /* it's a user stack */ zword size; zword addr = zargs[1]; LOW_WORD (addr, size) size += zargs[0]; storew (addr, size); } else sp += zargs[0]; /* it's the game stack */ }/* z_pop_stack */
void memory_new_line (void) { zword size; zword addr; redirect[depth].total += redirect[depth].width; redirect[depth].width = 0; addr = redirect[depth].table; LOW_WORD (addr, size) addr += 2; if (redirect[depth].xsize != 0xffff) { redirect[depth].table = addr + size; size = 0; } else storeb ((zword) (addr + (size++)), 13); storew (redirect[depth].table, size); }/* memory_new_line */
void memory_word (const zword *s) { zword size; zword addr; zword c; if (h_version == V6) { int width = os_string_width (s); if (redirect[depth].xsize != 0xffff) if (redirect[depth].width + width > redirect[depth].xsize) { if (*s == ' ' || *s == ZC_INDENT || *s == ZC_GAP) width = os_string_width (++s); memory_new_line (); } redirect[depth].width += width; } addr = redirect[depth].table; LOW_WORD (addr, size) addr += 2; while ((c = *s++) != 0) storeb ((zword) (addr + (size++)), translate_to_zscii (c)); storew (redirect[depth].table, size); }/* memory_word */