void MCControl::layer_rectchanged(const MCRectangle& p_old_rect, bool p_redraw_all) { if (!opened) return; // Check the visibility state of the object. bool t_is_visible; t_is_visible = isvisible() || MCshowinvisibles; // If we are not a sprite, and are invisible there is nothing to do; otherwise // we must at least try to dump cached updated parts of the sprite. if (!layer_issprite() && !t_is_visible) return; // Cache the new rectangle. MCRectangle t_new_rect; t_new_rect = rect; // Temporarily set it back to the old one so we can compute the old effective // rect. MCRectangle t_old_effectiverect; rect = p_old_rect; t_old_effectiverect = geteffectiverect(); // If the rect has changed size and we aren't a scrolling layer, then we // redraw all. if (!layer_isscrolling() && (rect . width != t_new_rect . width || rect . height != t_new_rect . height)) p_redraw_all = true; // Replace the new rect and do the rect changed updates. rect = t_new_rect; layer_changeeffectiverect(t_old_effectiverect, p_redraw_all, t_is_visible); }
/* Move cursor to x rows and y cols (0-based). */ void curs_move(int *_x, int *_y, int x, int y) { v86.ctl = 0; v86.addr = 0x10; v86.eax = 0x0200; v86.ebx = 0x0; v86.edx = ((0x00ff & y) << 8) + (0x00ff & x); v86int(); *_x = x; *_y = y; /* If there is ctrl char at this position, cursor would be invisible. * Make it a space instead. */ v86.ctl = 0; v86.addr = 0x10; v86.eax = 0x0800; v86.ebx = 0x0; v86int(); #define isvisible(c) (((c) >= 32) && ((c) < 255)) if (!isvisible(v86.eax & 0x00ff)) { write_char(' ', fg_c, bg_c); } }
void MCControl::layer_setrect(const MCRectangle& p_new_rect, bool p_redraw_all) { if (!opened) { setrect(p_new_rect); return; } // Check the visibility state of the object. bool t_is_visible; t_is_visible = isvisible() || MCshowinvisibles; // If we are not a sprite, and are invisible there is nothing to do; otherwise // we must at least try to dump cached updated parts of the sprite. if (!layer_issprite() && !t_is_visible) { setrect(p_new_rect); return; } MCRectangle t_old_effectiverect; t_old_effectiverect = geteffectiverect(); // If the rect has changed size and we aren't a scrolling layer, then we // redraw all. if (!layer_isscrolling() && (rect . width != p_new_rect . width || rect . height != p_new_rect . height)) p_redraw_all = true; setrect(p_new_rect); layer_changeeffectiverect(t_old_effectiverect, p_redraw_all, t_is_visible); }
void MCControl::layer_redrawrect(const MCRectangle& p_dirty_rect) { if (!opened) return; // Check the visibility state of the object. bool t_is_visible; t_is_visible = isvisible() || MCshowinvisibles; // If we are not a sprite, and are invisible there is nothing to do; otherwise // we must at least try to dump cached updated parts of the sprite. if (!layer_issprite() && !t_is_visible) return; // Scrolling layers are a special case as its the content that must be dirtied // not the effective image. if (!layer_isscrolling()) { MCRectangle t_dirty_rect; t_dirty_rect = p_dirty_rect; if (m_bitmap_effects != nil) MCBitmapEffectsComputeBounds(m_bitmap_effects, t_dirty_rect, t_dirty_rect); layer_dirtyeffectiverect(t_dirty_rect, t_is_visible); } else layer_dirtycontentrect(p_dirty_rect, t_is_visible); }
void MCControl::layer_scrolled(void) { if (!opened) return; // Check the visibility state of the object. bool t_is_visible; t_is_visible = isvisible() || MCshowinvisibles; // If the layer isn't scrolling, we must redraw the whole thing. Otherwise // we just need to invalidate a portion of the card. if (!layer_isscrolling()) { // We only actually need to do something if we are in the sprite // case, or we are visible if (layer_issprite() || t_is_visible) layer_dirtyeffectiverect(geteffectiverect(), t_is_visible); } else { // If we are a scrolling layer and not visible, there is nothing to // do. if (t_is_visible) static_cast<MCCard *>(parent) -> layer_dirtyrect(geteffectiverect()); } }
void MCControl::layer_effectiverectchangedandredrawall(const MCRectangle& p_old_effective_rect) { if (!opened) return; // Check the visibility state of the object. bool t_is_visible; t_is_visible = isvisible() || MCshowinvisibles; // If we are not a sprite, and are invisible there is nothing to do; otherwise // we must at least try to dump cached updated parts of the sprite. if (!layer_issprite() && !t_is_visible) return; layer_changeeffectiverect(p_old_effective_rect, true, t_is_visible); }
/* Move cursor to x rows and y cols (0-based). */ void curs_move(int x, int y) { int pos; pos = x + y * col; crtat = Crtat + pos; pos = crtat - Crtat; while((inb(0x60) & 0x04) == 0) {} outb(0x62, 0x49); outb(0x60, pos & 0xff); outb(0x60, pos >> 8); curx = x; cury = y; #define isvisible(c) (((c) >= 32) && ((c) < 255)) if (!isvisible(*crtat & 0x00ff)) { write_char(' ', fg_c, bg_c); } }
void MCControl::layer_transientchangedandredrawall(int32_t p_old_transient) { if (!opened) return; // Check the visibility state of the object. bool t_is_visible; t_is_visible = isvisible() || MCshowinvisibles; // If we are not a sprite, and are invisible there is nothing to do; otherwise // we must at least try to dump cached updated parts of the sprite. if (!layer_issprite() && !t_is_visible) return; MCRectangle t_old_effectiverect; t_old_effectiverect = MCU_reduce_rect(rect, -p_old_transient); if (m_bitmap_effects != nil) MCBitmapEffectsComputeBounds(m_bitmap_effects, t_old_effectiverect, t_old_effectiverect); layer_changeeffectiverect(t_old_effectiverect, true, t_is_visible); }
void MCControl::layer_redrawall(void) { if (!opened) return; // Check the visibility state of the object. bool t_is_visible; t_is_visible = isvisible() || MCshowinvisibles; // If we are not a sprite, and are invisible there is nothing to do; otherwise // we must at least try to dump cached updated parts of the sprite. if (!layer_issprite() && !t_is_visible) return; // Scrolling layers are a special case as its the content that must be dirtied // not the effective image. if (!layer_isscrolling()) layer_dirtyeffectiverect(geteffectiverect(), t_is_visible); else layer_dirtycontentrect(layer_getcontentrect(), t_is_visible); }
static int radhit(register struct application *ap, struct partition *PartHeadp, struct seg *segHeadp) { register struct partition *pp; register struct hit *hitp; struct application sub_ap; fastf_t f; vect_t to_eye, work; int depth; for ( pp=PartHeadp->pt_forw; pp != PartHeadp; pp = pp->pt_forw ) if ( pp->pt_outhit->hit_dist >= 0.0 ) break; if ( pp == PartHeadp ) { bu_log("radhit: no hit out front?\n"); return(0); } if (R_DEBUG&RDEBUG_HITS) { rt_pr_pt( ap->a_rt_i, pp ); } hitp = pp->pt_inhit; if ( hitp->hit_dist >= INFINITY ) { bu_log("radhit: entry beyond infinity\n"); return(1); } /* Check to see if eye is "inside" the solid */ if ( hitp->hit_dist < 0 ) { /* XXX */ bu_log("radhit: GAK, eye inside solid (%g)\n", hitp->hit_dist ); for ( pp=PartHeadp->pt_forw; pp != PartHeadp; pp = pp->pt_forw ) rt_pr_pt( ap->a_rt_i, pp ); return(0); } rayp = &rayinfo[ ap->a_level ]; RT_HIT_NORMAL( rayp->norm, hitp, pp->pt_inseg->seg_stp, &(ap->a_ray), pp->pt_inflip ); if (R_DEBUG&RDEBUG_HITS) { rt_pr_hit( " In", hitp ); } rayp->dist = hitp->hit_dist; rayp->reg = pp->pt_regionp->reg_regionid; rayp->sol = pp->pt_inseg->seg_stp->st_id; rayp->surf = hitp->hit_surfno; RT_CURVATURE( &(rayp->curvature), hitp, pp->pt_inflip, pp->pt_inseg->seg_stp ); if ( VDOT( rayp->norm, ap->a_ray.r_dir ) < 0 ) { bu_log(" debug: flipping curvature\n"); rayp->curvature.crv_c1 = - rayp->curvature.crv_c1; rayp->curvature.crv_c2 = - rayp->curvature.crv_c2; } VMOVE( rayp->ip, hitp->hit_point ); /* Compute the specular direction */ VREVERSE( to_eye, ap->a_ray.r_dir ); f = 2 * VDOT( to_eye, rayp->norm ); VSCALE( work, rayp->norm, f ); /* I have been told this has unit length */ VSUB2( rayp->spec, work, to_eye ); /* Save info for 1st ray */ if ( ap->a_level == 0 ) { firstray = ap->a_ray; /* struct copy */ rayp->sight = 1; /* the 1st intersect is always visible */ } else { /* Check for visibility */ rayp->sight = isvisible( ap, hitp, rayp->norm ); } /* * Shoot another ray in the specular direction. */ if ( ap->a_level < numreflect-1 ) { sub_ap = *ap; /* struct copy */ sub_ap.a_level = ap->a_level+1; VMOVE( sub_ap.a_ray.r_pt, hitp->hit_point ); VMOVE( sub_ap.a_ray.r_dir, rayp->spec ); depth = rt_shootray( &sub_ap ); } else { bu_log( "radhit: max reflections exceeded [%d %d]\n", ap->a_x, ap->a_y ); depth = 0; } if ( ap->a_level == 0 ) { /* We're the 1st ray, output the raylist */ dumpall( ap, depth+1 ); } return(depth+1); /* report hit to main routine */ }
static int radhit( struct application *ap, struct partition *PartHeadp ) { register struct partition *pp; register struct hit *hitp; struct application sub_ap; struct rayinfo *rayp; fastf_t f; vect_t to_eye, work; int depth; int cpu_num; for ( pp=PartHeadp->pt_forw; pp != PartHeadp; pp = pp->pt_forw ) if ( pp->pt_outhit->hit_dist >= 0.0 ) break; if ( pp == PartHeadp ) { bu_log("radhit: no hit out front?\n"); return 0; } if (R_DEBUG&RDEBUG_HITS) { rt_pr_pt( ap->a_rt_i, pp ); } hitp = pp->pt_inhit; if ( hitp->hit_dist >= INFINITY ) { bu_log("radhit: entry beyond infinity\n"); return 1; } /* Check to see if eye is "inside" the solid */ if ( hitp->hit_dist < 0 ) { /* XXX */ return 0; } if (R_DEBUG&RDEBUG_HITS) { rt_pr_hit( " In", hitp ); } if ( ap->a_resource == RESOURCE_NULL) cpu_num = 0; else cpu_num = ap->a_resource->re_cpu; rayp = &rayinfo[cpu_num][ ap->a_level +1 ]; rayp->x = ap->a_x; rayp->y = ap->a_y; rayp->dist = hitp->hit_dist; rayp->reg = pp->pt_regionp->reg_regionid; rayp->sol = pp->pt_inseg->seg_stp->st_id; rayp->surf = hitp->hit_surfno; RT_HIT_NORMAL( rayp->norm, hitp, pp->pt_inseg->seg_stp, &(ap->a_ray), pp->pt_inflip ); RT_CURVATURE( &(rayp->curvature), hitp, pp->pt_inflip, pp->pt_inseg->seg_stp ); if ( VDOT( hitp->hit_normal, ap->a_ray.r_dir ) < 0 ) { bu_log(" debug: curvature flip\n"); rayp->curvature.crv_c1 = - rayp->curvature.crv_c1; rayp->curvature.crv_c2 = - rayp->curvature.crv_c2; } VMOVE( rayp->ip, hitp->hit_point ); VMOVE( rayp->dir, ap->a_ray.r_dir); /* Compute the specular direction */ VREVERSE( to_eye, ap->a_ray.r_dir ); f = 2 * VDOT( to_eye, rayp->norm ); VSCALE( work, rayp->norm, f ); /* I have been told this has unit length */ VSUB2( rayp->spec, work, to_eye ); VUNITIZE( rayp->spec ); /* Save info for 1st ray */ if ( ap->a_level == 0 ) { firstray[cpu_num] = ap->a_ray; /* struct copy */ rayp->sight = 1; /* the 1st intersect is always visible */ } else { /* Check for visibility */ rayp->sight = isvisible( ap, hitp, rayp->norm ); } /* * Shoot another ray in the specular direction. */ if ( ap->a_level < numreflect-1 ) { sub_ap = *ap; /* struct copy */ sub_ap.a_level = ap->a_level+1; sub_ap.a_purpose = "secondary ray"; VMOVE( sub_ap.a_ray.r_pt, hitp->hit_point ); VMOVE( sub_ap.a_ray.r_dir, rayp->spec ); depth = rt_shootray( &sub_ap ); } else { depth = 0; } if ( ap->a_level == 0 ) { rayinfo[cpu_num][0].x = ap->a_x; rayinfo[cpu_num][0].y = ap->a_y; rayinfo[cpu_num][0].surf = depth+1; rayinfo[cpu_num][0].ip[0] = ap->a_ray.r_pt[0]; rayinfo[cpu_num][0].ip[1] = ap->a_ray.r_pt[1]; rayinfo[cpu_num][0].ip[2] = ap->a_ray.r_pt[2]; radar_physics( cpu_num, depth + 1 ); #ifdef SAR dumpall( ap, cpu_num, depth + 1); #endif } return depth+1; /* report hit to main routine */ }